Handle_XCAFDoc_ShapeTool appears to rotate shapes

My understanding of the Handle_XCAFDoc_ShapeTool class is that it contains the entire STEP file in .Value(1), and individual components afterwards. For example, this code:

Handle_XCAFDoc_ShapeTool step_shape_contents = XCAFDoc_DocumentTool::ShapeTool(step_doc->Main());
TDF_LabelSequence step_shapes;
step_shape_contents->GetShapes(step_shapes);
occgeo->shape = step_shape_contents->GetShape(step_shapes.Value(1));

where occgeo is an internally defined class that contains a TopoDS_Shape object called shape, would return the tool geometry in the STEP file, which it does correctly. However, when I try instead to read each solid individually, by changing the above code to:

Handle_XCAFDoc_ShapeTool step_shape_contents = XCAFDoc_DocumentTool::ShapeTool(step_doc->Main());
TDF_LabelSequence step_shapes;
step_shape_contents->GetShapes(step_shapes);
occgeo->shape = step_shape_contents->GetShape(step_shapes.Value(solid_num + 1));

and looping over solid_num, somehow all of my geometries return with the values for the x- and z-coordinates flipped. Why is this the case? Alternatively, how can I reflect my geometry along the x = z plane so that the correct geometry is returned?

rkappiyo's picture

Never mind. Issue found: somewhere upstream, before my code was called, someone used the BRepBuilderAPI_Transform class instead of the BRepBuilderAPI_GTransform class, which meant that the transformation was applied to the entire assembly, but not the individual solids.