Code: Select all
Gui.Selection.clearSelection()
for obj in FreeCAD.ActiveDocument.Objects:
if obj.ViewObject.isVisible():
Gui.Selection.addSelection(obj)
How is it possible to add such an python command to the Main FreeCAD Gui as a new entry in Edit --> select all visible just under select all. Where do I have to look for this or is it not possible to add a command by python to the FreeCAD GUI. I had a look but I have done only very rare development outside FEM or Arch module and never anything in FreeCAD Gui.yorik wrote:Not that I know of, but it's easy to do with a little macro (code below might contain syntax errors):Code: Select all
Gui.Selection.clearSelection() for obj in FreeCAD.ActiveDocument.Objects: if obj.ViewObject.isVisible(): Gui.Selection.addSelection(obj)
There is no proper solution to customize the menus. You can try to use Qt stuff to access the menu and manipulate it but as soon as you switch to another workbench your changes might be lost again. The only customization that we actively support is adding your own additional toolbars. Then you can write a macro and bind it to a command and use this command in a custom toolbar.How is it possible to add such an python command to the Main FreeCAD Gui as a new entry in Edit --> select all visible just under select all. Where do I have to look for this or is it not possible to add a command by python to the FreeCAD GUI.
Code: Select all
def r(*arg):
FreeCAD.Console.PrintMessage("You will update your menues here")
t=Gui.getMainWindow()
t.workbenchActivated.connect(r)