export edge to BREP, keep 2D representation

Hi everyone,


Im working with a lot of edges, which have a representation on the same face (mostly created by projection (BRepOffsetAPI_NormalProjection)). 

I add all these edges to a TopoDS_Compound, using BRep_Builder.

Because these calculations are time consuming, I want to store the results (Edges, with 2D representation on my face) in a BREP-file.

So I use BRepTools::Write() to export the compound to file.

When i reload the file (using BRepTools::Read) the loaded edges have no 2D representation on the face anymore...



Right now, I use ShapeFix_Edge::FixAddPCurve(myEdge, myFace, false) to fix that problem. 

However, this fix takes around 200ms to perform for each Edge


What I tried already:

To be sure about the representation I checked with ShapeAnalysis_Edge::HasPCurve(myEdge, myFace) before exporting to BREP, which returns true.

I added the face to the compound ​(BRep_Builder::Add(myCompoundIncludingAllEdges, myFace)) before exporting to BREP.

-> Unfortunately no change after Import. 



Best regards


Forum supervisor's picture

Hello Stefan,

What do you actually save in a BRep file - a compound or a face?

Thanks in advance for a clarification.

Best regards,

Forum supervisor

Forum supervisor's picture

And another question - what is the type of surface of that face?

Forum supervisor

s.wolff_138846's picture

Hi, thank you for your fast response. 

I add all the edges to a TopoDS_Compound and save this TopoDS_Compound  in a BRep file.

The surface is a GeomAbs_BSplineSurface.

Forum supervisor's picture

Hello Stefan,

The 2d curves in edges on NURBS-based faces should be saved and restored well – it means there is a problem in your code.

Here is a sample script in Draw test Harness to illustrate the 2d curves are saved and restored well:

# Load all commands

pload ALL

# Restore a shape from the file

brestore $env(CASROOT)/data/occ/CrankArm.brep a

# Extract all faces

explode a f

# Extract edges of the face No 42 that is based on a b-spline surface

explode a_42 e

# Make a compound of these edges

compound a_42_1 a_42_2 a_42_3 a_42_4 c

# Save the compound to a BRep file

bsave c d:/compound1.brep

# Restore the compound as a new shape

brestore d:/compound1.brep b

# Extract edges

explode b e

# Dump the contents to see that a 2d curve exist

dump b_1

If you can’t fix the problem in your code, please, consider our support services.

Best regards,

Forum supervisor