For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Surface intersections

Gabriele Cuccolini's picture

Hi, I've a problem about the intersection between two surfaces.
The first is trimmed while the second is untrimmed.

I use the BRepAlgoAPI_Section to intersect the two surfaces and obtain the intersection 

edges (in my case only one):

This is my code, here I make the intersection:

TopoDS_Face trimface, face;

// ...... filling face and trimface from IGES file

BRepAlgoAPI_Section ffsect( trimface, face, Standard_True);

Here I iterate between the section edges. For each edge I create a TopoDS_Edge to put on screen.

Standard_Real pFirst, pLast;    

TopTools_ListOfShape edges = ffsect.SectionEdges();

TopTools_ListIteratorOfListOfShape eIter(edges);
while ( eIter.More() ) {
    // For each edge I create a TopoDS_Edge object and I put it on screen    
    TopoDS_Edge edge = TopoDS::Edge(eIter.Value());            
    Handle(AIS_Shape) anAisEdge;
    anAisEdge = new AIS_Shape(edge);
    // get my Ais_InteractiveContext

    // Create a Geom_BSplineCurve from edge
    Handle(Geom_BSplineCurve) myCurve = Handle(Geom_BSplineCurve)::DownCast(BRep_Tool::Curve(edge, pFirst, pLast));

    // Now create a TopoDS_Edge from my curve 
    TopoDS_Edge edge2 = BRepBuilderAPI_MakeEdge(myCurve);
    Handle(AIS_Shape) anAisEdge2;
    anAisEdge2 = new AIS_Shape(edge2);



If I check separately the display on screen of anAisEdge and anAisEdge2 I obtain two different results. I don't understand why.
In the image in attach  on top the first display while down the second one.

Forum supervisor's picture

Dear Gabriele,


The difference in your first and second cases is due initialization of BSplineCurve instead of TrimmedCurve here :

Handle(Geom_BSplineCurve) myCurve = Handle(Geom_BSplineCurve)::DownCast(BRep_Tool::Curve(edge, pFirst, pLast));

Please try :

Handle(Geom_TrimmedCurve) myCurve = Handle(Geom_TrimmedCurve)::DownCast(BRep_Tool::Curve(edge, pFirst, pLast));


Handle(Geom_Curve) myCurve = BRep_Tool::Curve(edge, pFirst, pLast);


One more remark.

These lines in your code perform section operation twice :

BRepAlgoAPI_Section ffsect( trimface, face, Standard_True);




Instead of that you should use :

BRepAlgoAPI_Section ffsect( trimface, face, Standard_False);


Best regards, FSR