First attempt at support for CSG text command
This commit is contained in:
parent
f944ab3846
commit
b5826607d9
BIN
src/Mod/OpenSCAD/.OpenSCAD2Dgeom.py.swp
Normal file
BIN
src/Mod/OpenSCAD/.OpenSCAD2Dgeom.py.swp
Normal file
Binary file not shown.
BIN
src/Mod/OpenSCAD/.OpenSCADUtils.py.swp
Normal file
BIN
src/Mod/OpenSCAD/.OpenSCADUtils.py.swp
Normal file
Binary file not shown.
|
@ -117,7 +117,7 @@ def insert(filename,docname):
|
||||||
def processcsg(filename):
|
def processcsg(filename):
|
||||||
global doc
|
global doc
|
||||||
|
|
||||||
if printverbose: print 'ImportCSG Version 0.5d'
|
if printverbose: print 'ImportCSG Version 0.6a'
|
||||||
# Build the lexer
|
# Build the lexer
|
||||||
if printverbose: print 'Start Lex'
|
if printverbose: print 'Start Lex'
|
||||||
lex.lex(module=tokrules)
|
lex.lex(module=tokrules)
|
||||||
|
@ -233,6 +233,7 @@ def p_part(p):
|
||||||
| cube_action
|
| cube_action
|
||||||
| circle_action
|
| circle_action
|
||||||
| square_action
|
| square_action
|
||||||
|
| text_action
|
||||||
| polygon_action_nopath
|
| polygon_action_nopath
|
||||||
| polygon_action_plus_path
|
| polygon_action_plus_path
|
||||||
| polyhedron_action
|
| polyhedron_action
|
||||||
|
@ -424,6 +425,7 @@ def p_keywordargument(p):
|
||||||
| ID EQ size_vector
|
| ID EQ size_vector
|
||||||
| ID EQ vector
|
| ID EQ vector
|
||||||
| ID EQ 2d_point
|
| ID EQ 2d_point
|
||||||
|
| text EQ stripped_string
|
||||||
| ID EQ stripped_string
|
| ID EQ stripped_string
|
||||||
'''
|
'''
|
||||||
p[0] = (p[1],p[3])
|
p[0] = (p[1],p[3])
|
||||||
|
@ -701,6 +703,18 @@ def process_mesh_file(fname,ext):
|
||||||
obj.Shape=Part.Compound([])
|
obj.Shape=Part.Compound([])
|
||||||
return(obj)
|
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 processDXF(fname,layer):
|
def processDXF(fname,layer):
|
||||||
global doc
|
global doc
|
||||||
global pathName
|
global pathName
|
||||||
|
@ -1008,7 +1022,32 @@ def p_square_action(p) :
|
||||||
if p[3]['center']=='true' :
|
if p[3]['center']=='true' :
|
||||||
center(mysquare,x,y,0)
|
center(mysquare,x,y,0)
|
||||||
p[0] = [mysquare]
|
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 convert_points_list_to_vector(l):
|
def convert_points_list_to_vector(l):
|
||||||
v = []
|
v = []
|
||||||
for i in l :
|
for i in l :
|
||||||
|
|
|
@ -41,6 +41,7 @@ reserved = (
|
||||||
'false',
|
'false',
|
||||||
'circle',
|
'circle',
|
||||||
'square',
|
'square',
|
||||||
|
'text',
|
||||||
'polygon',
|
'polygon',
|
||||||
'paths',
|
'paths',
|
||||||
'points',
|
'points',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user