Sketcher - improve scripting ability?

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Sketcher - improve scripting ability?

Post by onekk »

Hello.

Sketcher is not very scriptable, many useful things are encapsulated in the code and not accessible by the API.

As example if you wnat to make a rectangle, you have to trace all the lines and then connect them using constraints, a

Code: Select all

Sketcher.makeRectangle(lengt, height, center)
will be useful, and maybe even a makePolygon would be useful, or some other "helper methods"

not to crowd too much the methods, but probably they could be made accessible with little modifications, sadly I don't know how to code in C++, to make some example of what I intend.

Luckily "command echo" in Python Console is helping to script in a decent way.

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/
Post Reply