What is the correct procedure for finding the number of sub-shapes of a shape. For example the number of edges defining a wire, or the number of wires trimming a surface.
Thanks in advance.
Simon
Stephane Routelous Wed, 08/30/2000 - 15:45
In the package TopExp, you will find methods you can use : MapShapes or MapShapesAndAncestors.
You can use an explorer object like TopExp_Explorer. Initialize it with the kind of sub-shape (TopAbs_EDGE for example) and then use a counter inside a loop.
Take care with TopExp_Explorer , the entities are not unique. For example , if you have 2 contiguous edges , with 1 vertex in common , topExp_Explorer will say that you have 4 vertices, and TopExp::MapShapes will say 3 vertices , because 1 is the same.
Pavel Durandin (not verified) Thu, 08/31/2000 - 09:37
Dear Simon,
If you want to find the number of sub-shapes on the first level (wires in face or edges in wire) you can use TopoDS_Iterator class which provide the better performance than TopExp_Explorer. If you need to obtain a number of unique sub-shapes, please use maps with TopoDS_Iterator. (for example TopTools_MapOfShape).
If you need to obtain all statistic on shape (the number of vertices, edges, etc...) please use ShapeAnalysisStd_ShapeContents class.
Wed, 08/30/2000 - 15:45
In the package TopExp, you will find methods you can use : MapShapes or MapShapesAndAncestors.
Stephane
Wed, 08/30/2000 - 15:48
You can use an explorer object like TopExp_Explorer. Initialize it with the kind of sub-shape (TopAbs_EDGE for example) and then use a counter inside a loop.
Regards.
Wed, 08/30/2000 - 16:23
Take care with TopExp_Explorer , the entities are not unique. For example , if you have 2 contiguous edges , with 1 vertex in common , topExp_Explorer will say that you have 4 vertices, and TopExp::MapShapes will say 3 vertices , because 1 is the same.
Stephane
Wed, 08/30/2000 - 17:20
Thank you for all your speedy replies.
Simon
Thu, 08/31/2000 - 09:37
Dear Simon,
If you want to find the number of sub-shapes on the first level (wires in face or edges in wire) you can use TopoDS_Iterator class which provide the better performance than TopExp_Explorer. If you need to obtain a number of unique sub-shapes, please use maps with TopoDS_Iterator. (for example TopTools_MapOfShape).
If you need to obtain all statistic on shape (the number of vertices, edges, etc...) please use ShapeAnalysisStd_ShapeContents class.
Best regards,
Pavel.