def __init__(self, preprocessor, supportNodes, inclInertia=False): ''' Constructor. :param preprocessor: XC preprocessor of the problem. :param supportNodes: nodes to compute reactions. :param inclInertia: include inertia effects (defaults to false). ''' self.forces = dict() self.moments = dict() self.positions = dict() self.svdReac = geom.SlidingVectorsSystem3d() nodeHandler = preprocessor.getNodeHandler nodeHandler.calculateNodalReactions(inclInertia, 1e-7) f3d = geom.Vector3d(0.0, 0.0, 0.0) m3d = geom.Vector3d(0.0, 0.0, 0.0) for n in supportNodes: tag = n.tag tmp = n.getReaction f3d = n.getReactionForce3d m3d = n.getReactionMoment3d if (nodeHandler.numDOFs == 3): force = geom.Vector2d(f3d.x, f3d.y) else: force = f3d self.forces[tag] = force self.moments[tag] = m3d pos = n.getInitialPos3d self.positions[tag] = pos self.svdReac += geom.SlidingVectorsSystem3d(pos, f3d, m3d)
def getVDirAsVector3D(self): retval= geom.Vector3d(0.0,0.0,1.0) if(len(self.vDir)>2): retval= geom.Vector3d(self.vDir[0],self.vDir[1],self.vDir[2]) else: retval= geom.Vector3d(self.vDir[0],self.vDir[1],0.0) return retval
def cross(xcV1, xcV2): '''cross product of two xc vectors of 3-D ''' v1 = geom.Vector3d(xcV1[0], xcV1[1], xcV1[2]) v2 = geom.Vector3d(xcV2[0], xcV2[1], xcV2[2]) vcross = v1.cross(v2) xcVcross = xc.Vector([vcross.x, vcross.y, vcross.z]) return xcVcross
def getAnchorGroup(steel, diameter, squareSide, xCenter=0.0, yCenter=0.0): ''' Return four anchors in the corners of the square.''' delta = squareSide / 2.0 origin = geom.Pos3d(xCenter, yCenter, 0.0) positions = list() positions.append(origin + geom.Vector3d(delta, delta, 0.0)) positions.append(origin + geom.Vector3d(-delta, delta, 0.0)) positions.append(origin + geom.Vector3d(-delta, -delta, 0.0)) positions.append(origin + geom.Vector3d(delta, -delta, 0.0)) return ASTM_materials.AnchorGroup(steel, diameter, positions)
def centerAnchors(self, columnShape): ''' Center anchors with respect to the column steel shape.''' nAnchors = self.anchorGroup.getNumberOfBolts() if (nAnchors <= 4): flangeThickness = columnShape.get('tf') delta = (columnShape.get('h') - flangeThickness) / 4.0 positions = list() positions.append(geom.Vector3d(delta, delta, 0.0)) positions.append(geom.Vector3d(-delta, delta, 0.0)) positions.append(geom.Vector3d(-delta, -delta, 0.0)) positions.append(geom.Vector3d(delta, -delta, 0.0)) self.anchorGroup.setPositions(positions) else: lmsg.warning('Number of anchors is not 4. Cannot center them.')
def appendLoadToCurrentLoadPattern(self): O=geom.Pos3d(self.pntCoord[0],self.pntCoord[1],self.pntCoord[2]) force=geom.Vector3d(self.loadVector[0],self.loadVector[1],self.loadVector[2]) moment=geom.Vector3d(self.loadVector[3],self.loadVector[4],self.loadVector[5]) loadSVS=geom.SlidingVectorsSystem3d(O,force,moment) ptList= list() nodeList= self.xcSet.nodes if len(nodeList)>0: for n in nodeList: ptList.append(n.getInitialPos3d) loadVectors= loadSVS.distribute(ptList) for n, v in zip(nodeList,loadVectors): f= v.getVector3d() n.newLoad(xc.Vector([f.x,f.y,f.z,0.0,0.0,0.0]))
def get_polyface_points_axis(polyface_points): ''' Return the axis for the polyface.''' p= geom.Plane3d() p.linearLeastSquaresFitting(polyface_points) global_z= geom.Vector3d(0.0,0.0,1.0) local_z= p.getNormal() angle= local_z.getAngle(global_z) local_y= global_z global_y= geom.Vector3d(0.0,1.0,0.0) if(abs(angle)<1e-3 or abs(angle-math.pi)<1e-3): local_y= global_y local_x= local_y.cross(local_z) local_y= local_z.cross(local_x) org= polyface_points[0] return geom.Ref3d3d(org,local_x,local_y)
def getSVDfromVDesliz(DOFs, coo, v): # Returns a SVD which represents vector. if (DOFs == "UV"): return geom.SVD2d(geom.Pos2d(coo[0], coo[1]), geom.Vector2d(v[0], v[1])) elif (DOFs == "UVR"): return geom.SVD2d(geom.Pos2d(coo[0], coo[1]), geom.Vector2d(v[0], v[1]), v[2]) elif (DOFs == "UVW"): return geom.SVD3d(geom.Pos3d(coo[0], coo[1], coo[2]), geom.Vector3d(v[0], v[1], v[2])) elif (DOFs == "UVWRxRyRz"): return geom.SVD3d(geom.Pos3d(coo[0], coo[1], coo[2]), geom.Vector3d(v[0], v[1], v[2]), geom.Vector3d(v[3], v[4], v[5]))
def getSlidingVectorsSystemfromSlidingVector(DOFs,coo,v): '''Returns a sliding vector system equivalent to the sliding vector. Parameters: :param DOFs: degrees of freedom. :param coo: coordinates of a point in the vector line of action. :param v: vector. ''' if(DOFs=="UV"): return geom.SlidingVectorsSystem2d(geom.Pos2d(coo[0],coo[1]),geom.Vector2d(v[0],v[1])) elif(DOFs=="UVR"): return geom.SlidingVectorsSystem2d(geom.Pos2d(coo[0],coo[1]),geom.Vector2d(v[0],v[1]),v[2]) elif(DOFs=="UVW"): return geom.SlidingVectorsSystem3d(geom.Pos3d(coo[0],coo[1],coo[2]),geom.Vector3d(v[0],v[1],v[2])) elif(DOFs=="UVWRxRyRz"): return geom.SlidingVectorsSystem3d(geom.Pos3d(coo[0],coo[1],coo[2]),geom.Vector3d(v[0],v[1],v[2]),geom.Vector3d(v[3],v[4],v[5]))
def getSVDfromVDesliz(DOFs,coo,v): '''Returns a sliding vector system that represents the vector. Parameters: :param DOFs: degrees of freedom. :param coo: coordinates of a point in the vector line of action. :param v: vector. ''' if(DOFs=="UV"): return geom.SVD2d(geom.Pos2d(coo[0],coo[1]),geom.Vector2d(v[0],v[1])) elif(DOFs=="UVR"): return geom.SVD2d(geom.Pos2d(coo[0],coo[1]),geom.Vector2d(v[0],v[1]),v[2]) elif(DOFs=="UVW"): return geom.SVD3d(geom.Pos3d(coo[0],coo[1],coo[2]),geom.Vector3d(v[0],v[1],v[2])) elif(DOFs=="UVWRxRyRz"): return geom.SVD3d(geom.Pos3d(coo[0],coo[1],coo[2]),geom.Vector3d(v[0],v[1],v[2]),geom.Vector3d(v[3],v[4],v[5]))
def setImperfectionsXY(nodeSet, slopeX=1.0 / 500.0, slopeY=1.0 / 500.0): '''Set the initial imperfection of the model. :param nodeSet: set which nodes will be moved. :param slopeX: out of plumbness on x axis. :param slopeY: out of plumbness on y axis. ''' if (abs(slopeX) < 1.0 / 500.0): print('small imperfection on X.') if (abs(slopeY) < 1.0 / 500): print('small imperfection on Y.') zMin = 1e6 zMax = -1e6 maxValue = 0.0 for n in nodeSet.nodes: pos = n.getInitialPos3d zMin = min(zMin, pos.z) zMax = max(zMax, pos.z) for n in nodeSet.nodes: pos = n.getInitialPos3d h = pos.z - zMin deltaX = h * slopeX deltaY = h * slopeY maxValue = max(maxValue, deltaX**2 + deltaY**2) newPos = pos + geom.Vector3d(deltaX, deltaY, 0.0) n.setPos(newPos) return math.sqrt(maxValue)
def get_principal_axis_3D(points): ''' Compute principal axes :param points: 3D point cloud. ''' #create coordinates array coord = numpy.array(points, float) # compute geometric center center = numpy.mean(coord, 0) # center with geometric center coord = coord - center # compute principal axis matrix inertia = numpy.dot(coord.transpose(), coord) e_values, e_vectors = numpy.linalg.eig(inertia) # warning eigen values are not necessary ordered! # http://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.eig.html #-------------------------------------------------------------------------- # order eigen values (and eigen vectors) # # axis1 is the principal axis with the biggest eigen value (eval1) # axis2 is the principal axis with the second biggest eigen value (eval2) # axis3 is the principal axis with the smallest eigen value (eval3) #-------------------------------------------------------------------------- order = numpy.argsort(e_values) eval3, eval2, eval1 = e_values[order] axis3, axis2, axis1 = e_vectors[:, order].transpose() # scale factor to enhance the length of axis in Pymol scale_factor = 20 #-------------------------------------------------------------------------- # center axes to the geometric center of the molecule # and rescale them by order of eigen values #-------------------------------------------------------------------------- # the large vector is the first principal axis v1 = 3 * scale_factor * axis1 # the medium vector is the second principal axis v2 = 2 * scale_factor * axis2 # the small vector is the third principal axis v3 = 1 * scale_factor * axis3 return geom.Ref3d3d(geom.Pos3d(center[0], center[1], center[2]), geom.Vector3d(v1[0], v1[1], v1[2]), geom.Vector3d(v2[0], v2[1], v2[2]), geom.Vector3d(v3[0], v3[1], v3[2]))
def getHalfChamferVector(diagonal): ''' Return a vector normal to the diagonal contained in a vertical plane.''' iVector = diagonal.iVector # Horizontal vector perpendicular to the projection # of iVector on the horizontal plane. perpHoriz = geom.Vector3d(-iVector.y, iVector.x, 0.0) return iVector.cross(perpHoriz).normalized()
def translat(toSet, deltaXYZ): '''Apply a translation (dx,dy,dz) to all the entities in the set :param toSet: set of entities :param deltaXYZ: displacements in global X-Y-Z axes(dx,dy,dz) ''' transl = xc.Translation( geom.Translation3d(geom.Vector3d(deltaXYZ[0], deltaXYZ[1], deltaXYZ[2]))) toSet.transforms(transl)
def calcPressures(self): ''' Foundation pressures over the soil. Calculates pressures and forces in the free nodes of the springs (those that belongs to both the spring and the foundation) and stores these values as properties of those nodes: property 'soilPressure:' [xStress,yStress,zStress] property 'soilReaction:' [xForce,yForce,zForce]''' self.svdReac = geom.SlidingVectorsSystem3d() f3d = geom.Vector3d(0.0, 0.0, 0.0) m3d = geom.Vector3d(0.0, 0.0, 0.0) for e in self.springs: n = e.getNodes[1] rf = e.getResistingForce() a = n.getTributaryArea() if (len(rf) == 6): f3d = geom.Vector3d(rf[0], rf[1], 0.0) m3d = geom.Vector3d(0.0, 0.0, rf[2]) else: #len(rf)==12 f3d = geom.Vector3d(rf[0], rf[1], rf[2]) m3d = geom.Vector3d(rf[3], rf[4], rf[5]) pos = n.getInitialPos3d self.svdReac += geom.SlidingVectorsSystem3d(pos, f3d, m3d) #print "dispZ= ", n.getDisp[2]*1e3, "mm" n.setProp('soilPressure', [f3d.x / a, f3d.y / a, f3d.z / a]) n.setProp('soilReaction', [f3d.x, f3d.y, f3d.z]) return self.svdReac.reduceTo(self.getCentroid())
def __init__(self,preprocessor,supportNodes): self.forces= dict() self.moments= dict() self.positions= dict() self.svdReac= geom.SVD3d() meshNodes= preprocessor.getNodeLoader meshNodes.calculateNodalReactions(True) f3d= geom.Vector3d(0.0,0.0,0.0) m3d= geom.Vector3d(0.0,0.0,0.0) for n in supportNodes: tag= n.tag tmp= n.getReaction if(meshNodes.numDOFs==3): force= geom.Vector2d(tmp[0],tmp[1]) f3d= geom.Vector3d(tmp[0],tmp[1],0.0) moment= geom.Vector3d(0.0,0.0,tmp[2]) m3d= moment else: force= geom.Vector3d(tmp[0],tmp[1],tmp[2]) f3d= force moment= geom.Vector3d(tmp[3],tmp[4],tmp[5]) m3d= moment self.forces[tag]= force self.moments[tag]= moment pos= n.getInitialPos3d self.positions[tag]= pos self.svdReac+= geom.SVD3d(pos,f3d,m3d)
def dumpSurfaceLoads(self, lp, destLoadCase): '''Dump loads over surfaces as free surface loads.''' domain= lp.getDomain preprocessor= lp.getDomain.getPreprocessor eLoadIter= lp.loads.getElementalLoadIter eLoad= eLoadIter.next() loadSets= [] while eLoad: setName= 'surfaceLoadSet'+str(eLoad.tag) surfaceLoadSet= preprocessor.getSets.defSet(setName) surfaceLoadSet.elementalLoad= eLoad elemTags= eLoad.elementTags resultant= eLoad.getResultant(geom.Pos3d(0,0,0),True) #Total force over the elements. totalForce= geom.Vector3d(resultant.x,resultant.y,resultant.z) totalForceModulus= totalForce.getModulus() numberOfLoadedElements= len(elemTags) if(numberOfLoadedElements>1): #It seems there is a bug in totalArea= 0.0 for tag in elemTags: elem= domain.getMesh.getElement(tag) totalArea+= elem.getArea(True) if(elem): surfaceLoadSet.elements.append(elem) else: lmsg.error('element: '+ str(tag) + ' not found.') surfaceLoadSet.value= totalForceModulus surfaceLoadSet.vDir= [totalForce.x/surfaceLoadSet.value,totalForce.y/surfaceLoadSet.value,totalForce.z/surfaceLoadSet.value] surfaceLoadSet.value/= totalArea elementContours= surfaceLoadSet.elements.getContours(0.0) if(len(elementContours)>1): lmsg.error('surface load set: '+ setName + ' has more than one contour. Contours others than first are ignored.') surfaceLoadSet.polygon= elementContours[0] surfaceLoadSet.polygon.simplify(.01) #Deletes unnecesary vertices. loadSets.append(surfaceLoadSet) else: elem= domain.getMesh.getElement(elemTags[0]) #Only one element... pLoad= nld.PointForceRecord(destLoadCase, self.pointLoadCounter,elem.getPosCentroid(True),1.0) pLoad.value= totalForceModulus pLoad.vDir= [totalForce.x/pLoad.value,totalForce.y/pLoad.value,totalForce.z/pLoad.value] pLoad.tag= eLoad.tag destLoadCase.loads.punctualLoads.append(pLoad) self.pointLoadCounter+=1 eLoad= eLoadIter.next() for s in loadSets: sLoad= nld.SurfaceLoadRecord(destLoadCase, self.surfaceLoadCounter) sLoad.polygon= s.polygon sLoad.value= s.value sLoad.vDir= s.vDir destLoadCase.loads.surfaceLoads.append(sLoad) self.surfaceLoadCounter+=1
def __init__(self, preprocessor, supportNodes): self.forces = dict() self.moments = dict() self.positions = dict() self.svdReac = geom.SlidingVectorsSystem3d() nodeHandler = preprocessor.getNodeHandler nodeHandler.calculateNodalReactions(True, 1e-7) f3d = geom.Vector3d(0.0, 0.0, 0.0) m3d = geom.Vector3d(0.0, 0.0, 0.0) for n in supportNodes: tag = n.tag tmp = n.getReaction f3d = n.getReactionForce3d m3d = n.getReactionMoment3d if (nodeHandler.numDOFs == 3): force = geom.Vector2d(f3d.x, f3d.y) else: force = f3d self.forces[tag] = force self.moments[tag] = m3d pos = n.getInitialPos3d self.positions[tag] = pos self.svdReac += geom.SlidingVectorsSystem3d(pos, f3d, m3d)
def getToColumnBottomLeg(self, p0, cutKnifePoint=1.0): '''Return the points of a verticol bottom leg. :param p0: intersection of the member axis with the column. :param cutKnifePoint: if <1 cuts the point of the knife at the contact of the leg with the column surface. ''' p1 = self.gussetTip - self.halfChamfer tmp = p0 - geom.Vector3d(0.0, 0.0, p0.z) # vertical of the intersection # with the column. if (cutKnifePoint == 1.0): p2 = tmp p3 = None else: knifeEdge = geom.Segment3d(p1, tmp) p3 = p0 - geom.Vector3d(0.0, 0.0, cutKnifePoint * p0.z) # Horizontal plane through p3 planeP3 = geom.Plane3d(p3, geom.Vector3d(1, 0, 0), geom.Vector3d(0, 1, 0)) # Cut the point p2 = planeP3.getIntersection(knifeEdge) return p1, p2, p3
# -*- coding: utf-8 -*- # Angle between two vectors. from __future__ import print_function import xc_base import geom import math vec1 = geom.Vector3d(1, 7.19412e-10, -2.08017e-05) vec2 = geom.Vector3d(1, 0, -2.08017e-05) angle = vec1.getAngle(vec2) angleTeor = 0.0 ratio1 = math.fabs(angleTeor - angle) #/angleTeor #print("angle= ", math.degrees(angle)) import os fname = os.path.basename(__file__) if math.fabs(ratio1) < 1e-4: print("test ", fname, ": ok.") else: print("test ", fname, ": ERROR.")
# -*- coding: utf-8 -*- import xc_base import geom import math pos1 = geom.Pos3d(0.5, 0, 0) ptoAplica = geom.Pos3d(5, 0, 0) vectorDir = geom.Vector3d(0, 2, 0) vec1 = geom.SlidingVector3d(ptoAplica, vectorDir) brazo = vec1.getOrg().x - pos1.x m = vec1.getMomentPos3d(pos1) fuerza = vec1.y mTeor = fuerza * brazo import os fname = os.path.basename(__file__) if m.x == 0 and m.y == 0 and m.z == mTeor: print "test ", fname, ": ok." else: print "test ", fname, ": ERROR."
from __future__ import print_function import xc_base import geom o=geom.Pos3d(0,0,0) v=geom.Vector3d(0,0,1) plane=geom.Plane3d(o,v) normal=plane.getNormal() base1=plane.getBase1() base2=plane.getBase2() tp=plane.tipo() import os fname= os.path.basename(__file__) if normal.x==0 and normal.y==0 and normal.z==1: print("test ",fname,": ok.") else: print("test ",fname,": ERROR.")
def getForce(self, x, P): alpha = self.alpha(x) return P * geom.Vector3d(math.cos(alpha), 0.0, math.sin(alpha))
#Example 1.13 of the thesis «La teoría de bloque aplicada a la dinámica #de rocas» by Juan Carlos Ayes Zamudio from __future__ import print_function import xc_base import geom import math import teoria_bloques alpha1 = math.radians(20) beta1 = math.radians(280) alpha2 = math.radians(60) beta2 = math.radians(150) p = geom.Pos3d(0, 0, 0) R = geom.Vector3d(0, -1, 1) plBuz1 = teoria_bloques.computeDipPlane(alpha1, beta1, p) P1 = geom.HalfSpace3d(plBuz1) plBuz2 = teoria_bloques.computeDipPlane(alpha2, beta2, p) P2 = geom.HalfSpace3d(plBuz2) r = P1.getLima(P2) s = r.getProj(R) s = s.normalized() sTeor = geom.Vector3d(-0.7650, -0.5992, -0.2363) ratio1 = sTeor - s ratio1 = ratio1.getModulus()
lane1CenterLongSlope = lane1Sg.getVDir().normalizado() loadPositions = [(-0.6, 1.0), (0.6, 1.0), (-0.6, -1.0), (0.6, -1.0)] load3DPositions = list() for p in loadPositions: p3D = lane1Center + p[1] * lane1CenterTrsvSlope + p[ 0] * lane1CenterLongSlope load3DPositions.append(p3D) lane1CenterNodLst = sets_mng.get_lstNod_from_lst3DPos(preprocessor, lst3DPos=load3DPositions) alphaQ1 = 0.7 Qk1 = alphaQ1 * 300e3 / 2.0 #N Qk1LongBrake = 1.2 * Qk1 * lane1CenterLongSlope Qk1TrsvBrake = -0.25 * 1.2 * Qk1 * lane1CenterTrsvSlope Qk1TrsvCentrif = -0.033 * 1.2 * Qk1 * lane1CenterTrsvSlope Qk1Brake = Qk1LongBrake + Qk1TrsvCentrif + Qk1TrsvBrake Qk1Vector = geom.Vector3d(0.0, 0.0, -Qk1) + Qk1Brake for n in lane1CenterNodLst: cLC.newNodalLoad( n.tag, xc.Vector([Qk1Vector.x, Qk1Vector.y, Qk1Vector.z, 0, 0, 0])) lane2Axis = laneAxisLines[1] lane2Sg = lane2Axis.getSegment(2) lane2Center = lane2Sg.getCenterOfMass() lane2CenterTrsvSlope = (transverseSlopes[1] + transverseSlopes[2]) * 0.5 lane2CenterLongSlope = lane2Sg.getVDir().normalizado() load3DPositions = list() for p in loadPositions: p3D = lane2Center + p[1] * lane2CenterTrsvSlope + p[ 0] * lane2CenterLongSlope load3DPositions.append(p3D) lane2CenterNodLst = sets_mng.get_lstNod_from_lst3DPos(preprocessor, lst3DPos=load3DPositions)
points = preprocessor.getMultiBlockTopology.getPoints pt1 = points.newPntIDPos3d(1, geom.Pos3d(0.0, 0.0, 0.0)) pt2 = points.newPntIDPos3d(2, geom.Pos3d(1.0, 0.0, 0.0)) pt3 = points.newPntIDPos3d(3, geom.Pos3d(1.0, 1.0, 0.0)) pt4 = points.newPntIDPos3d(4, geom.Pos3d(0.0, 1.0, 0.0)) surfaces = preprocessor.getMultiBlockTopology.getSurfaces surfaces.defaultTag = 1 s1 = surfaces.newQuadSurfacePts(pt1.tag, pt2.tag, pt3.tag, pt4.tag) iVector = s1.getIVector jVector = s1.getJVector kVector = s1.getKVector localAxes = s1.getLocalAxes() ratio = (iVector - geom.Vector3d(1.0, 0.0, 0.0)).getModulus()**2 ratio += (jVector - geom.Vector3d(0.0, 1.0, 0.0)).getModulus()**2 ratio += (kVector - geom.Vector3d(0.0, 0.0, 1.0)).getModulus()**2 testMatrix = xc.Matrix([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) ratio += (localAxes - testMatrix).OneNorm() ''' print 'iVector= ', iVector print 'jVector= ', jVector print 'kVector= ', kVector print 'localAxes= ', localAxes print ratio ''' feProblem.errFileName = "cerr" # Display errors if any. import os from misc_utils import log_messages as lmsg
''' We define nodes at the points where loads will be applied. We will not compute stresses so we can use an arbitrary cross section of unit area.''' elements= preprocessor.getElementHandler elements.dimElem= 2 #Bars defined in a two dimensional space. elements.defaultMaterial= "elast" truss= elements.newElement("Truss",xc.ID([n1.tag,n2.tag])) truss.sectionArea= 1 vI= truss.getIVector3d(True) vJ= truss.getJVector3d(True) vK= truss.getKVector3d(True) # Orientation of the element's unary vectors. ratio= (vI-geom.Vector3d(0,1,0)).getModulus() ratio+= (vJ-geom.Vector3d(-1,0,0)).getModulus() ratio+= (vK-geom.Vector3d(0,0,1)).getModulus() #print 'vI= ', vI, ' vJ= ',vJ, ' vK= ',vK #print "ratio= ",ratio import os from misc_utils import log_messages as lmsg fname= os.path.basename(__file__) if abs(ratio)<1e-15: print("test ",fname,": ok.") else: lmsg.error(fname+' ERROR.')
preprocessor, "memb1", E, nu, dens, h) elements = preprocessor.getElementHandler elements.defaultMaterial = "memb1" elem = elements.newElement("ShellMITC4", xc.ID([1, 2, 3, 4])) c = elem.getCoordTransf.getVPosCentroide O = geom.Pos3d(c[0], c[1], c[2]) elem.computeBasis() On = elem.getNaturalCoordinates(O) p1n = elem.getNaturalCoordinates(p1) p2n = elem.getNaturalCoordinates(p2) p3n = elem.getNaturalCoordinates(p3) p4n = elem.getNaturalCoordinates(p4) vv = elem.getCoordTransf.getG3Vector + 0.02 * elem.getCoordTransf.getG2Vector p = O + 10.0 * geom.Vector3d(vv[0], vv[1], vv[2]) pp = elem.getCoordTransf.getProj(p) ppn = elem.getNaturalCoordinates(pp) ratio = 0.0 ratio1 = abs(On.r) ratio = max(ratio, ratio1) ratio2 = abs(On.s) ratio = max(ratio, ratio2) ratio3 = abs(p1n.r + 1.0) ratio = max(ratio, ratio3) ratio4 = abs(p1n.s + 1.0) ratio = max(ratio, ratio4) ratio5 = abs(p2n.r - 1.0) ratio = max(ratio, ratio5) ratio6 = abs(p2n.s + 1.0)
def getMidPlane(self): ''' Return the mid-plane of the base plate.''' return geom.Plane3d(self.origin, geom.Vector3d(1.0, 0.0, 0.0), geom.Vector3d(0.0, 1.0, 0.0))
def defineTablero(self): self.defineTramosTablero() surfaces = self.preprocessor.getMultiBlockTopology.getSurfaces # Alma central s = surfaces.newQuadSurfacePts(self.puntosB[12].tag, self.puntosI1[12].tag, self.puntosI1[4].tag, self.puntosB[4].tag) s.setElemSizeIJ(self.ladoElemento, self.ladoElemento) s.setProp("labels", ["ALM", "CEN", self.idTramo1]) self.carasAlmaCentral.append(s) s = surfaces.newQuadSurfacePts(self.puntosI1[12].tag, self.puntosI2[12].tag, self.puntosI2[4].tag, self.puntosI1[4].tag) s.setElemSizeIJ(self.ladoElemento, self.ladoElemento) s.setProp("labels", ["ALM", "CEN", self.idTramo2]) self.carasAlmaCentral.append(s) s = surfaces.newQuadSurfacePts(self.puntosI2[12].tag, self.puntosI3[12].tag, self.puntosI3[4].tag, self.puntosI2[4].tag) s.setElemSizeIJ(self.ladoElemento, self.ladoElemento) s.setProp("labels", ["ALM", "CEN", self.idTramo3]) self.carasAlmaCentral.append(s) s = surfaces.newQuadSurfacePts(self.puntosI3[12].tag, self.puntosI4[12].tag, self.puntosI4[4].tag, self.puntosI3[4].tag) s.setElemSizeIJ(self.ladoElemento, self.ladoElemento) s.setProp("labels", ["ALM", "CEN", self.idTramo4]) self.carasAlmaCentral.append(s) s = surfaces.newQuadSurfacePts(self.puntosI4[12].tag, self.puntosC[12].tag, self.puntosC[4].tag, self.puntosI4[4].tag) s.setElemSizeIJ(self.ladoElemento, self.ladoElemento) s.setProp("labels", ["ALM", "CEN", self.idTramo5]) self.carasAlmaCentral.append(s) # Diafragmas s = surfaces.newQuadSurfacePts(self.puntosB[1].tag, self.puntosB[2].tag, self.puntosB[10].tag, self.puntosB[9].tag) s.setElemSizeIJ(self.ladoElemento, self.ladoElemento) s.setProp("labels", ["DFG", "DRS"]) self.carasDiafragmaDorsal.append(s) s = surfaces.newQuadSurfacePts(self.puntosB[2].tag, self.puntosB[10].tag, self.puntosB[11].tag, self.puntosB[3].tag) s.setElemSizeIJ(self.ladoElemento, self.ladoElemento) s.setProp("labels", ["DFG", "DRS"]) self.carasDiafragmaDorsal.append(s) s = surfaces.newQuadSurfacePts(self.puntosB[3].tag, self.puntosB[11].tag, self.puntosB[12].tag, self.puntosB[4].tag) s.setElemSizeIJ(self.ladoElemento, self.ladoElemento) s.setProp("labels", ["DFG", "DRS"]) self.carasDiafragmaDorsal.append(s) s = surfaces.newQuadSurfacePts(self.puntosB[4].tag, self.puntosB[12].tag, self.puntosB[13].tag, self.puntosB[5].tag) s.setElemSizeIJ(self.ladoElemento, self.ladoElemento) s.setProp("labels", ["DFG", "DRS"]) self.carasDiafragmaDorsal.append(s) s = surfaces.newQuadSurfacePts(self.puntosB[5].tag, self.puntosB[13].tag, self.puntosB[14].tag, self.puntosB[6].tag) s.setElemSizeIJ(self.ladoElemento, self.ladoElemento) s.setProp("labels", ["DFG", "DRS"]) self.carasDiafragmaDorsal.append(s) s = surfaces.newQuadSurfacePts(self.puntosB[6].tag, self.puntosB[14].tag, self.puntosB[15].tag, self.puntosB[7].tag) s.setElemSizeIJ(self.ladoElemento, self.ladoElemento) s.setProp("labels", ["DFG", "DRS"]) self.carasDiafragmaDorsal.append(s) s = surfaces.newQuadSurfacePts(self.puntosC[1].tag, self.puntosC[2].tag, self.puntosC[10].tag, self.puntosC[9].tag) s.setElemSizeIJ(self.ladoElemento, self.ladoElemento) s.setProp("labels", ["DFG", "FRN"]) self.carasDiafragmaFrontal.append(s) s = surfaces.newQuadSurfacePts(self.puntosC[2].tag, self.puntosC[10].tag, self.puntosC[11].tag, self.puntosC[3].tag) s.setElemSizeIJ(self.ladoElemento, self.ladoElemento) s.setProp("labels", ["DFG", "FRN"]) self.carasDiafragmaFrontal.append(s) s = surfaces.newQuadSurfacePts(self.puntosC[3].tag, self.puntosC[11].tag, self.puntosC[12].tag, self.puntosC[4].tag) s.setElemSizeIJ(self.ladoElemento, self.ladoElemento) s.setProp("labels", ["DFG", "FRN"]) self.carasDiafragmaFrontal.append(s) s = surfaces.newQuadSurfacePts(self.puntosC[4].tag, self.puntosC[12].tag, self.puntosC[13].tag, self.puntosC[5].tag) s.setElemSizeIJ(self.ladoElemento, self.ladoElemento) s.setProp("labels", ["DFG", "FRN"]) self.carasDiafragmaFrontal.append(s) s = surfaces.newQuadSurfacePts(self.puntosC[5].tag, self.puntosC[13].tag, self.puntosC[14].tag, self.puntosC[6].tag) s.setElemSizeIJ(self.ladoElemento, self.ladoElemento) s.setProp("labels", ["DFG", "FRN"]) self.carasDiafragmaFrontal.append(s) s = surfaces.newQuadSurfacePts(self.puntosC[6].tag, self.puntosC[14].tag, self.puntosC[15].tag, self.puntosC[7].tag) s.setElemSizeIJ(self.ladoElemento, self.ladoElemento) s.setProp("labels", ["DFG", "FRN"]) self.carasDiafragmaFrontal.append(s) self.puntoApoyoDorsalDerecho = self.puntosB[10] self.puntoApoyoDorsalIzquierdo = self.puntosB[14] self.puntoApoyoFrontalDerecho = self.puntosC[10] self.puntoApoyoFrontalIzquierdo = self.puntosC[14] self.cooPuntoFijoFrontalIzquierdo = self.puntoApoyoFrontalIzquierdo.getPos + geom.Vector3d( 0, 0, 2) self.cooPuntoFijoFrontalDerecho = self.puntoApoyoFrontalDerecho.getPos + geom.Vector3d( 0, 0, 2) '''