Skip to content

Commit

Permalink
[ArchWall] ArchWall Offset should now works with Base as Sketch
Browse files Browse the repository at this point in the history
  • Loading branch information
paul lee authored and yorikvanhavre committed Jun 24, 2020
1 parent f5dea7e commit 81dd47b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
24 changes: 14 additions & 10 deletions src/Mod/Arch/ArchWall.py
Expand Up @@ -1278,6 +1278,7 @@ def getExtrusionData(self,obj):
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
Expand Down Expand Up @@ -1322,8 +1323,10 @@ def getExtrusionData(self,obj):
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
Expand All @@ -1340,9 +1343,9 @@ def getExtrusionData(self,obj):
# 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,
Expand All @@ -1362,11 +1365,12 @@ def getExtrusionData(self,obj):
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
Expand All @@ -1382,6 +1386,7 @@ def getExtrusionData(self,obj):
# dvec2 = DraftVecUtils.scaleTo(dvec,off)
# wire = DraftGeomUtils.offsetWire(wire,dvec2)


w2 = DraftGeomUtils.offsetWire(wire, dvec,
bind=False,
occ=False,
Expand Down Expand Up @@ -1423,17 +1428,16 @@ def getExtrusionData(self,obj):
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]
Expand Down
15 changes: 12 additions & 3 deletions src/Mod/Draft/draftgeoutils/offsets.py
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 81dd47b

Please sign in to comment.