ArchWall : Bug Fix Length Property Accuracy Problem (#17496)
* ArchWall : Bug Fix Length Property Accuracy Problem See https://github.com/FreeCAD/FreeCAD/issues/15794 * [ArchWall] Fix regression with multi-material and align center * ArchWall - Regression Typo --------- Co-authored-by: Yorik van Havre <yorik@uncreated.net>
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -306,8 +306,7 @@ def wiresIntersect(wire1, wire2):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def connect(edges, closed=False):
|
||||
def connect(edges, closed=False, wireNedge=False):
|
||||
"""Connect the edges in the given list by their intersections."""
|
||||
|
||||
inters_list = [] # List of intersections (with the previous edge).
|
||||
@@ -330,7 +329,9 @@ def connect(edges, closed=False):
|
||||
curr_inters_list)]
|
||||
inters_list.append(inters)
|
||||
|
||||
new_edges_full = []
|
||||
new_edges = []
|
||||
|
||||
for i, curr in enumerate(edges):
|
||||
curr_sta = inters_list[i]
|
||||
if i < (len(edges) - 1):
|
||||
@@ -350,19 +351,32 @@ def connect(edges, closed=False):
|
||||
prev = None
|
||||
if prev is not None:
|
||||
prev_end = prev.Vertexes[-1].Point
|
||||
new_edges.append(Part.LineSegment(prev_end, curr_sta).toShape())
|
||||
new_edges_full.append(Part.LineSegment(prev_end, curr_sta).toShape())
|
||||
|
||||
if curr_end is None:
|
||||
curr_end = curr.Vertexes[-1].Point
|
||||
|
||||
if curr_sta != curr_end:
|
||||
if geomType(curr) == "Line":
|
||||
new_edges.append(Part.LineSegment(curr_sta, curr_end).toShape())
|
||||
n = Part.LineSegment(curr_sta, curr_end).toShape()
|
||||
new_edges.append(n)
|
||||
new_edges_full.append(n)
|
||||
|
||||
elif geomType(curr) == "Circle":
|
||||
new_edges.append(Part.Arc(curr_sta, findMidpoint(curr), curr_end).toShape())
|
||||
n = Part.Arc(curr_sta, findMidpoint(curr), curr_end).toShape()
|
||||
new_edges.append(n)
|
||||
new_edges_full.append(n)
|
||||
|
||||
try:
|
||||
return Part.Wire(new_edges)
|
||||
wire = Part.Wire(new_edges_full)
|
||||
|
||||
# TODO May phase out wire if bind() can do without it later and do with
|
||||
# only connectEdges so no need bind() to find 'touching edges' there
|
||||
if wireNedge:
|
||||
return (wire, new_edges_full, new_edges)
|
||||
else:
|
||||
return wire
|
||||
|
||||
except Part.OCCError:
|
||||
print("DraftGeomUtils.connect: unable to connect edges")
|
||||
for edge in new_edges:
|
||||
|
||||
@@ -169,7 +169,8 @@ def offset(edge, vector, trim=False):
|
||||
|
||||
def offsetWire(wire, dvec, bind=False, occ=False,
|
||||
widthList=None, offsetMode=None, alignList=[],
|
||||
normal=None, basewireOffset=0):
|
||||
normal=None, basewireOffset=0, wireNedge=False):
|
||||
# normal=None, basewireOffset=0):
|
||||
"""Offset the wire along the given vector.
|
||||
|
||||
Parameters
|
||||
@@ -503,23 +504,33 @@ def offsetWire(wire, dvec, bind=False, occ=False,
|
||||
if not nedge:
|
||||
return None
|
||||
|
||||
# nedges is offset edges
|
||||
nedges.append(nedge)
|
||||
|
||||
if len(edges) > 1:
|
||||
nedges = connect(nedges, closed)
|
||||
# TODO May phase out wire if bind() can do without it later and do with
|
||||
# only connectEdges so no need bind() to find 'touching edges' there
|
||||
wire,connectEdgesF,connectEdges = connect(nedges,closed,wireNedge=True)
|
||||
else:
|
||||
nedges = Part.Wire(nedges[0])
|
||||
# TODO May phase out wire if bind() can do without it later and do with
|
||||
# only connectEdges so no need bind() to find 'touching edges' there
|
||||
wire = Part.Wire(nedges[0])
|
||||
connectEdgesF = connectEdges = nedges # nedges[0]
|
||||
|
||||
if bind and not closed:
|
||||
e1 = Part.LineSegment(edges[0].Vertexes[0].Point,
|
||||
nedges[0].Vertexes[0].Point).toShape()
|
||||
wire[0].Vertexes[0].Point).toShape()
|
||||
e2 = Part.LineSegment(edges[-1].Vertexes[-1].Point,
|
||||
nedges[-1].Vertexes[-1].Point).toShape()
|
||||
alledges = edges.extend(nedges)
|
||||
wire[-1].Vertexes[-1].Point).toShape()
|
||||
#nedges[-1].Vertexes[-1].Point).toShape()
|
||||
alledges = edges.extend(nedges) # TODO nedges is a wire or are edges?
|
||||
alledges = alledges.extend([e1, e2])
|
||||
w = Part.Wire(alledges)
|
||||
return w
|
||||
else:
|
||||
return nedges
|
||||
if wireNedge:
|
||||
return (wire,connectEdgesF,connectEdges,nedges)
|
||||
else:
|
||||
return wire
|
||||
|
||||
## @}
|
||||
|
||||
Reference in New Issue
Block a user