Small fix to Draft SVG

+ fixed the location of the getrgb() function
This commit is contained in:
Yorik van Havre 2012-02-16 08:49:13 -02:00
parent d23f9a854e
commit cda83bbd13

View File

@ -871,18 +871,6 @@ 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()
@ -1057,6 +1045,18 @@ def getSVG(obj,modifier=100,textmodifier=100,linestyle="continuous",fillstyle="s
plane = WorkingPlane.plane()
plane.alignToPointAndAxis(Vector(0,0,0),fcvec.neg(direction),0)
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 getProj(vec):
if not plane: return vec
nx = fcvec.project(vec,plane.u)