← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 1815: Fix bug with import facets from stl

 

------------------------------------------------------------
revno: 1815
committer: Sergei D. <sega@think>
branch nick: trunk
timestamp: Thu 2009-11-26 18:57:19 +0300
message:
  Fix bug with import facets from stl
modified:
  py/utils.py
  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/utils.py'
--- py/utils.py	2009-11-24 19:12:10 +0000
+++ py/utils.py	2009-11-26 15:57:19 +0000
@@ -74,7 +74,7 @@
 def defaultMaterial():
 	return GranularMat(density=1e3,young=1e7,poisson=.3,frictionAngle=.5,label='defaultMat')
 
-def _commonBodySetup(b,volume,geomInertia,material,noBound=False):
+def _commonBodySetup(b,volume,geomInertia,material,noBound=False,resetState=True):
 	"""Assign common body parameters."""
 	#if 'physParamsClass' in matKw.keys(): raise ArgumentError("You as passing physParamsClass as argument, but it is no longer used. Use material instead.")
 	#if 'materialClass' in matKw.keys(): raise ArgumentError("You as passing materialClass as argument, but it is no longer used. Use material instead.")
@@ -84,7 +84,7 @@
 	elif isinstance(material,Material): b.mat=material
 	else: raise TypeError("The 'material' argument must be None (for defaultMaterial), string (for shared material label), int (for shared material id) or Material instance.");
 	## resets state (!!)
-	b.state=b.mat.newAssocState()
+	if resetState: b.state=b.mat.newAssocState()
 	mass=volume*b.mat['density']
 	b.state['mass'],b.state['inertia']=mass,geomInertia*b.mat['density']
 	if not noBound: b.bound=BoundingVolume('AABB',diffuseColor=[0,1,0])

=== modified file 'py/ymport.py'
--- py/ymport.py	2009-11-25 14:26:00 +0000
+++ py/ymport.py	2009-11-26 15:57:19 +0000
@@ -41,7 +41,7 @@
 		b.mold['diffuseColor']=color if color else utils.randomColor()
 		b.mold['wire']=wire
 		b.mold['highlight']=highlight
-		utils._commonBodySetup(b,0,Vector3(0,0,0),noBound=noBoundingVolume,material=material)
+		utils._commonBodySetup(b,0,Vector3(0,0,0),noBound=noBoundingVolume,material=material,resetState=False)
 	return imported
 
 def gmsh(meshfile="file.mesh",**kw):


Follow ups