yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #07144
[Branch ~yade-dev/yade/trunk] Rev 2757: 1. Fixed some docs
------------------------------------------------------------
revno: 2757
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: yade
timestamp: Wed 2011-02-23 11:28:42 +0100
message:
1. Fixed some docs
2. shop.spheresPackDimensions can accept now a list of bodies, not only the list of their id's
modified:
py/pack/pack.py
py/shop.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/pack/pack.py'
--- py/pack/pack.py 2011-02-16 05:40:01 +0000
+++ py/pack/pack.py 2011-02-23 10:28:42 +0000
@@ -6,13 +6,13 @@
For examples, see
-* :ysrc:`scripts/test/gts-horse.py`
* :ysrc:`scripts/test/gts-operators.py`
* :ysrc:`scripts/test/gts-random-pack-obb.py`
* :ysrc:`scripts/test/gts-random-pack.py`
* :ysrc:`scripts/test/pack-cloud.py`
* :ysrc:`scripts/test/pack-predicates.py`
-* :ysrc:`examples/regular-sphere-pack/regular-sphere-pack.py`
+* :ysrc:`examples/packs/packs.py`
+* :ysrc:`examples/gts-horse/gts-horse.py`
* :ysrc:`examples/WireMatPM/wirepackings.py`
"""
=== modified file 'py/shop.py'
--- py/shop.py 2011-02-17 11:32:00 +0000
+++ py/shop.py 2011-02-23 10:28:42 +0000
@@ -10,7 +10,7 @@
#spheresPackDimensions==================================================
def spheresPackDimensions(idSpheres):
- """The function accepts the list of spheres idSpheres, and calculates max and min dimensions.
+ """The function accepts the list of spheres id's or list of bodies, and calculates max and min dimensions.
:param list idSpheres: list of spheres
@@ -34,9 +34,16 @@
for i in idSpheres:
- spherePosition=O.bodies[i].state.pos
- try:
- sphereRadius=O.bodies[i].shape.radius #skip non-spheres
+
+ try:
+ b = O.bodies[i] #We have received a list of ID's
+ except TypeError:
+ b = i #We have recevied a list of bodies
+
+ spherePosition=b.state.pos
+
+ try:
+ sphereRadius=b.shape.radius #skip non-spheres
except AttributeError: continue
sphereRadiusVec3 = Vector3(sphereRadius,sphereRadius,sphereRadius)
@@ -47,10 +54,10 @@
for dim in range(0,3):
if ((sphereMax[dim]>max[dim]) or (counter==0)):
max[dim]=sphereMax[dim]
- maxId[dim] = i
+ maxId[dim] = b.id
if ((sphereMin[dim]<min[dim]) or (counter==0)):
min[dim]=sphereMin[dim]
- minId[dim] = i
+ minId[dim] = b.id
counter += 1
center = (max-min)/2.0+min