Reading a step file (a compound) and uniting any sub-shapes

Hi,

I am having some issues with union of sub-shapes in a STEP file. I am reading an existing STEP file which has 6 sub-shapes into OCE using the STEPControl_Reader and then iterating over all of its sub-shapes using TopExp_Explorer with type TopAbs_SOLID. As I iterate over them, I unite them one by one to next shape in iteration to get a full union. 

My questions are -

1. When I am uniting each sub-shape to the next shape until are united together, I get some extra material (like a thick solid plate) under my part as a part of the union. I could not see this extra material when I open the source STEP in FreeCAD. Is that an OCE bug then?

2. What is the best way to do the union I have described above ?  I am using BRepAlgoAPI_Fuse along with ShapeUpgrade_UnifySameDomain  after each union, to clean the shape. Also, is there a way to check if the union is a valid union or not?

3. If it is the source STEP file that is problematic leading to incorrect or problematic union in OCE, is there a way to check/analyze that and report the error in a console output?

Kirill Gavrilov's picture

As I iterate over them, I unite them one by one to next shape in iteration to get a full union. 

Just noticing - applying Boolean operation iteratively might be error-prone. It is always better applying Boolean operation once, when possible (e.g. collect arguments onces and then perform a single Boolean operation).

is there a way to check/analyze that and report the error in a console output?

You may try Draw Harness commands checkshape and bopcheck (the latter one is specifically designed to report shape issues that might cause problems within Boolean operations) to see if they report any issues with your STEP models.