Code: Select all
x = App.ActiveDocument.getObjectsByLabel('foo')[0]
x.recompute() # <- this doesn't seem to work
Code: Select all
x = App.ActiveDocument.getObjectsByLabel('foo')[0]
x.recompute() # <- this doesn't seem to work
Code: Select all
FreeCADGui.Selection.addSelection(App.ActiveDocument.getObjectsByLabel("Cube")[0])
Yes, but this is actually a dirty workaround in my case. I'm extensively using LinkStage3's Sub-shape Binder to get external geometry into sketches and they (currently) need to be updated by double-clicking on them in some circumstances. I thought I could write a macro that would run on Refresh which would simply double-click on the Sub-shape Binder.Is there a specific double-click action that you would like to trigger?
Hello @DeepSOIC. I have a python object with setEdit method in ViewProvider of object. When I click the object name in Tree View, the appropriate UI opens, but my question is:DeepSOIC wrote: ↑Thu Sep 13, 2018 8:51 pm I'm afraid there is no universal way to simulate a double-click, other than digging out the tree widget, and sending the event to appropriate item.
Is there a specific double-click action that you would like to trigger? For example, for many objects, Gui.ActiveDocument.setEdit('put_your_object_name_here')
is equivalent. For python-powered objects, you can dig out viewprovider proxy and call the corresponding method...
Code: Select all
def setEdit(self, vobj, mode=0):
obj = vobj.Object
ui = Ui(obj)
ui.setupUi()
Gui.Control.showDialog(ui)
return True
def unsetEdit(self, vobj, mode):
Gui.Control.closeDialog()
return
def doubleClicked(self,vobj):
self.setEdit(vobj)
IMO you should not do that as this isn't how FC works and creating inconsistency is rarely a good thing.ebrahim raeyat wrote: ↑Sat Apr 17, 2021 2:50 pm How can I open the same UI, with double-clicking the object in 3D view scene?
Thanks. I am a little confused. The DoubleClick method doesn't execute when double-clicking an object in a 3D scene? Thus, how can I execute it? Thanks.
Thanks, But why I should not do that? I don't know. In most cased the user wants to click on an object in 3D, but with double-clicking in tree view, the user first must click on the object in 3D and then double-click on it in the tree. Because the user doesn't know the name of the object, most of the time.openBrain wrote: ↑Sat Apr 17, 2021 4:13 pmIMO you should not do that as this isn't how FC works and creating inconsistency is rarely a good thing.ebrahim raeyat wrote: ↑Sat Apr 17, 2021 2:50 pm How can I open the same UI, with double-clicking the object in 3D view scene?