
Mon, 07/02/2018 - 09:46
Hello.
I have been reading a documentation for MakeWire class ( https://www.opencascade.com/doc/occt-7.0.0/refman/html/class_b_rep_builder_a_p_i___make_wire.html#a8a6bc22ee4601968fe013021875f06b9 ). It says:
Given edges are added in a sequence. Each of them must be connectable to the wire under construction, and so must satisfy the following condition (unless it is the first edge of the wire): one of its vertices must be geometrically coincident with one of the vertices of the wire (provided that the highest tolerance factor is assigned to the two vertices). It could also be the same vertex. Warning If an edge is not connectable to the wire under construction it is not added. The function Error will return BRepBuilderAPI_DisconnectedWire, the function IsDone will return false and the function Wire will raise an error, until a new connectable edge is added.
Let's say, I am adding edges one-by-one, and the last edge to add is not connectable. MakeWire instance was valid and ready to be displayed, even without the unconnectable edge. But now the new edge was not added to the MakeWire instance, AND it is not possible to obtain a Wire without that edge, because error is raised!
How, in this case, to obtain a Wire from previous step, before the unconnectable Edge was added? That edge was the last one to add. Should I re-add the last successfully added edge (which already exist in the wire)?
Mon, 07/02/2018 - 09:58
> How, in this case, to obtain a Wire from previous step, before the unconnectable Edge was added?
> That edge was the last one to add. Should I re-add the last successfully added edge (which already exist in the wire)?
You misunderstand the purpose of this tool.
BRepBuilderAPI_MakeWire is just a handy tool which builds a valid Wire (with some trivial healing) on a valid input.
It is not expected to be filled in with an arbitrary / invalid sequence of input data!
Tue, 07/03/2018 - 08:27
Okay. So, BRepBuilderAPI_MakeWire expects only a valid input and it fails on invalid input.
But what to do if a data source of information about edges cannot be guaranteed to be 100% valid (for example, information about edges is being resolved from user's dxf)? Does OpenCascade offer another more fail-safe approach for arbitrary data?
Tue, 07/03/2018 - 12:39
You could iterate over your edges before connecting them and check whether their vertices are geometrically incident. If not then you could fix that or refuse to continue.
Benjamin
Wed, 07/04/2018 - 05:06
I think you can try the class ShapeAnalysis_WireOrder to get the edges order to sort them for a valid input.
Thu, 07/05/2018 - 12:19
Hello,
I think the best way to make a wire(s) from un-connected edges is to use: ShapeAnalysis_FreeBounds::ConnectEdgesToWires
It tries to make a longest possible wire(s) from unconnected edges (see "shared" paramater to use unconnected edges)
Here is an example: WiresFromEdges
Docs: FreeBounds
Best regards,
Guido
Tue, 07/10/2018 - 17:17
I'll repost your code here, for completeness: