2

As an OpenCASCADE newbie, I am reading the OpenCASCADE tutorial:

https://www.opencascade.com/doc/occt-7.4.0/overview/html/occt__tutorial.html

There are following two curious calls:

BRepLib::BuildCurves3d(threadingWire1);
BRepLib::BuildCurves3d(threadingWire2);

The tutorial explains the need for these two calls in this way:

Remember that these wires were built out of a surface and 2D curves. One important data item is missing as far as these wires are concerned: there is no information on the 3D curves. Fortunately, you do not need to compute this yourself, which can be a difficult task since the mathematics can be quite complex. When a shape contains all the necessary information except 3D curves, Open CASCADE Technology provides a tool to build them automatically. In the BRepLib tool package, you can use the BuildCurves3d method to compute 3D curves for all the edges of a shape.

which I did not find entirely clear.

Imagine that I have constructed some TopoDS_Shape object.

How can I, in general, figure out whether BRepLib::BuildCurves3d call is necessary or not?

Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

0

With this code you can get the 3D curve of an edge (take from BRepExtrema_DistanceSS.cxx):

Standard_Real aFirst, aLast;
Handle(Geom_Curve) pCurv = BRep_Tool::Curve(E, aFirst, aLast);

If you have not created the 3D curves, pCurv will be a null handle. Using it will result in segmentation faults.

I have been excited about where the 3D curves are actually used. Therefore I have tried several algorithms. These are the algorithms I have tried where the 3D curves are not used:

  • Visualizing
  • Export to BREP
  • Export to STEP
  • Length Measurement
  • Checking Whether a Wire Is Closed or Ordered

The only algorithm I have found where the 3D curves are used are extrema/distance computations with BRepExtrema_DistShapeShape. You will not be able to use this class if you have not created the 3D curves.

Benjamin Bihler
  • 1,612
  • 11
  • 32