[ArchWall] ArchWall Offset should now works with Base as Sketch

This commit is contained in:
paul lee
2020-06-08 02:51:13 +08:00
committed by Yorik van Havre
parent 40fccdcbc8
commit 999c3d8bf4
2 changed files with 26 additions and 13 deletions

View File

@@ -1278,6 +1278,7 @@ class _Wall(ArchComponent.Component):
self.basewires = [self.basewires[0] for l in layers]
layeroffset = 0
baseface = None
for i,wire in enumerate(self.basewires):
# Check number of edges per 'wire' and get the 1st edge
@@ -1322,8 +1323,10 @@ class _Wall(ArchComponent.Component):
sh = None
curAligns = aligns[0]
off = obj.Offset.Value
if curAligns == "Left":
off = obj.Offset.Value
if layers:
curWidth = abs(layers[i])
off = off+layeroffset
@@ -1340,9 +1343,9 @@ class _Wall(ArchComponent.Component):
# dvec2 = DraftVecUtils.scaleTo(dvec,off)
# wire = DraftGeomUtils.offsetWire(wire,dvec2)
# Get the 'offseted' wire taking into account
# of Width and Align of each edge, and overall
# Offset
## Get the 'offseted' wire taking into account
## of Width and Align of each edge, and overall
## Offset
w2 = DraftGeomUtils.offsetWire(wire, dvec,
bind=False,
occ=False,
@@ -1362,11 +1365,12 @@ class _Wall(ArchComponent.Component):
alignList=aligns,
normal=normal,
basewireOffset=off)
sh = DraftGeomUtils.bind(w1,w2)
elif curAligns == "Right":
dvec = dvec.negative()
off = obj.Offset.Value
if layers:
curWidth = abs(layers[i])
off = off+layeroffset
@@ -1382,6 +1386,7 @@ class _Wall(ArchComponent.Component):
# dvec2 = DraftVecUtils.scaleTo(dvec,off)
# wire = DraftGeomUtils.offsetWire(wire,dvec2)
w2 = DraftGeomUtils.offsetWire(wire, dvec,
bind=False,
occ=False,
@@ -1423,17 +1428,16 @@ class _Wall(ArchComponent.Component):
widthList=widths,
offsetMode=None,
alignList=aligns,
normal=normal)
normal=normal,
basewireOffset=off)
w1 = DraftGeomUtils.offsetWire(wire, dvec,
bind=False,
occ=False,
widthList=widths,
offsetMode="BasewireMode",
alignList=aligns,
normal=normal)
normal=normal,
basewireOffset=off)
sh = DraftGeomUtils.bind(w1,w2)
del widths[0:edgeNum]

View File

@@ -380,7 +380,14 @@ def offsetWire(wire, dvec, bind=False, occ=False,
# This is a xor
if (curOrientation == firstOrientation) != (curDir == firstDir):
if curAlign in ['Left', 'Right']:
nedge = curredge
# ArchWall has an Offset properties for user to offset
# the basewire before creating the base profile of wall
# (not applicable to 'Center' align)
if basewireOffset:
delta = DraftVecUtils.scaleTo(delta, basewireOffset)
nedge = offset(curredge,delta,trim=True)
else:
nedge = curredge
elif curAlign == 'Center':
delta = delta.negative()
nedge = offset(curredge, delta, trim=True)
@@ -391,8 +398,10 @@ def offsetWire(wire, dvec, bind=False, occ=False,
# the basewire before creating the base profile of wall
# (not applicable to 'Center' align)
if basewireOffset:
delta = DraftVecUtils.scaleTo(delta,
delta.Length + basewireOffset)
if curAlign in ['Left', 'Right']:
delta = DraftVecUtils.scaleTo(delta,
delta.Length + basewireOffset)
#else: # elif curAlign == 'Center': #pass # no need to add basewireOffset
nedge = offset(curredge, delta, trim=True)
# TODO arc always in counter-clockwise directinon