Under what circumstances the STEPControl_Writer.Transfer() will fail or success ?


CAD community veteran
I have some confusion with STEPControl_Writer.Transfer():
What conditions should the TopoDS_Shape to meet can transfer succeed?

I meet two situations:
1) I create a bottle follow the tutorial, it transfer succeed and can output as a step file right.

2)when I get a face from step file, I want to output the TopoDS_Shape of this face as a step file, and transfer fail.

So, I'm confusing why the Transfer() fail in situation 2; should I rebuild topology like "point->edge->wire->face" for the face I get from a exit 3d model ?


Staff member
Hypothetically, failure might happen for somewhat broken geometry. It should normally work for consistent geometry, even if it's just a single face. You may want to try to repeat your experiment in Draw console and check the shape you're about to export with checkshape command. Also, make sure that the shape you're passing to the writer is not empty. Note that it should be real geometry, not facets (e.g., it's hopeless to export to STEP something you loaded from an STL file, for example).

As a general advice, build OpenCascade in debug mode and invest a bit of time to step inside its functions. Just let yourself benefit from the fact that the library is open-sourced. Quite often it's easy to figure out which contract check inside the translator (or any other algorithm) failed. Learning OpenCascade without some deep investigations and messing around with its sources is less efficient.


CAD community veteran
@Quaoar Thanks for your advice sincerely. Yes, deep investigations is the best way to learn OCCT , I try to learn some basic theory too. However, there are always some other works boring me, make me always wandering outside the door of CAD.o_Oo_O