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 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
__author__ = "Luis C. Pérez Tato (LCPT)" __copyright__ = "Copyright 2014, LCPT" __license__ = "GPL" __version__ = "3.0" __email__ = "*****@*****.**" feProblem = xc.FEProblem() preprocessor = feProblem.getPreprocessor # Defining nodes points = preprocessor.getMultiBlockTopology.getPoints pt1 = points.newPntIDPos3d(1, geom.Pos3d(1.0, 0.0, 0.0)) pt2 = points.newPntIDPos3d(2, geom.Pos3d(0.0, 1.0, 0.0)) pt3 = points.newPntIDPos3d(3, geom.Pos3d(0.0, 0.0, 1.0)) plane = geom.Plane3d(pt1.getPos, pt2.getPos, pt3.getPos) trfs = preprocessor.getMultiBlockTopology.getGeometricTransformations reflex1 = trfs.newTransformation("reflection") reflex1.setPlane(plane) pt4 = points.newPntIDPos3d( 3, reflex1.getTrfPos(geom.Pos3d(2 / 3.0, 2 / 3.0, 2 / 3.0))) x4 = pt4.getPos.x y4 = pt4.getPos.y z4 = pt4.getPos.z #print("x4= ", x4) import os from misc_utils import log_messages as lmsg
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))
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.")
solver= soe.newSolver("band_gen_lin_lapack_solver") analysis= solu.newAnalysis("static_analysis","analysisAggregation","") def resuelveCombEstatLin(comb): tabComb= comb.tag nmbComb= comb.getName preprocessor.resetLoadCase() comb.addToDomain() analOk= analysis.analyze(1) comb.removeFromDomain() o= geom.Pos3d(2,1,0) p1= geom.Pos3d(2,2,0) p2= geom.Pos3d(2,1,1) plane= geom.Plane3d(o,p1,p2) def procesResultVerif(comb): tabComb= comb.tag nmbComb= comb.getName setTotal= preprocessor.getSets.getSet("total") resultant= setTotal.getResistingSlidingVectorsSystem3d(plane,o,0.01,0) global force force= resultant.getResultant() global moment moment= resultant.getMoment() org= resultant.getOrg nombrePrevia= "" tagPrevia= 0
#Intersection of plane with a line. #Exemple 1.2 of the thesis «La teoría de bloque aplicada a la dinámica #de rocas» de Juan Carlos Ayes Zamudio from __future__ import print_function import xc_base import geom import math A=2. B=3. C=1. D=4. ITeor=geom.Pos3d(3,-1,1) P=geom.Plane3d(geom.GeneralEquationOfPlane(2,3,1,-4)) pto=geom.Pos3d(1,1,-2) vDir=geom.Dir3d(2,-2,3) r=geom.Line3d(pto,vDir) dr=ITeor.distLine3d(r) I=P.getIntersLine3d(r) d=I.distPlane(P) ratio1=ITeor.distPos3d(I) ratio2=math.fabs(dr) ratio3=math.fabs(d) import os fname= os.path.basename(__file__) if math.fabs(ratio1)<1e-4 and math.fabs(ratio2)<1e-4 and math.fabs(ratio3)<1e-4:
from __future__ import print_function import xc_base import geom p0 = geom.Pos3d(0.000331586, 0, 0) # p1=geom.Pos3d(0.000331586,100,0) # p2=geom.Pos3d(-0.301719,0,100) p1 = geom.Pos3d(0.000331586, 1, 0) p2 = geom.Pos3d(-0.00268892, 0, 1) pA = geom.Pos3d(0.0, 1, 0.109779) pB = geom.Pos3d(0.0, 0, 0.109779) plane = geom.Plane3d(p0, p1, p2) normal = plane.getNormal() YZplane = geom.Plane3d(geom.Pos3d(0, 0, 0), geom.Pos3d(0, 1, 0), geom.Pos3d(0, 0, 1)) angle = plane.getPlaneAngle(YZplane) yzTrace = plane.getYZTrace() dA = yzTrace.dist(pA) dB = yzTrace.dist(pB) ''' print('normal: ', normal*(1.0/1e4)) print('angle= ', angle) print('trace= ', yzTrace) print('dA= ', dA) print('dB= ', dB) ''' import os fname = os.path.basename(__file__) if (dA < 1e-6 and dB < 1e-6):