Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # parsing FreeCAD Path Objects
- import FreeCAD
- import FreeCADGui as Gui
- obj = Gui.Selection.getSelection()[0] #select the PathProject
- outlist = ""
- for g in obj.Group:
- if hasattr(g, "Fixture"):
- if g.TypeId == "Path::FeatureCompound":
- for c in g.Path.Commands:
- if c.Name == "M6":
- outlist +="LOADTL/"+ str(int(c.Parameters['T']))+ "\n"
- if (c.Name == "G0") or (c.Name == "G1"):
- if (c.Name == "G0"):
- outlist +="RAPID\n"
- outlist +="GOTO/"
- if 'X' in c.Parameters:
- outlist +='X'+ str(c.Parameters['X'])
- if 'Y' in c.Parameters:
- outlist +='Y'+ str(c.Parameters['Y'])
- if 'Z' in c.Parameters:
- outlist +='Z'+ str(c.Parameters['Z'])
- outlist +='\n'
- elif (c.Name == "G2") or (c.Name == "G3"):
- outlist +="CIRCLE/"
- outlist +='\n'
- lines = outlist.split("\n")
- for l in lines:
- print l
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement