Recent Several Sketcher improvements

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

Re: Recent Several Sketcher improvements

Postby vocx » Wed Jan 29, 2020 6:28 pm

shadybob wrote:
Wed Jan 29, 2020 1:43 pm
...
Is it possible to do all this using only python? Where would I start?
You could add such tools to Draft Workbench which is entirely made in Python.

But you'd need to understand a bit how to access and manipulate topological shapes, and how to do mathematical transformations like rotations or changing placements. All Draft objects can be converted to Sketch objects using Draft_Draft2Sketch.

For example, see how the rectangle class is implemented. https://github.com/FreeCAD/FreeCAD/blob ... 4168-L4253

Also, there are two things, one is the internal rectangle class, and the other is the graphical rectangle tool, the latter meaning clicking on a button and dragging a mouse to create the rectangle. What you describe sounds like you would like to improve the graphical command, not the internal class.

The graphical command is a "GuiCommand" (Draft_Rectangle). https://github.com/FreeCAD/FreeCAD/blob ... 1020-L1138
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.