← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3753: gts shift and scale apparently only take three float values, hence changed

 

------------------------------------------------------------
revno: 3753
committer: Klaus Thoeni <klaus.thoeni@xxxxxxxxx>
timestamp: Wed 2015-12-09 11:21:24 +1100
message:
  gts shift and scale apparently only take three float values, hence changed
modified:
  py/ymport.py


--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'py/ymport.py'
--- py/ymport.py	2015-04-24 15:54:07 +0000
+++ py/ymport.py	2015-12-09 00:21:24 +0000
@@ -7,6 +7,7 @@
 
 from minieigen import *
 
+
 def textExt(fileName,format='x_y_z_r',shift=Vector3.Zero,scale=1.0,**kw):
 	"""Load sphere coordinates from file in specific format, returns a list of corresponding bodies; that may be inserted to the simulation with O.bodies.append().
 	
@@ -44,7 +45,8 @@
 		else:
 			raise RuntimeError("Please, specify a correct format output!");
 	return ret
-  
+
+
 def textClumps(fileName,shift=Vector3.Zero,discretization=0,orientation=Quaternion((0,1,0),0.0),scale=1.0,**kw):
 	"""Load clumps-members from file, insert them to the simulation.
 	
@@ -87,6 +89,7 @@
 		O.bodies[ret[i][0]].mask = O.bodies[ret[i][1][0]].mask
 	return ret
 
+
 def text(fileName,shift=Vector3.Zero,scale=1.0,**kw):
 	"""Load sphere coordinates from file, returns a list of corresponding bodies; that may be inserted to the simulation with O.bodies.append().
 
@@ -100,7 +103,8 @@
 	"""
 	
 	return textExt(fileName=fileName,format='x_y_z_r',shift=shift,scale=scale,**kw)
-	
+
+
 def stl(file, dynamic=None,fixed=True,wire=True,color=None,highlight=False,noBound=False,material=-1):
 	""" Import geometry from stl file, return list of created facets."""
 	imp = STLImporter()
@@ -114,7 +118,8 @@
 		b.aspherical=False
 	return facets
 
-def gts(meshfile,shift=(0,0,0),scale=1.0,**kw):
+
+def gts(meshfile,shift=Vector3.Zero,scale=1.0,**kw):
 	""" Read given meshfile in gts format.
 
 	:Parameters:
@@ -130,12 +135,13 @@
 	"""
 	import gts,yade.pack
 	surf=gts.read(open(meshfile))
-	surf.scale(scale)
-	surf.translate(shift) 
+	surf.scale(scale,scale,scale)
+	surf.translate(shift[0],shift[1],shift[2]) 
 	yade.pack.gtsSurface2Facets(surf,**kw)
 
+
 def gmsh(meshfile="file.mesh",shift=Vector3.Zero,scale=1.0,orientation=Quaternion((0,1,0),0.0),**kw):
-	""" Imports geometry from mesh file and creates facets.
+	""" Imports geometry from .mesh file and creates facets.
 
 	:Parameters:
 		`shift`: [float,float,float]
@@ -148,8 +154,8 @@
 				is passed to :yref:`yade.utils.facet`
 	:Returns: list of facets forming the specimen.
 	
-	mesh files can be easily created with `GMSH <http://www.geuz.org/gmsh/>`_.
-	Example added to :ysrc:`examples/regular-sphere-pack/regular-sphere-pack.py`
+	mesh files can easily be created with `GMSH <http://www.geuz.org/gmsh/>`_.
+	Example added to :ysrc:`examples/packs/packs.py`
 	
 	Additional examples of mesh-files can be downloaded from 
 	http://www-roc.inria.fr/gamma/download/download.php
@@ -174,7 +180,6 @@
 		data = line.split()
 		nodelistVector3[id] = orientation*Vector3(float(data[0])*scale,float(data[1])*scale,float(data[2])*scale)+shift
 		id += 1
-
 	
 	findTriangleString=findVerticesString+numNodes
 	while (lines[findTriangleString].split()[0]<>'Triangles'): #Find the string with the number of Triangles
@@ -205,6 +210,7 @@
 		ret.append(utils.facet((nodelistVector3[i[1]],nodelistVector3[i[2]],nodelistVector3[i[3]]),**kw))
 	return ret
 
+
 def gengeoFile(fileName="file.geo",shift=Vector3.Zero,scale=1.0,orientation=Quaternion((0,1,0),0.0),**kw):
 	""" Imports geometry from LSMGenGeo .geo file and creates spheres. 
 	Since 2012 the package is available in Debian/Ubuntu and known as python-demgengeo
@@ -246,6 +252,7 @@
 		ret.append(utils.sphere(shift+scale*pos,scale*float(data[3]),**kw))
 	return ret
 
+
 def gengeo(mntable,shift=Vector3.Zero,scale=1.0,**kw):
 	""" Imports geometry from LSMGenGeo library and creates spheres.
 	Since 2012 the package is available in Debian/Ubuntu and known as python-demgengeo
@@ -283,7 +290,6 @@
 	return ret
 
 
-
 def unv(fileName,shift=(0,0,0),scale=1.0,returnConnectivityTable=False,**kw):
 	""" Import geometry from unv file, return list of created facets.
 
@@ -394,6 +400,7 @@
 		return facets, nodes, elems
 	return facets
 
+
 def ele(nodeFileName,eleFileName,shift=(0,0,0),scale=1.0,**kw):
 	""" Import tetrahedral mesh from .ele file, return list of created tetrahedrons.