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

BRepBuilderAPI_MakeWire

Simon Bulman's picture
Forums: 

Hi All,

I am trying to use the BRepBuilderAPI_MakeWire to build a wire from a set of edges. Two things can be known for sure about the edges

1) It is not assured that the edges are given in sequence... 2) However the edges in some sequence form a closed wire.

This is the psuedo code I came up with.

list edges; current_edge = edges.first; BRepBuilderAPI_MakeWire make_wire; TopoDS_Wire current_wire;

do // Loop while current_wire is not closed. { // try to add edge.

make_wire.Add(current_edge);

// if ok.

if (make_wire.IsDone()) {

// remove current edge from edge list.

// return to start of edge list.

// make copy of current wire.

current_wire = make_wire.Wire(); }

// If failed.

else {

// If no edges left break;

// move to next edge

current_edge++; }

} while (!current_wire.Closed());

Now this works fine if I am sure that the edges given are in sequence, this however is not the case. When I add an edge which can not be added, the IsDone returns false as expected, however, when I try and add the next edge it is added o.k but the internal first and last vertices of the make_wire object seem not to be updated. I have briefly stepped through the debugger and this seems to occur at line 338 of BRepLib_MakeWire.cxx. as shown below.

if (init) TopExp::Vertices(TopoDS::Wire(myShape), VF,VL); // Line 338 else {

if (myError == BRepLib_WireDone){ // Update only

TopoDS_Vertex V1,V2,VRef;

The first line is for when an wire is initialized and so the two vertices are set i.e. VF,VL. However on a second call (when the edge can not be added) the myError has been set to disconected (as expected). The third edge I add can be added, and is indeed added to the wire, however, the myError flag does not seem to of changed so the vertices are not updated. BIG PROBLEM. As now the current_wire->Closed() always returns false.

This obviously seems to be a bug ! Or have I missed something etc.

Any help is greatly recieved.

Simon