diff --git a/src/Mod/Arch/ArchSectionPlane.py b/src/Mod/Arch/ArchSectionPlane.py
index d4e8b02bb2..f4c936635d 100644
--- a/src/Mod/Arch/ArchSectionPlane.py
+++ b/src/Mod/Arch/ArchSectionPlane.py
@@ -21,7 +21,7 @@
#* *
#***************************************************************************
-import FreeCAD,ArchComponent,WorkingPlane,math,Draft,ArchCommands,DraftVecUtils
+import FreeCAD,WorkingPlane,math,Draft,ArchCommands,DraftVecUtils
from FreeCAD import Vector
if FreeCAD.GuiUp:
import FreeCADGui
@@ -122,7 +122,7 @@ class _SectionPlane:
if state:
self.Type = state
-class _ViewProviderSectionPlane(ArchComponent.ViewProviderComponent):
+class _ViewProviderSectionPlane:
"A View Provider for Section Planes"
def __init__(self,vobj):
vobj.addProperty("App::PropertyLength","DisplaySize","Arch",translate("Arch","The display size of this section plane"))
@@ -399,7 +399,7 @@ class _ArchDrawingView:
result += ' transform="'
result += 'rotate('+str(obj.Rotation)+','+str(obj.X)+','+str(obj.Y)+') '
result += 'translate('+str(obj.X)+','+str(obj.Y)+') '
- result += 'scale('+str(obj.Scale)+','+str(-obj.Scale)+')'
+ result += 'scale('+str(obj.Scale)+','+str(obj.Scale)+')'
result += '">\n'
result += svg
result += '\n'
diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py
index a832f7c71e..512001b808 100644
--- a/src/Mod/Draft/Draft.py
+++ b/src/Mod/Draft/Draft.py
@@ -1539,8 +1539,8 @@ def draftify(objectslist,makeblock=False,delete=True):
return newobjlist[0]
return newobjlist
-def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direction=None,linestyle=None):
- '''getSVG(object,[scale], [linewidth],[fontsize],[fillstyle],[direction],[linestyle]):
+def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direction=None,linestyle=None,color=None):
+ '''getSVG(object,[scale], [linewidth],[fontsize],[fillstyle],[direction],[linestyle],[color]):
returns a string containing a SVG representation of the given object,
with the given linewidth and fontsize (used if the given object contains
any text). You can also supply an arbitrary projection vector. the
@@ -1558,6 +1558,12 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
plane.alignToPointAndAxis_SVG(Vector(0,0,0),direction.negative().negative(),0)
elif isinstance(direction,WorkingPlane.plane):
plane = direction
+ stroke = "#000000"
+ if color:
+ stroke = getrgb(color)
+ elif gui:
+ if hasattr(obj.ViewObject,"LineColor"):
+ stroke = getrgb(obj.ViewObject.LineColor)
def getLineStyle():
"returns a linestyle"
@@ -1673,14 +1679,14 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
if obj.ViewObject.ArrowType == "Circle":
svg += '\n'
elif obj.ViewObject.ArrowType == "Dot":
svg += '\n'
@@ -1689,7 +1695,7 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
svg += ','+ str(point.x) + ',' + str(point.y) + ') '
svg += 'translate(' + str(point.x) + ',' + str(point.y) + ') '
svg += 'scale('+str(arrowsize)+','+str(arrowsize)+')" freecad:skip="1" '
- svg += 'fill="'+ getrgb(color) +'" stroke="none" '
+ svg += 'fill="'+ color +'" stroke="none" '
svg += 'style="stroke-miterlimit:4;stroke-dasharray:none" '
svg += 'd="M 0 0 L 4 1 L 4 -1 Z"/>\n'
else:
@@ -1698,7 +1704,7 @@ def getSVG(obj,scale=1,linewidth=0.35,fontsize=12,fillstyle="shape color",direct
def getText(color,fontsize,fontname,angle,base,text):
svg = ' 1:
wiredEdges = []
@@ -1987,9 +1972,12 @@ def makeDrawingView(obj,page,lwmod=None,tmod=None):
viewobj = FreeCAD.ActiveDocument.addObject("Drawing::FeatureViewPython","View"+obj.Name)
_DrawingView(viewobj)
page.addObject(viewobj)
- viewobj.Scale = page.ViewObject.HintScale
- viewobj.X = page.ViewObject.HintOffsetX
- viewobj.Y = page.ViewObject.HintOffsetY
+ if hasattr(page.ViewObject,"HintScale"):
+ viewobj.Scale = page.ViewObject.HintScale
+ if hasattr(page.ViewObject,"HintOffsetX"):
+ viewobj.X = page.ViewObject.HintOffsetX
+ if hasattr(page.ViewObject,"HintOffsetY"):
+ viewobj.Y = page.ViewObject.HintOffsetY
viewobj.Source = obj
if lwmod: viewobj.LineweightModifier = lwmod
if tmod: viewobj.TextModifier = tmod
@@ -1998,6 +1986,10 @@ def makeDrawingView(obj,page,lwmod=None,tmod=None):
viewobj.FillStyle = str(obj.ViewObject.Pattern)
if hasattr(obj.ViewObject,"DrawStyle"):
viewobj.LineStyle = obj.ViewObject.DrawStyle
+ if hasattr(obj.ViewObject,"LineColor"):
+ viewobj.LineColor = obj.ViewObject.LineColor
+ elif hasattr(obj.ViewObject,"TextColor"):
+ viewobj.LineColor = obj.ViewObject.TextColor
return viewobj
def makeShape2DView(baseobj,projectionVector=None,facenumbers=[]):
@@ -3940,6 +3932,7 @@ class _DrawingView(_DraftObject):
obj.addProperty("App::PropertyVector","Direction","Shape View","Projection direction")
obj.addProperty("App::PropertyFloat","LineWidth","View Style","The width of the lines inside this object")
obj.addProperty("App::PropertyLength","FontSize","View Style","The size of the texts inside this object")
+ obj.addProperty("App::PropertyColor","LineColor","View Style","The color of the projected objects")
obj.addProperty("App::PropertyLink","Source","Base","The linked object")
obj.addProperty("App::PropertyEnumeration","FillStyle","View Style","Shape Fill Style")
obj.addProperty("App::PropertyEnumeration","LineStyle","View Style","Line Style")
@@ -3956,15 +3949,19 @@ class _DrawingView(_DraftObject):
ls = obj.LineStyle
else:
ls = None
+ if hasattr(obj,"LineColor"):
+ lc = obj.LineColor
+ else:
+ lc = None
if obj.Source.isDerivedFrom("App::DocumentObjectGroup"):
svg = ""
shapes = []
others = []
for o in obj.Source.Group:
if o.ViewObject.isVisible():
- svg += getSVG(o,obj.Scale,obj.LineWidth,obj.FontSize.Value,obj.FillStyle,obj.Direction,ls)
+ svg += getSVG(o,obj.Scale,obj.LineWidth,obj.FontSize.Value,obj.FillStyle,obj.Direction,ls,lc)
else:
- svg = getSVG(obj.Source,obj.Scale,obj.LineWidth,obj.FontSize.Value,obj.FillStyle,obj.Direction,ls)
+ svg = getSVG(obj.Source,obj.Scale,obj.LineWidth,obj.FontSize.Value,obj.FillStyle,obj.Direction,ls,lc)
result += '