From de50ac9eca03138e6f6ff1e34c902af53f0ab055 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Thu, 5 Apr 2012 18:05:25 -0300 Subject: [PATCH] Preliminary section support for Arch section planes --- src/Mod/Arch/ArchCommands.py | 1 + src/Mod/Arch/ArchSectionPlane.py | 84 +++++++++++++++++++++++++++----- 2 files changed, 72 insertions(+), 13 deletions(-) diff --git a/src/Mod/Arch/ArchCommands.py b/src/Mod/Arch/ArchCommands.py index c3a58174b..b25d0c68f 100644 --- a/src/Mod/Arch/ArchCommands.py +++ b/src/Mod/Arch/ArchCommands.py @@ -205,6 +205,7 @@ def getCutVolume(objects,placement): in the list fits into it, and an extrusion vector, that can be used to extrude the plane so it includes all objects in the list.''' import Part + placement = FreeCAD.Placement(placement) if not objects: return None bb = objects[0].Shape.BoundBox diff --git a/src/Mod/Arch/ArchSectionPlane.py b/src/Mod/Arch/ArchSectionPlane.py index d9f89a6c9..50cc067bf 100644 --- a/src/Mod/Arch/ArchSectionPlane.py +++ b/src/Mod/Arch/ArchSectionPlane.py @@ -21,7 +21,7 @@ #* * #*************************************************************************** -import FreeCAD,FreeCADGui,ArchComponent,WorkingPlane,Drawing,math,Draft +import FreeCAD,FreeCADGui,ArchComponent,WorkingPlane,Drawing,math,Draft,ArchCommands from FreeCAD import Vector from PyQt4 import QtCore from pivy import coin @@ -173,13 +173,34 @@ class _ArchDrawingView: def updateSVG(self, obj): "encapsulates a svg fragment into a transformation node" + import Part + from draftlibs import fcgeo if obj.Source: if obj.Source.Objects: svg = '' + cp = ArchCommands.getCutVolume(obj.Source.Objects,obj.Source.Placement) + print "cp:",cp + sections = [] + if cp: + cutvolume = cp[0].extrude(cp[1]) + shapes = [] + for o in obj.Source.Objects: + if cp: + shapes.append(o.Shape.cut(cutvolume)) + sec = o.Shape.section(cp[0]) + if sec.Edges: + sec = Part.Wire(fcgeo.sortEdges(sec.Edges)) + sec = Part.Face(sec) + sections.append(sec) + else: + shapes.append(o.Shape) if obj.RenderingMode == "Solid": - svg += self.renderVRM(obj.Source.Objects,obj.Source.Placement) + svg += self.renderVRM(shapes,obj.Source.Placement) else: - svg += self.renderOCC(obj.Source.Objects,obj.Source.Proxy.getNormal(obj.Source)) + svg += self.renderOCC(shapes,obj.Source.Proxy.getNormal(obj.Source)) + print "sections:",sections + for s in sections: + svg += self.renderSection(s,obj.Source.Placement) result = '' result += ' 1: + x = -vu.Length + else: + x = vu.Length + vv = fcvec.project(vt.Point,v) + if vv.getAngle(v) > 1: + y = -vv.Length + else: + y = vv.Length + pts.append([x,y]) + svg ='