yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #04203
[Branch ~yade-dev/yade/trunk] Rev 2186: Orientation parameter is added for ymport.gmsh() function
------------------------------------------------------------
revno: 2186
committer: Anton Gladkyy <gladk@IAM004>
branch nick: trunk
timestamp: Fri 2010-04-30 15:43:49 +0200
message:
Orientation parameter is added for ymport.gmsh() function
modified:
py/ymport.py
--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk
Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'py/ymport.py'
--- py/ymport.py 2010-04-16 14:38:44 +0000
+++ py/ymport.py 2010-04-30 13:43:49 +0000
@@ -44,10 +44,11 @@
surf.translate(shift)
yade.pack.gtsSurface2Facets(surf,**kw)
-def gmsh(meshfile="file.mesh",shift=[0.0,0.0,0.0],scale=1.0,**kw):
+def gmsh(meshfile="file.mesh",shift=[0.0,0.0,0.0],scale=1.0,orientation=Quaternion().IDENTITY,**kw):
""" Imports geometry from mesh file and creates facets.
shift[X,Y,Z] parameter moves the specimen.
scale factor scales the given data.
+ orientation quaternion: orientation of the imported mesh
Remaining **kw arguments are passed to utils.facet;
mesh files can be easily created with `GMSH <http://www.geuz.org/gmsh/>`_.
@@ -72,12 +73,13 @@
nodelistVector3.append(Vector3(0.0,0.0,0.0))
id = 0
+ qTemp = Quaternion(Vector3(orientation[0],orientation[1],orientation[2]),orientation[3])
for line in lines[findVerticesString+1:numNodes+findVerticesString+1]:
data = line.split()
- X = shift[0]+float(data[0])*scale
- Y = shift[1]+float(data[1])*scale
- Z = shift[2]+float(data[2])*scale
- nodelistVector3[id] = Vector3(X,Y,Z)
+ tempNodeVector=Vector3(float(data[0])*scale,float(data[1])*scale,float(data[2])*scale)
+ tempNodeVector=qTemp.Rotate(tempNodeVector)
+ tempNodeVector+=Vector3(shift[0],shift[1],shift[2])
+ nodelistVector3[id] = tempNodeVector
id += 1
numTriangles = int(lines[numNodes+findVerticesString+2].split()[0])
triList = []