yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #02593
[Branch ~yade-dev/yade/trunk] Rev 1877: Some syntax fixes: moveTo has been renamed to shift in utils.py and ymport.py
------------------------------------------------------------
revno: 1877
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2009-12-09 16:38:28 +0100
message:
Some syntax fixes: moveTo has been renamed to shift in utils.py and ymport.py
modified:
py/utils.py
py/ymport.py
scripts/test/regular-sphere-pack.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/utils.py'
--- py/utils.py 2009-12-09 09:52:15 +0000
+++ py/utils.py 2009-12-09 15:38:28 +0000
@@ -191,7 +191,7 @@
elif (extents[2]==0):
wallMask=16
if (((extents[0]==0) and (extents[1]==0)) or ((extents[0]==0) and (extents[2]==0)) or ((extents[1]==0) and (extents[2]==0))):
- raise TypeError("Please, specify at least 2 none-zero dimensions in extents!");
+ raise RuntimeError("Please, specify at least 2 none-zero dimensions in extents!");
mn,mx=[-extents[i] for i in 0,1,2],[extents[i] for i in 0,1,2]
def doWall(a,b,c,d):
=== modified file 'py/ymport.py'
--- py/ymport.py 2009-12-09 13:48:23 +0000
+++ py/ymport.py 2009-12-09 15:38:28 +0000
@@ -44,9 +44,9 @@
utils._commonBodySetup(b,0,Vector3(0,0,0),noBound=noBound,material=material,resetState=False)
return imported
-def gmsh(meshfile="file.mesh",moveTo=[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,**kw):
""" Imports geometry from mesh file and creates facets.
- moveTo[X,Y,Z] parameter moves the specimen.
+ shift[X,Y,Z] parameter moves the specimen.
scale factor scales the given data.
Remaining **kw arguments are passed to utils.facet;
@@ -63,9 +63,9 @@
id = 0
for line in lines[5:numNodes+5]:
data = line.split()
- X = moveTo[0]+float(data[0])*scale
- Y = moveTo[1]+float(data[1])*scale
- Z = moveTo[2]+float(data[2])*scale
+ 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)
id += 1
numTriangles = int(lines[numNodes+6].split()[0])
@@ -92,9 +92,9 @@
ret.append(utils.facet((nodelistVector3[i[1]],nodelistVector3[i[2]],nodelistVector3[i[3]]),**kw))
return ret
-def gengeoFile(fileName="file.geo",moveTo=[0.0,0.0,0.0],scale=1.0,**kw):
+def gengeoFile(fileName="file.geo",shift=[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.
+ shift[X,Y,Z] parameter moves the specimen.
scale factor scales the given data.
Remaining **kw arguments are passed to utils.sphere;
@@ -117,12 +117,12 @@
ret=[]
for line in lines[7:numSpheres+7]:
data = line.split()
- ret.append(utils.sphere([moveTo[0]+scale*float(data[0]),moveTo[1]+scale*float(data[1]),moveTo[2]+scale*float(data[2])],scale*float(data[3]),**kw))
+ ret.append(utils.sphere([shift[0]+scale*float(data[0]),shift[1]+scale*float(data[1]),shift[2]+scale*float(data[2])],scale*float(data[3]),**kw))
return ret
-def gengeo(mntable,moveTo=[0.0,0.0,0.0],scale=1.0,**kw):
+def gengeo(mntable,shift=[0.0,0.0,0.0],scale=1.0,**kw):
""" Imports geometry from LSMGenGeo library and creates spheres.
- moveTo[X,Y,Z] parameter moves the specimen.
+ shift[X,Y,Z] parameter moves the specimen.
Remaining **kw arguments are passed to utils.sphere;
LSMGenGeo library allows to create pack of spheres
@@ -141,5 +141,5 @@
for i in range(0, len(sphereList)):
r=sphereList[i].Radius()
c=sphereList[i].Centre()
- ret.append(utils.sphere([moveTo[0]+scale*float(c.X()),moveTo[1]+scale*float(c.Y()),moveTo[2]+scale*float(c.Z())],scale*float(r),**kw))
+ ret.append(utils.sphere([shift[0]+scale*float(c.X()),shift[1]+scale*float(c.Y()),shift[2]+scale*float(c.Z())],scale*float(r),**kw))
return ret
=== modified file 'scripts/test/regular-sphere-pack.py'
--- scripts/test/regular-sphere-pack.py 2009-12-09 09:52:15 +0000
+++ scripts/test/regular-sphere-pack.py 2009-12-09 15:38:28 +0000
@@ -60,7 +60,7 @@
O.bodies.append(ymport.gmsh('regular-sphere-pack.mesh',**kwMeshes))#generates facets from the mesh file
"""Import regular-sphere-pack-LSMGenGeo.geo into the YADE simulation"""
-O.bodies.append(ymport.gengeoFile('regular-sphere-pack-LSMGenGeo.geo',moveTo=[-7.0,-7.0,-5.9],scale=1.0,color=(1,0,1),**kw))
+O.bodies.append(ymport.gengeoFile('regular-sphere-pack-LSMGenGeo.geo',shift=[-7.0,-7.0,-5.9],scale=1.0,color=(1,0,1),**kw))
try: