Roy_043 wrote: ↑Wed Sep 28, 2022 7:49 am This works:Code: Select all
eval(compile(FreeCAD.activeDocument().getObject("Text_document").Text, "<string>", "exec"))
Add an option to incorporate Macro in the CAD file
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
- adrianinsaval
- Veteran
- Posts: 5541
- Joined: Thu Apr 05, 2018 5:15 pm
Re: Add an option to incorporate Macro in the CAD file
One could just include these instructions as a comment at the beginning of the text
Last edited by adrianinsaval on Wed Sep 28, 2022 3:48 pm, edited 1 time in total.
Re: Add an option to incorporate Macro in the CAD file
Nice!Roy_043 wrote: ↑Wed Sep 28, 2022 7:49 am This works:Code: Select all
eval(compile(FreeCAD.activeDocument().getObject("Text_document").Text, "<string>", "exec"))
I had a simple example of such workflows width "scripted modeling" here https://forum.freecadweb.org/viewtopic. ... 96#p476096, check also some of the more advanced examples done in a similar way in catia by mansu kim, following the link to his youtube in that post...
Re: Add an option to incorporate Macro in the CAD file
What example, could you please explain not using a youtube video?saso wrote: ↑Wed Sep 28, 2022 1:45 pm ...
I had a simple example of such workflows width "scripted modeling" here https://forum.freecadweb.org/viewtopic. ... 96#p476096...
Regards
Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
Re: Add an option to incorporate Macro in the CAD file
My simple example is in the Scripts_in_Model.FCStd file attached to that post, where a script inside the model is used to "study" the profile sections at different positions... But obviously much much more can be done with this and some of the videos show some more advanced examples... Maybe we could try to recreate some in FC
Last edited by saso on Wed Sep 28, 2022 4:26 pm, edited 1 time in total.
Re: Add an option to incorporate Macro in the CAD file
Maybe!
It is not too difficult, even creating them as a FCStd document, probably some helpers methods should be created, but I've already done something similar for Assembly4, maybe see:
https://forum.freecadweb.org/viewtopic. ... 24#p628824
Regards
Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/