
Wed, 04/12/2017 - 17:37
Hello, I think i have an understanding issue here, but when i try to fuse to two edges together like this, the result still has two edges.
Do i use the fuse algorithm in a wrong way, or do i have to do something else?
pt1 = OCC.gp.gp_Pnt(0,0,0)
pt2 = OCC.gp.gp_Pnt(3,0,0)
pt3 = OCC.gp.gp_Pnt(1,0,0)
pt4 = OCC.gp.gp_Pnt(5,0,0)edge1 = OCC.BRepBuilderAPI.BRepBuilderAPI_MakeEdge(pt1,pt2).Edge()
edge2 = OCC.BRepBuilderAPI.BRepBuilderAPI_MakeEdge(pt3,pt4).Edge()fuse = OCC.BRepAlgoAPI.BRepAlgoAPI_Fuse(edge1, edge2).Shape()
edges = []
exp = OCC.TopExp.TopExp_Explorer(fuse, OCC.TopAbs.TopAbs_EDGE)
while exp.More():
edge = OCC.TopoDS.topods.Edge(exp.Current())
edges.append(edge)
exp.Next()
return edges
results in two edges, I need one.
unif = OCC.ShapeUpgrade.ShapeUpgrade_UnifySameDomain(fuse)
unif.Build()
unif.UnifyEdges()
even results in three edges :)
Any help is appreciated!
Cheers.
Thu, 04/13/2017 - 10:46
Okay, I solved it using:
though i don't yet understand why the normal boolean fuse does not just unify the two edges.
*edit
apparently
does the same, are there any differences, or advantages to using one of the methods, or is there a better one? Basically I need do fuse edges that can be fuse (i.e. I would check for common and unify them if common has been found, to get one edge)
**edit
BRepAlgoAPI_Fuse(edge1, edge2) only fuses the edges into one edge if they have exactly the same coordinates
Thu, 04/13/2017 - 11:05
Dear Martin,
As you can see from Draw script below, an operation of merging 2 your edges properly produces a shape with 3 edges, what can be joined to a wire and unified to a shape with 1 edge.
vertex v1 0 0 0 vertex v2 3 0 0 vertex v3 1 0 0 vertex v4 5 0 0
edge e1 v1 v2 edge e2 v3 v4
bfuse r e1 e2
nbs r
# EDGE : 3
eval wire w [explode r e]
unifysamedom result w
don result
nbs result
# EDGE : 1
Best regards,
Forum supervisor
Thu, 04/13/2017 - 11:18
Thanks for your help, can you explaine to me what the other two methods (BRepLib_FuseEdges and TopOpeBRepTool_FuseEdges) do, and where they differ from your solution?
Thu, 04/13/2017 - 11:31
Your Solution does not seem to work for me :/
The result are still 2 edges
Fri, 04/21/2017 - 14:10
This solution does not work because you've missed the step in which the edges are fused (bfuse r e1 e2). The unification algorithm works only on topologically shared objects, i.e. the edges should be connected.
Thu, 04/13/2017 - 14:45
_