def rot_Z(toSet, angle): '''Apply a rotation around global Z axis to all the entities in the set :param toSet: set of entities :param angle: rotation angle (degrees) ''' zAxis = geom.Line3d(geom.Pos3d(0.0, 0.0, 0.0), geom.Pos3d(0.0, 0.0, 100.0)) rot = xc.Rotation(geom.Rotation3d(zAxis, math.radians(angle))) toSet.transforms(rot)
from __future__ import print_function import xc_base import geom import xc import math __author__ = "Luis C. Pérez Tato (LCPT)" __copyright__ = "Copyright 2020, LCPT" __license__ = "GPL" __version__ = "3.0" __email__ = "*****@*****.**" pOld = geom.Pos3d(4.0, 4.0, 4.0) zAxis = geom.Line3d(geom.Pos3d(0.0, 0.0, 0.0), geom.Pos3d(0.0, 0.0, 100.0)) rot = xc.Rotation(geom.Rotation3d(zAxis, math.pi)) pNew = rot.getTrfPos(pOld) ratio1 = math.sqrt((pNew.x + pOld.x)**2 + (pNew.y + pOld.y)**2 + (pNew.z - pOld.z)**2) #print(pOld, pNew, ratio1) import os fname = os.path.basename(__file__) if (ratio1 < 1e-15): print("test ", fname, ": ok.") else: print("test ", fname, ": ERROR.")
__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, 0.0, 0.0)) axis= geom.Line3d(pt1.getPos,pt2.getPos) ang= math.pi/2.0 rot1= xc.Rotation(geom.Rotation3d(axis,ang)) pt3= points.newPntIDPos3d(3, rot1.getTrfPos(geom.Pos3d(0.0, 0.0, 1.0))) pt4= points.newPntIDPos3d(4, geom.Pos3d(0.0, 1.0, 0.0)) dist34= mi.distance_2points(preprocessor, 3,4) # print("dist(3,4)= ",dist34) import os from misc_utils import log_messages as lmsg fname= os.path.basename(__file__) if (dist34<1e-12):