0

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;

BRepAlgoAPI_Section ffsect( trimface, face, Standard_True);
ffsect.Approximation(Standard_True);
ffsect.Build();

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);
    anAisEdge->SetColor(Quantity_NOC_RED);
    anAisEdge->SetWidth(2.0);
    // get my Ais_InteractiveContext
    myOccView->getContext()->Display(anAisEdge);

    // 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);
    anAisEdge2->SetColor(Quantity_NOC_RED);
    anAisEdge2->SetWidth(2.0);
    myOccView->getContext()->Display(anAisEdge2);

    eIter.Next();
}

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

enter image description here

Bowdzone
  • 3,827
  • 11
  • 39
  • 52

1 Answers1

1

In the OCC documentation for the BRepBuilderAPI_MakeEdge class is stated that "If the curve is a trimmed curve the basis curve is used". In this case, I think you should directly specify the required parameter values of the curve in the BRepBuilderAPI_MakeEdge constructor.

Community
  • 1
  • 1