Scripting Path workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Posts: 44
- Joined: Mon Aug 28, 2017 10:11 am
Scripting Path workbench
Hi,
I want to generate G-code from an in Script created Object (an Plate with Text as Pocket).
But i find no Documentation how to generate the "Path Operation" and the "Profile based on Faces"
best regards
Christian
I want to generate G-code from an in Script created Object (an Plate with Text as Pocket).
But i find no Documentation how to generate the "Path Operation" and the "Profile based on Faces"
best regards
Christian
-
- Posts: 44
- Joined: Mon Aug 28, 2017 10:11 am
Re: Scripting Path workbench
Hi, in meantime ive get an patially working Solution in this German Thread: https://forum.freecadweb.org/viewtopic. ... 45#p378645
But i have at time no working Solution to Create an Tool definition and Assign Tools to Path Operations, has anyone an clue how that can be done in an python script ?
But i have at time no working Solution to Create an Tool definition and Assign Tools to Path Operations, has anyone an clue how that can be done in an python script ?
Re: Scripting Path workbench
This is how I create a PathCustom and assign it to a job and toolcontroller. You should be able to modify it to do what you need.
edit: This just assigns the first active tool. Not sure about creating a new one.
Code: Select all
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", "Custom")
PathScripts.PathCustom.ObjectCustom(obj)
obj.ViewObject.Proxy = 0
obj.Gcode = gcode
PathScripts.PathUtils.addToJob(obj)
obj.ToolController = PathScripts.PathUtils.findToolController(obj)
-
- Posts: 44
- Joined: Mon Aug 28, 2017 10:11 am
Re: Scripting Path workbench
Ive found an solution i can Create an TC with
And Assign with
Code: Select all
drill1mm = Path.Tool("1mm Endmill",tooltype="EndMill",diameter=1)
tc1mm = PathToolController.Create('drill1mm', tool=drill1mm)
Code: Select all
FontCut.ToolController = tc1mm
-
- Posts: 20
- Joined: Sat Oct 03, 2020 12:28 pm
Re: Scripting Path workbench
How you created a job using python.etrombly wrote: ↑Fri Mar 20, 2020 4:13 pm This is how I create a PathCustom and assign it to a job and toolcontroller. You should be able to modify it to do what you need.
edit: This just assigns the first active tool. Not sure about creating a new one.Code: Select all
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", "Custom") PathScripts.PathCustom.ObjectCustom(obj) obj.ViewObject.Proxy = 0 obj.Gcode = gcode PathScripts.PathUtils.addToJob(obj) obj.ToolController = PathScripts.PathUtils.findToolController(obj)
-
- Posts: 20
- Joined: Sat Oct 03, 2020 12:28 pm
Re: Scripting Path workbench
Hi, how you created the job using python command. Could you help me please?. Its dor my project. I have to automate the path process.etrombly wrote: ↑Fri Mar 20, 2020 4:13 pm This is how I create a PathCustom and assign it to a job and toolcontroller. You should be able to modify it to do what you need.
edit: This just assigns the first active tool. Not sure about creating a new one.Code: Select all
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", "Custom") PathScripts.PathCustom.ObjectCustom(obj) obj.ViewObject.Proxy = 0 obj.Gcode = gcode PathScripts.PathUtils.addToJob(obj) obj.ToolController = PathScripts.PathUtils.findToolController(obj)
Re: Scripting Path workbench
I haven't created a job with python before. It would be something along the lines of:
That was giving me an error, but is pretty close to what you would need to do. Maybe someone else that has tried it before can help more.
Code: Select all
from PathScripts import PathJob
job = PathJob.create("job_name", "model_object")
Re: Scripting Path workbench
Any update on this issue? Have exactly the same problem creating a path job via python
Re: Scripting Path workbench
Please describe in detail what you have tried, and where it fails and what is the result.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Scripting Path workbench
Thank you for the query. I have no problems after realizing how a path job is basically createdPlease describe in detail what you have tried, and where it fails and what is the result.
Code: Select all
import PathScripts.PathJob as PathJob
PathJob.Create(name, base)
Some more end user documentation on the subject would be appreciated. But so far I'm getting by.