How to launch a macro from 3d view "right click menu".

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:

How to launch a macro from 3d view "right click menu".

Post by onekk »

Hello, A little question, how to add a menu item in 3d view "right click menu" to launch a Macro.

I've found this very useful macro:

https://wiki.freecadweb.org/Macro_SimpleProperties

And it very useful. (FCInfo Macro is super cool, but it is too crowded of infos).

Now it is annoying to select the macro in the Macros menu item and launch it.

It would be very useful to have it on 3D view "right click menu", there is a way to do so.

And if there is no way, it will be very useful to permit a suer to do such things, through the user customization interface, like as possible now with toolbars.

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/
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: How to launch a macro from 3d view "right click menu".

Post by adrianinsaval »

it might be possible with a script (and you could place the script in a Mod folder so it get's executed every time). Closest already coded alternative I can think of is using Pie Menu addon and adding the macro there.
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: How to launch a macro from 3d view "right click menu".

Post by onekk »

adrianinsaval wrote: Thu Jan 20, 2022 1:52 pm it might be possible with a script (and you could place the script in a Mod folder so it get's executed every time). Closest already coded alternative I can think of is using Pie Menu addon and adding the macro there.
Thanks, have you an idea what command is used to add the content to the "right click menu".

I have seen that part Wb add many items to the "right click menu" ideally it will be put here, so when I select and edge, I could obtain length of the edge.

And maybe if the edge is has a Curve some info about center, curvature and radius in case of circles.

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