← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 1875: 1. Added moveTo und scale parameters for ymport.gmsh function

 

------------------------------------------------------------
revno: 1875
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2009-12-09 14:48:23 +0100
message:
  1. Added moveTo und scale parameters 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	2009-12-04 23:27:26 +0000
+++ py/ymport.py	2009-12-09 13:48:23 +0000
@@ -44,8 +44,11 @@
 		utils._commonBodySetup(b,0,Vector3(0,0,0),noBound=noBound,material=material,resetState=False)
 	return imported
 
-def gmsh(meshfile="file.mesh",**kw):
+def gmsh(meshfile="file.mesh",moveTo=[0.0,0.0,0.0],scale=1.0,**kw):
 	""" Imports geometry from mesh file and creates facets.
+	moveTo[X,Y,Z] parameter moves the specimen.
+	scale factor scales the given data.
+	
 	Remaining **kw arguments are passed to utils.facet; 
 	mesh files can be easily created with GMSH http://www.geuz.org/gmsh/
 	Example added to scripts/test/regular-sphere-pack.py"""
@@ -60,9 +63,9 @@
 	id = 0
 	for line in lines[5:numNodes+5]:
 		data = line.split()
-		X = float(data[0])
-		Y = float(data[1])
-		Z = float(data[2])
+		X = moveTo[0]+float(data[0])*scale
+		Y = moveTo[1]+float(data[1])*scale
+		Z = moveTo[2]+float(data[2])*scale
 		nodelistVector3[id] = Vector3(X,Y,Z)
 		id += 1
 	numTriangles = int(lines[numNodes+6].split()[0])
@@ -92,6 +95,7 @@
 def gengeoFile(fileName="file.geo",moveTo=[0.0,0.0,0.0],scale=1.0,**kw):
 	""" Imports geometry from LSMGenGeo .geo file and creates spheres.
 	moveTo[X,Y,Z] parameter moves the specimen.
+	scale factor scales the given data.
 	Remaining **kw arguments are passed to utils.sphere; 
 	
 	LSMGenGeo library allows to create pack of spheres