Best Practices

Open CASCADE is a very mature and aged library containing 20 year old code in some spots (just have a look at the dates in the source code). There are

  • a lot of duplicated tools and interfaces and normally no hint in the reference docs, which one should be used primarily.
  • a magnitude of ways of doing specific tasks. For beginners it's often very hard to recognize which one is most elegant/brief preventing one from running into problems later.

This article tries to collect information about "how to do things well" in Open CASCADE. Please feel free to post your questions concerning best practices here or in the forum.

Conversion of 2d and 3d curves

(There are routines to convert 2d to 3d curves and vice versa in the following packages:

GeomLib

Handle_Geom_Curve   To3d (const gp_Ax2 &Position, const Handle(Geom2d_Curve)&Curve2d)
void   BuildCurve3d (const Standard_Real Tolerance, Adaptor3d_CurveOnSurface &CurvePtr, ...)

GeomAPI

Handle_Geom2d_Curve   To2d (const Handle(Geom_Curve)&C, const gp_Pln &P)
Handle_Geom_Curve   To3d (const Handle(Geom2d_Curve)&C, const gp_Pln &P)