Select all visible objects by GUI tool
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
Select all visible objects by GUI tool
Is theres some GUI tool in FreeCAD to select all visible objects ? If ctrl->A is used all objects are selected!
Re: Select all visible objects by GUI tool
I know there is an additional Edit -> Select all option.
Re: Select all visible objects by GUI tool
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)
Re: Select all visible objects by GUI tool
I see i was too quick as i thought you are after GUI counterpart for CTRL +A (instead you where just after visible objects).
Re: Select all visible objects by GUI tool
The Box Selection (Shift+B) should do it ?
Re: Select all visible objects by GUI tool
Thanks guys for your help.
Bernd
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)
Bernd
Re: Select all visible objects by GUI tool
Hello Bernd,
here the simplest way to obtain a system command:
http://www.freecadweb.org/wiki/index.ph ... e_Toolbars
Valerio
here the simplest way to obtain a system command:
http://www.freecadweb.org/wiki/index.ph ... e_Toolbars
Valerio
Re: Select all visible objects by GUI tool
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.
But I think we can write a proper C++ command for this and add it to the Visibility sub-menu under View.
- microelly2
- Veteran
- Posts: 4688
- Joined: Tue Nov 12, 2013 4:06 pm
- Contact:
Re: Select all visible objects by GUI tool
You can connect the workbench change with your own menu-update method
Code: Select all
def r(*arg):
FreeCAD.Console.PrintMessage("You will update your menues here")
t=Gui.getMainWindow()
t.workbenchActivated.connect(r)
Re: Select all visible objects by GUI tool
On a slightly unrelated note i have created AccessoriesMenu module i plan to release in the future. I have around 30% work left to do for the first release. ETA was December 2016 but it looks like January 2017 will be it. It adds additional Accessories menu entry at the bottom of the Tools menu. One use case for it is it can be used for adding commands to it.
But there is another problem involved. If you want to add a Python command to it and for the command to be there when you open the menu command must exist first. And this isn't how FreeCAD works. FreeCAD works in a way you add Python command to a workbench and only after the workbench is loaded command is available.
Therefore for adding and using Python command in all workbenches 2 things would need to happen.
One is the mentioned work on adding some support to menubar. And another is to have a standard way to load FreeCAD command when FreeCAD loads. And not only after the workbench that has a command in it is loaded. The solution i plan to offer is Autoload (as seen in TabBar) and AccessoriesMenu module. Likely not 100% perfect but it does the job and offers more choice compared to the choice the user/dev has ATM.
But there is another problem involved. If you want to add a Python command to it and for the command to be there when you open the menu command must exist first. And this isn't how FreeCAD works. FreeCAD works in a way you add Python command to a workbench and only after the workbench is loaded command is available.
Therefore for adding and using Python command in all workbenches 2 things would need to happen.
One is the mentioned work on adding some support to menubar. And another is to have a standard way to load FreeCAD command when FreeCAD loads. And not only after the workbench that has a command in it is loaded. The solution i plan to offer is Autoload (as seen in TabBar) and AccessoriesMenu module. Likely not 100% perfect but it does the job and offers more choice compared to the choice the user/dev has ATM.