diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index 7e1b7ed8bc..b148a74d24 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -871,6 +871,18 @@ def offset(obj,delta,copy=False,bind=False,sym=False,occ=False): import Part from draftlibs import fcgeo + def getrgb(color): + "getRGB(color): returns a rgb value #000000 from a freecad color" + r = str(hex(int(color[0]*255)))[2:].zfill(2) + g = str(hex(int(color[1]*255)))[2:].zfill(2) + b = str(hex(int(color[2]*255)))[2:].zfill(2) + col = "#"+r+g+b + if col == "#ffffff": + print getParam('SvgLinesBlack') + if getParam('SvgLinesBlack'): + col = "#000000" + return col + def getRect(p,obj): "returns length,heigh,placement" pl = obj.Placement.copy() @@ -1024,18 +1036,6 @@ def draftify(objectslist,makeblock=False): return newobjlist[0] return newobjlist -def getrgb(color): - "getRGB(color): returns a rgb value #000000 from a freecad color" - r = str(hex(int(color[0]*255)))[2:].zfill(2) - g = str(hex(int(color[1]*255)))[2:].zfill(2) - b = str(hex(int(color[2]*255)))[2:].zfill(2) - col = "#"+r+g+b - if col == "#ffffff": - print getParam('SvgLinesBlack') - if getParam('SvgLinesBlack'): - col = "#000000" - return col - def getSVG(obj,modifier=100,textmodifier=100,linestyle="continuous",fillstyle="shape color",direction=None): '''getSVG(object,[modifier],[textmodifier],[linestyle],[fillstyle],[direction]): returns a string containing a SVG representation of the given object. the modifier attribute @@ -1082,6 +1082,10 @@ def getSVG(obj,modifier=100,textmodifier=100,linestyle="continuous",fillstyle="s v = getProj(e.Vertexes[-1].Point) svg += 'L '+ str(v.x) +' '+ str(v.y) + ' ' elif isinstance(e.Curve,Part.Circle): + if len(e.Vertexes) == 1: + # complete circle + svg = getCircle(e) + return svg r = e.Curve.Radius drawing_plane_normal = FreeCAD.DraftWorkingPlane.axis if plane: drawing_plane_normal = plane.axis @@ -1102,6 +1106,21 @@ def getSVG(obj,modifier=100,textmodifier=100,linestyle="continuous",fillstyle="s svg += '/>\n' return svg + def getCircle(edge): + cen = getProj(edge.Curve.Center) + rad = edge.Curve.Radius + svg = '