Tidy up of text command support
This commit is contained in:
parent
b4020f2cc8
commit
e0b9e29db9
|
@ -603,7 +603,8 @@ def process_linear_extrude(obj,h) :
|
|||
mylinear.Base = newobj #obj
|
||||
mylinear.Dir = (0,0,h)
|
||||
mylinear.Placement=FreeCAD.Placement()
|
||||
mylinear.Solid = True
|
||||
# V17 change to False mylinear.Solid = True
|
||||
mylinear.Solid = False
|
||||
if gui:
|
||||
newobj.ViewObject.hide()
|
||||
return(mylinear)
|
||||
|
@ -703,18 +704,21 @@ def process_mesh_file(fname,ext):
|
|||
obj.Shape=Part.Compound([])
|
||||
return(obj)
|
||||
|
||||
|
||||
def processTextCmd(t):
|
||||
import os
|
||||
from OpenSCADUtils import callopenscadstring
|
||||
tmpfilename = callopenscadstring(t,'dxf')
|
||||
obj=processDXF(os.path.splitext(tmpfilename)[0],"")
|
||||
try:
|
||||
os.unlink(tmpfilename)
|
||||
except OSError:
|
||||
pass
|
||||
return(obj)
|
||||
|
||||
|
||||
def processTextCmd(t):
|
||||
import os
|
||||
from OpenSCADUtils import callopenscadstring
|
||||
tmpfilename = callopenscadstring(t,'dxf')
|
||||
from OpenSCAD2Dgeom import importDXFface
|
||||
face = importDXFface(tmpfilename,None,None)
|
||||
obj=doc.addObject('Part::Feature','text')
|
||||
obj.Shape=face
|
||||
try:
|
||||
os.unlink(tmpfilename)
|
||||
except OSError:
|
||||
pass
|
||||
return(obj)
|
||||
|
||||
def processDXF(fname,layer):
|
||||
global doc
|
||||
global pathName
|
||||
|
@ -1022,32 +1026,32 @@ def p_square_action(p) :
|
|||
if p[3]['center']=='true' :
|
||||
center(mysquare,x,y,0)
|
||||
p[0] = [mysquare]
|
||||
|
||||
def addString(t,s,p):
|
||||
return(t + ', ' +s+' = "'+p[3][s]+'"')
|
||||
|
||||
def addValue(t,v,p):
|
||||
return(t + ', ' +v+' = '+p[3][v])
|
||||
|
||||
def p_text_action(p) :
|
||||
'text_action : text LPAREN keywordargument_list RPAREN SEMICOL'
|
||||
t = 'text ( text="'+p[3]['text']+'"'
|
||||
t = addValue(t,'size',p)
|
||||
t = addString(t,'spacing',p)
|
||||
t = addString(t,'font',p)
|
||||
t = addString(t,'direction',p)
|
||||
t = addString(t,'language',p)
|
||||
t = addString(t,'script',p)
|
||||
t = addString(t,'halign',p)
|
||||
t = addString(t,'valign',p)
|
||||
t = addValue(t,'$fn',p)
|
||||
t = addValue(t,'$fa',p)
|
||||
t = addValue(t,'$fs',p)
|
||||
t = t+');'
|
||||
|
||||
FreeCAD.Console.PrintMessage("textmsg : "+t+"\n")
|
||||
p[0] = [processTextCmd(t)]
|
||||
|
||||
|
||||
def addString(t,s,p):
|
||||
return(t + ', ' +s+' = "'+p[3][s]+'"')
|
||||
|
||||
def addValue(t,v,p):
|
||||
return(t + ', ' +v+' = '+p[3][v])
|
||||
|
||||
def p_text_action(p) :
|
||||
'text_action : text LPAREN keywordargument_list RPAREN SEMICOL'
|
||||
t = 'text ( text="'+p[3]['text']+'"'
|
||||
t = addValue(t,'size',p)
|
||||
t = addString(t,'spacing',p)
|
||||
t = addString(t,'font',p)
|
||||
t = addString(t,'direction',p)
|
||||
t = addString(t,'language',p)
|
||||
t = addString(t,'script',p)
|
||||
t = addString(t,'halign',p)
|
||||
t = addString(t,'valign',p)
|
||||
t = addValue(t,'$fn',p)
|
||||
t = addValue(t,'$fa',p)
|
||||
t = addValue(t,'$fs',p)
|
||||
t = t+');'
|
||||
|
||||
FreeCAD.Console.PrintMessage("textmsg : "+t+"\n")
|
||||
p[0] = [processTextCmd(t)]
|
||||
|
||||
def convert_points_list_to_vector(l):
|
||||
v = []
|
||||
for i in l :
|
||||
|
|
Loading…
Reference in New Issue
Block a user