Shape detection in STEP import?


I import STEP-files with the help of OCC and it's STEPCAFControl_Reader. I retrieve the geometry as OCAF document and I can access the resulting TopoDS_Shape.
What I am looking for is a way to detect the type of shape that was imported from STEP. E.g. a sphere, defined in a STEP file shall be recognized as a sphere after the import - therefore I need to find out the centre and the diameter of this sphere.
So can anyone give me a hint how to detect shape types and shape parameters during/after a STEP import?

Thanks a lot in advance!

Thomas Paviot's picture


It's impossible to detect the "shape type" from a STEP import, the "shape" being understood as a TopoDS_Shape. However it's possible for a TopoDS_Face (a few posts on this forum deal with that). So I would suggest to:
- create a TopExp_Explorer instance on the TopoDS_Shape obtained from the STEP file import,
- loop over the shape to get all faces,
- check the type of the TopoDS_Face (plane? cylindrical? etc.),
- according to the result, downcast the face to the right class (Geom_Plane, etc.),
- then convert the last result to a gp_Plane, gp_Sphere etc. to get its properties (radius, center).


mz's picture

Thank you for your answer, Thomas.

My hope was the directory "StepGeom" which contains dozens of shape-type related files like StepGeom_Conic.cxx, StepGeom_Ellipse.cxx and so on. What are these files good for, then?