From 999c3d8bf468bb24cd9472c16a02b81071535795 Mon Sep 17 00:00:00 2001 From: paul lee Date: Mon, 8 Jun 2020 02:51:13 +0800 Subject: [PATCH] [ArchWall] ArchWall Offset should now works with Base as Sketch --- src/Mod/Arch/ArchWall.py | 24 ++++++++++++++---------- src/Mod/Draft/draftgeoutils/offsets.py | 15 ++++++++++++--- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/Mod/Arch/ArchWall.py b/src/Mod/Arch/ArchWall.py index 8dee6f4e0d..8f21d90722 100644 --- a/src/Mod/Arch/ArchWall.py +++ b/src/Mod/Arch/ArchWall.py @@ -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] diff --git a/src/Mod/Draft/draftgeoutils/offsets.py b/src/Mod/Draft/draftgeoutils/offsets.py index e4a0da33e3..b90077a50c 100644 --- a/src/Mod/Draft/draftgeoutils/offsets.py +++ b/src/Mod/Draft/draftgeoutils/offsets.py @@ -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