I came across a problem making face from wire: the face can not be built.
It's supposed to have a solid in the end, however i get the result like the pic shows.
Could someone tell me where am i wrong?
In my case, the edges are disconnected and i somehow connected them and created a wire, and I mirrored the wire. When i try to add them to one wire (wire and mirrorWire) it doesn't work. Would you please share your idea!
With regards
Commenter-1
Commenter-1!
02Commenter-2
The wire should be reordered firstly with ShapeFix.
Handle(ShapeExtend_WireData) sbwd1 = new ShapeExtend_WireData();
POSITION pos = aEdgeList.GetHeadPosition();
while (pos)
{
aEdge = aEdgeList.GetNext(pos);
sbwd1->Add(aEdge);
}
Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire;
sfw->Load(sbwd1);
sfw->Perform();
//Reorder edges is very important
sfw->FixReorder();
sfw->SetMaxTolerance(tol);
///////////////////////////////////
sfw->ClosedWireMode() = Standard_True;
sfw->FixConnected(1.e-3);
sfw->FixClosed(1.e-3);
for (int i = 1; i <= sfw->NbEdges(); i ++)
{
TopoDS_Edge Edge = sfw->WireData()->Edge(i);
FTol.SetTolerance(Edge, tol, TopAbs_VERTEX);
aMakeWire.Add(Edge);
}
Thank for your reply!
I have a difficulty to implement your suggestion into my case,
I have disconnected, disordered , and wrongly oriented Edges in TopoDS_Shape shapecommon. I have order, connect, and propertly orient this edges and make a wire from them. Finally to make face...........
Standard_Real tol = 0.01;
BRepBuilderAPI_MakeWire brepMake;
ShapeFix_ShapeTolerance FTol;
Handle(ShapeExtend_WireData) aWD = new ShapeExtend_WireData();
TopExp_Explorer edgeExp; for(TopExp_Explorer edgeExp(shapeCommon, TopAbs_EDGE); edgeExp.More(); edgeExp.Next()) //TopDS_Shape shapecommon -consists disconnected edges
{
TopoDS_Edge Edge = TopoDS::Edge(edgeExp.Current());
POSITION pos = Edge.GetHeadPosition(); // Here I replaced aEdgeList with explored Edge, but it doesn't work!
While(pos) //Doesn't Understand the syntax POSITION
{
aEdge = Edge.GetNext(pos);
aWD->Add(aEdge);
}
}
Handle(ShapeFix_Wire) aShFW = new ShapeFix_Wire();
aShFW->Load(aWD);
aShFW->Perform();
// aShFW->ClosedWireMode() = Standard_True;
aShFW->FixReorder();
aShFW->SetMaxTolerance(tol);
aShFW->ClosedWireMode() = Standard_True;
aShFW->FixConnected(1.e-3);
aShFW->FixClosed(1.e-3);
for (int i = 1; i <= aShFW->NbEdges(); i ++)
{
TopoDS_Edge Edge = aShFW->WireData()->Edge(i);
FTol.SetTolerance(Edge, tol, TopAbs_VERTEX);
brepMake.Add(Edge);
}
TopoDS_Wire wire = brepMake.Wire();
So, the program doesn't work as i replaced aEdgeList with explored Edge, but it doesn't work!
Would you please suggest me how to correct!
Thank you very much
Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire;
sfw->Load(sbwd1);
sfw->Perform();
//Reorder edges is very important
sfw->FixReorder();
sfw->SetMaxTolerance(tol);
///////////////////////////////////
sfw->ClosedWireMode() = Standard_True;
sfw->FixConnected(Precision::Confusion());
sfw->FixClosed(Precision::Confusion());
for (int i = 1; i <= sfw->NbEdges(); i ++)
{
TopoDS_Edge Edge = sfw->WireData()->Edge(i);
FTol.SetTolerance(Edge, tol, TopAbs_VERTEX);
aMakeWire.Add(Edge);
}