SubShape function = random
SubShape function = randomPosted by Gilles Vogt at April 10. 2013
I found that the subshape function appears to be random (I'm using Salome 6.6 univ. binary for linux).
As an attached file, I provided an example of this behavior (to run it, please adapt the "PATH" variable according to the location on your HDD where you untar-ed it). If you run it twice or more, the Face_i objects within Geometry/Modele will differ.
Am I doing anything wrong ?
The problem is that complex operations like Partition do not provide the same order of sub-shapes within the result shape. Hence, using indexes to get a certain sub-shape is not recommended. One can use geompy.SubShapeAllSortedCentres() or geompy. SubShapeSortedCentres(), geompy. ExtractShapes(..., isSorted=True) to get sub-shapes in a stable order. Another way is to use functions based on geometrical checks like geompy.GetFaceNearPoint() etc.
Re: SubShape function = randomPosted by Gilles Vogt at April 10. 2013
Actually, I'm using extractshapes instead, but subshape is the function that is dumped by salome in python after exploding a complex shape manually (gui). In my case, it allows me to select only a few surfaces, or explode complex geometries (>1000 volumes) as a sorted-(human-friendly) list (which appears to be hardly possible without the selection in the gui).
So you are saying that the partition tool randomizes the order of subshapes ? I find it very detrimental for salome (I couldn't imagine that running two times the same program with the same inputs could lead to different results; in other codes it is just called a bug).
Anyway, I wanted to share this bug/behavior in case you were ignoring it, thanks for your answer.
People say it's a bug.
I even think that Python dump of "Explode" with selected sub-shape could also be done using some function using sorted sub-shape.
Anyway the bug fix and the improvement of dump of Explode are a matter of the future. The nearest release won't include them.