Personal tools
You are here: Home Forum Use Keeping the subshape property of selected subshapes

Keeping the subshape property of selected subshapes

Up to Use

Keeping the subshape property of selected subshapes

Posted by Malleus at March 22. 2019

Hello,

I am having troubles with the selection of solid subshapes from solid shapes and keeping the subshape property:

I am creating a main shape called vol_main from solid primitives via a series of fuse and partition operations. The steps leading up to the last but one step involve the creation of

    an extruded volume: ext, and
    four planes: plane_1, ..., plane_4 .
   
The last step is another partition, involving all objects mentioned so far:

    vol_main = geompy.MakePartition([vol_main, ext, plane_1, plane_2, plane_3, plane_4], [], [], [], geompy.ShapeType["SOLID"], 0, [], 0) .
   
This defines the volume vol_main from which I wish to select a (solid) subset vol_sub. The selection is made according to

    vol_sub_list = geompy.GetShapesOnCylinderWithLocation( vol_main, geompy.ShapeType["SOLID"], OZ, O, radius, GEOM.ST_ONOUT )
    vol_sub = geompy.MakeCompound(vol_sub_list) ,
   
where vol_sub usually contains more than one solid. The selection works fine and well insofar as the resulting shape looks correct.
But what I am missing is the subshape property of vol_sub: Namely, when I issue

    geompy.IsSubShapeBelongsTo(vol_sub, vol_main) ,
   
I would expect, from the definition of vol_sub, the answer to be 'True'. But what I get is 'False'. What am I doing wrong?

The background to the question is that I need the resulting compound vol_sub to be a subshape of vol_main so as to be able to later on create a submesh on it. Then, vol_main will carry the main mesh, and vol_sub a 3d submesh. How can I get this to work?

Many thanks for your answer.
Best regards

Re: Keeping the subshape property of selected subshapes

Posted by Saint Michael at March 22. 2019

Hi

geompy.IsSubShapeBelongsTo(vol_sub, vol_main) returns False since your created a standalone compound from the vol_sub_list. Each element of the compound is sub-shape of vol_main and the compound of them is not.

But don't bother, you can use vol_sub to create a sub-mesh on it. It will work.

St.Michael

 

Re: Keeping the subshape property of selected subshapes

Posted by Malleus at March 23. 2019

Hello,

 

thank you very much for you quick reply. Indeed it is possible, as you said, to create a submesh on vol_sub.

 

But now I am facing the next problem: Suppose I wish to create the submesh not on vol_sub, but on its complement vol_comp with respect to vol_main:

 

    vol_comp = geompy.MakeCutList(vol_main, [vol_sub], True)

    geompy.addToStudyInFather(vol_main, vol_comp, 'vol_comp')

   

To this end, I create an empty 3d mesh Mesh_1 on vol_main. Then I try to define a 3d submesh of Mesh_1 on vol_comp; and this produces an error

 

    Geometry object is not a sub-shape of the shape to mesh .

   

How can I resolve this situation.

 

Again, thank you very much for your answer.

 

Re: Keeping the subshape property of selected subshapes

Posted by Saint Michael at March 25. 2019

Hi

Here the problem is the same, MakeCutList() creates an independent geom object. Solution is to use a Group like follows:

vol_comp = geompy.CreateGroup( vol_main, geompy.ShapeType["SOLID"], "vol_comp" )

geompy.UnionIDs( vol_comp, geompy.SubShapeAllIDs( vol_main, geompy.ShapeType["SOLID"] ))

geompy.DifferenceList( vol_comp, vol_sub_list )

After that you can create a sub-mesh on vol_comp.

St.Michael

Re: Keeping the subshape property of selected subshapes

Posted by Malleus at March 25. 2019

Again, thank you very much!

Powered by Ploneboard
Document Actions