From 474c114e663648171606c55ce3c5cf2ac5bff6e8 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Wed, 23 Dec 2015 11:32:36 -0200 Subject: [PATCH 1/4] Arch: fixed projection of Drawing views of arch sectionplanes - fixes #2233 --- src/Mod/Arch/ArchSectionPlane.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Mod/Arch/ArchSectionPlane.py b/src/Mod/Arch/ArchSectionPlane.py index 1c28b391cb..b593aacf3a 100644 --- a/src/Mod/Arch/ArchSectionPlane.py +++ b/src/Mod/Arch/ArchSectionPlane.py @@ -384,7 +384,7 @@ class _ArchDrawingView: import ArchVRM, WorkingPlane wp = WorkingPlane.plane() wp.setFromPlacement(obj.Source.Placement) - wp.inverse() + #wp.inverse() render = ArchVRM.Renderer() render.setWorkingPlane(wp) render.addObjects(objs) @@ -392,12 +392,14 @@ class _ArchDrawingView: render.cut(obj.Source.Shape,obj.ShowCut) else: render.cut(obj.Source.Shape) + self.svg += '\n' self.svg += render.getViewSVG(linewidth="LWPlaceholder") self.svg += fillpattern self.svg += render.getSectionSVG(linewidth="SWPlaceholder",fillpattern="sectionfill") if hasattr(obj,"ShowCut"): if obj.ShowCut: self.svg += render.getHiddenSVG(linewidth="LWPlaceholder") + self.svg += '\n' # print render.info() else: From 94dd07297dadc0a786cc04055a3a528ddca1011a Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Wed, 23 Dec 2015 11:55:34 -0200 Subject: [PATCH 2/4] Draft: Fixed display of Arch axes on Drawing views --- src/Mod/Draft/Draft.py | 48 +++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index 287030e88a..49b32ce5e6 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -2094,31 +2094,45 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct elif getType(obj) == "Axis": "returns the SVG representation of an Arch Axis system" + vobj = obj.ViewObject lorig = getLineStyle() fill = 'none' invpl = obj.Placement.inverse() + rad = vobj.BubbleSize.Value/2 n = 0 for e in obj.Shape.Edges: lstyle = lorig svg += getPath([e]) - p1 = invpl.multVec(e.Vertexes[0].Point) - p2 = invpl.multVec(e.Vertexes[1].Point) - dv = p2.sub(p1) - dv.normalize() - rad = obj.ViewObject.BubbleSize - center = p2.add(dv.scale(rad,rad,rad)) lstyle = "none" - svg += getCircle(Part.makeCircle(rad,center)) - svg += '\n' - svg += '\n' - n += 1 + pos = ["Start"] + if hasattr(vobj,"BubblePosition"): + if vobj.BubblePosition == "Both": + pos = ["Start","End"] + else: + pos = [vobj.BubblePosition] + for p in pos: + if p == "Start": + p1 = invpl.multVec(e.Vertexes[0].Point) + p2 = invpl.multVec(e.Vertexes[1].Point) + else: + p1 = invpl.multVec(e.Vertexes[1].Point) + p2 = invpl.multVec(e.Vertexes[0].Point) + dv = p2.sub(p1) + dv.normalize() + center = p2.add(dv.scale(rad,rad,rad)) + svg += getCircle(Part.makeCircle(rad,center)) + if hasattr(vobj.Proxy,"bubbletexts"): + if len (vobj.Proxy.bubbletexts) >= n: + svg += '\n' + svg += '\n' + n += 1 elif getType(obj) == "Space": "returns an SVG fragment for the text of a space" From a1f82e443eea4838d7ae44e583743c901cd6a2d1 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Wed, 23 Dec 2015 12:13:29 -0200 Subject: [PATCH 3/4] Draft: small fix in Arch Axes SVG output --- src/Mod/Draft/Draft.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index 49b32ce5e6..39bfcc94d9 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -2097,7 +2097,6 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct vobj = obj.ViewObject lorig = getLineStyle() fill = 'none' - invpl = obj.Placement.inverse() rad = vobj.BubbleSize.Value/2 n = 0 for e in obj.Shape.Edges: @@ -2112,11 +2111,11 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct pos = [vobj.BubblePosition] for p in pos: if p == "Start": - p1 = invpl.multVec(e.Vertexes[0].Point) - p2 = invpl.multVec(e.Vertexes[1].Point) + p1 = e.Vertexes[0].Point + p2 = e.Vertexes[1].Point else: - p1 = invpl.multVec(e.Vertexes[1].Point) - p2 = invpl.multVec(e.Vertexes[0].Point) + p1 = e.Vertexes[1].Point + p2 = e.Vertexes[0].Point dv = p2.sub(p1) dv.normalize() center = p2.add(dv.scale(rad,rad,rad)) From 7913e608be389691a106d94d8b0e934418571cb3 Mon Sep 17 00:00:00 2001 From: Jonathan Wiedemann Date: Wed, 23 Dec 2015 15:03:03 +0100 Subject: [PATCH 4/4] Arch : Add Align property to StructuralSystem --- src/Mod/Arch/ArchStructure.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/Mod/Arch/ArchStructure.py b/src/Mod/Arch/ArchStructure.py index 903b83e652..270301ea0c 100644 --- a/src/Mod/Arch/ArchStructure.py +++ b/src/Mod/Arch/ArchStructure.py @@ -774,6 +774,7 @@ class _StructuralSystem(ArchComponent.Component): ArchComponent.Component.__init__(self,obj) obj.addProperty("App::PropertyLinkList","Axes","Arch",translate("Arch","Axes systems this structure is built on")) obj.addProperty("App::PropertyIntegerList","Exclude","Arch",translate("Arch","The element numbers to exclude when this structure is based on axes")) + obj.addProperty("App::PropertyBool","Align","Arch","If true the element are aligned with axes").Align = False self.Type = "StructuralSystem" def execute(self,obj): @@ -794,7 +795,13 @@ class _StructuralSystem(ArchComponent.Component): # applying axes pts = self.getAxisPoints(obj) - apl = self.getAxisPlacement(obj) + if hasattr(obj,"Align"): + if obj.Align == False : + apl = self.getAxisPlacement(obj) + if obj.Align == True : + apl = None + else : + apl = self.getAxisPlacement(obj) if pts: fsh = [] @@ -830,8 +837,19 @@ class _StructuralSystem(ArchComponent.Component): import DraftGeomUtils pts = [] if len(obj.Axes) == 1: - for e in obj.Axes[0].Shape.Edges: - pts.append(e.Vertexes[0].Point) + if hasattr(obj,"Align"): + if obj.Align == True : + p0 = obj.Axes[0].Shape.Edges[0].Vertexes[1].Point + for e in obj.Axes[0].Shape.Edges: + p = e.Vertexes[1].Point + p = p.sub(p0) + pts.append(p) + else: + for e in obj.Axes[0].Shape.Edges: + pts.append(e.Vertexes[0].Point) + else: + for e in obj.Axes[0].Shape.Edges: + pts.append(e.Vertexes[0].Point) elif len(obj.Axes) >= 2: set1 = obj.Axes[0].Shape.Edges set2 = obj.Axes[1].Shape.Edges