From a5aa838575bfe3a278720e99b9519c96825959ce Mon Sep 17 00:00:00 2001 From: paullee0 Date: Thu, 25 Jul 2019 23:43:30 +0800 Subject: [PATCH] Multi-Width to support Sketch with multiple wires Discussion:- https://forum.freecadweb.org/viewtopic.php?f=23&t=37708&p=321956#p321956 --- src/Mod/Arch/ArchWall.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Mod/Arch/ArchWall.py b/src/Mod/Arch/ArchWall.py index 369ea99553..e05b62b2e3 100644 --- a/src/Mod/Arch/ArchWall.py +++ b/src/Mod/Arch/ArchWall.py @@ -804,6 +804,8 @@ class _Wall(ArchComponent.Component): # TODO currently layers were not supported when len(basewires) > 0 width = 0 + widths = obj.OverrideWidth + if obj.OverrideWidth: if obj.OverrideWidth[0]: width = obj.OverrideWidth[0] @@ -811,7 +813,7 @@ class _Wall(ArchComponent.Component): if obj.Width: width = obj.Width.Value else: - print("Width or Widths Of Wall [0] should not be 0") + print("Width or OverrideWidth[0] should not be 0") return height = obj.Height.Value @@ -888,9 +890,12 @@ class _Wall(ArchComponent.Component): if (len(self.basewires) == 1) and layers: self.basewires = [self.basewires[0] for l in layers] + layeroffset = 0 baseface = None for i,wire in enumerate(self.basewires): + + edgeNum = len(wire.Edges) e = wire.Edges[0] if isinstance(e.Curve,Part.Circle): dvec = e.Vertexes[0].Point.sub(e.Curve.Center) @@ -911,7 +916,7 @@ class _Wall(ArchComponent.Component): dvec2 = DraftVecUtils.scaleTo(dvec,off) wire = DraftGeomUtils.offsetWire(wire,dvec2) - w2 = DraftGeomUtils.offsetWire(wire,dvec,False, False, obj.OverrideWidth) + w2 = DraftGeomUtils.offsetWire(wire,dvec,False, False, widths) w1 = Part.Wire(Part.__sortEdges__(wire.Edges)) sh = DraftGeomUtils.bind(w1,w2) @@ -928,7 +933,7 @@ class _Wall(ArchComponent.Component): dvec2 = DraftVecUtils.scaleTo(dvec,off) wire = DraftGeomUtils.offsetWire(wire,dvec2) - w2 = DraftGeomUtils.offsetWire(wire,dvec,False, False, obj.OverrideWidth) + w2 = DraftGeomUtils.offsetWire(wire,dvec,False, False, widths) w1 = Part.Wire(Part.__sortEdges__(wire.Edges)) sh = DraftGeomUtils.bind(w1,w2) @@ -944,12 +949,16 @@ class _Wall(ArchComponent.Component): else: dvec.multiply(width/2) ## TODO width Value should be of no use (width/2), width Direction remains 'in use' - overrideWidthHalfen = [i/2 for i in obj.OverrideWidth] + overrideWidthHalfen = [i/2 for i in widths] + w1 = DraftGeomUtils.offsetWire(wire,dvec,False, False, overrideWidthHalfen) dvec = dvec.negative() w2 = DraftGeomUtils.offsetWire(wire,dvec,False, False, overrideWidthHalfen) sh = DraftGeomUtils.bind(w1,w2) + + del widths[0:edgeNum] + if sh: sh.fix(0.1,0,1) # fixes self-intersecting wires f = Part.Face(sh)