how to control grid behaviour?

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
teobo
Posts: 410
Joined: Fri Feb 21, 2014 11:23 am

Re: how to control grid behaviour?

Post by teobo »

yorik wrote:Inside the python code, you can use FreeCADGui.doCommand() to print & execute code in the python window. If you search in Draft and Arch modules it is used everywhere. That command is defined IIRC in src/Gui/Applicationpy.cpp

But in the C++ code there are two methods, one for App commands and another for Gui commands. This is important because the macro recording stuff must be able to differentiate. So the first thing that must be done is implement a doGuiCommand() or something like that in C++, then use it in python code for Gui operations.
Thank that will do.

The transitions from cpp to python or reverse I can not yet oversee. Is it that _all_ missing docommand feature is due to the rather more complex issue of your second paragraph?
What is about for example with toggle Grid menu entry;does it points to cpp or to python code?
Tia
User avatar
yorik
Founder
Posts: 13664
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: how to control grid behaviour?

Post by yorik »

Yes. Once that command is done, we can simply convert the needed code using FreeCADGui.doGuiCommand().
I openend an issue on the tracker for this: issue #1564
User avatar
teobo
Posts: 410
Joined: Fri Feb 21, 2014 11:23 am

Re: how to control grid behaviour?

Post by teobo »

Ok, then mtost lately I will see in the diffs what was needed to change that.
User avatar
teobo
Posts: 410
Joined: Fri Feb 21, 2014 11:23 am

Re: how to control grid behaviour?

Post by teobo »

Add python function for GUI verison of Command::doCommand
I must state that I do not understand that very well. Sound like freecad internal.

And would like to add that even more importantly the workplane dialog needed a docommand print out, - as often during the work with the gui crashes and then one had ad least fixed the procedure by scripting. And it makes the work easy and controlled, if one can assign - on the fly - a defined workplane.
Post Reply