From d12fbc632ade36a052ad8cd268b17515b880f6df Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Thu, 19 Apr 2012 20:00:18 -0300 Subject: [PATCH] Arch Vector renderer now supports face colors --- src/Mod/Arch/ArchSectionPlane.py | 45 ++++++++++++------- src/Mod/Arch/ArchVRM.py | 76 +++++++++++++++++++++++++++----- 2 files changed, 92 insertions(+), 29 deletions(-) diff --git a/src/Mod/Arch/ArchSectionPlane.py b/src/Mod/Arch/ArchSectionPlane.py index 50cc067bf..4282d97f6 100644 --- a/src/Mod/Arch/ArchSectionPlane.py +++ b/src/Mod/Arch/ArchSectionPlane.py @@ -157,9 +157,11 @@ class _ViewProviderSectionPlane(ArchComponent.ViewProviderComponent): class _ArchDrawingView: def __init__(self, obj): obj.addProperty("App::PropertyLink","Source","Base","The linked object") - obj.addProperty("App::PropertyEnumeration","RenderingMode","Base","The rendering mode to use") + obj.addProperty("App::PropertyEnumeration","RenderingMode","Drawing View","The rendering mode to use") + obj.addProperty("App::PropertyFloat","LineWidth","Drawing View","The line width of the rendered objects") obj.RenderingMode = ["Solid","Wireframe"] obj.RenderingMode = "Solid" + obj.LineWidth = 0.35 obj.Proxy = self self.Type = "DrawingView" @@ -179,14 +181,18 @@ class _ArchDrawingView: 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 = [] + colors = [] for o in obj.Source.Objects: + color = o.ViewObject.DiffuseColor[0] + print "adding ",o.Name," with color ",color if cp: - shapes.append(o.Shape.cut(cutvolume)) + for s in o.Shape.Solids: + shapes.append(s.cut(cutvolume)) + colors.append(color) sec = o.Shape.section(cp[0]) if sec.Edges: sec = Part.Wire(fcgeo.sortEdges(sec.Edges)) @@ -194,13 +200,14 @@ class _ArchDrawingView: sections.append(sec) else: shapes.append(o.Shape) + colors.append(color) + linewidth = obj.LineWidth/obj.Scale if obj.RenderingMode == "Solid": - svg += self.renderVRM(shapes,obj.Source.Placement) + svg += self.renderVRM(shapes,obj.Source.Placement,colors,linewidth) else: - svg += self.renderOCC(shapes,obj.Source.Proxy.getNormal(obj.Source)) - print "sections:",sections + svg += self.renderOCC(shapes,obj.Source.Proxy.getNormal(obj.Source),linewidth) for s in sections: - svg += self.renderSection(s,obj.Source.Placement) + svg += self.renderSection(s,obj.Source.Placement,linewidth*2) result = '' result += '