2017-02-07 41 views
0

我對兩個曲面之間的交點存在問題。 第一個被修剪而第二個被修剪。開放級聯的表面交點

我使用BRepAlgoAPI_Section相交的兩個表面,將獲得的交叉點邊緣(在我的情況下只有一個):

這是我的代碼,這裏我使交叉點:

TopoDS_Face trimface, face; 

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

在這裏,我在部分邊緣之間迭代。對於每個邊緣,我創建一個TopoDS_Edge放在屏幕上。

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(); 
} 

如果我分別檢查的anAisEdgeanAisEdge2屏幕顯示器I獲得兩個不同的結果。我不明白爲什麼。 在第一個顯示屏上的兩個圖像中,第二個顯示在第一個顯示屏上。

enter image description here

回答

1

在OCC文檔的BRepBuilderAPI_MakeEdge類指出「如果曲線是一個修整曲線的基礎曲線是用來」。在這種情況下,我認爲您應該直接在BRepBuilderAPI_MakeEdge構造函數中指定所需的參數值。