You seemed to have planted this idea in this post:
paullee wrote: ↑Wed Jan 15, 2020 9:51 pm
Thanks mentoring Not directly calling execute() indeed. I have a more general idea about how Link should better working calling methods() in LinkObject below... make sense ? ...
Make sense ?
And should stock Link already can do this instead of making a general LinkPython ?
Then the reply was:
realthunder wrote: ↑Fri Jan 17, 2020 12:30 am
That is actually not a bad idea. I'll add that feature, so that Link's execute() function will search and run python method in linked object with name 'appLinkExecute', passing the linked object and the Link itself as input arguments. For array elements, it will pass two additional parameters as parent link object, and element index. The method will look something like this,
To my understanding, it allow some 'features' of a FeaturePython objects to works in a Link. E.g. I make Arch Windows to auto placing itself to its Host object in a Method. Without the appLinkExecute, its Links would not know it should execute this and the Links would not update its placement likewise.
Realthunder would explain the potential and mechanism in details
To my understanding, it allow some 'features' of a FeaturePython objects to works in a Link. E.g. I make Arch Windows to auto placing itself to its Host object in a Method. Without the appLinkExecute, its Links would not know it should execute this and the Links would not update its placement likewise.
Realthunder would explain the potential and mechanism in details
Yes that's pretty much it. If you are creating a python extension object for your own workbench, you can define a customized behavior when a Link is created and links to your object. You don't need to create yet another python extension for a new type of Link. The default behavior for Link when recomputed is to look for a method called 'appLinkExecute' in the linked object's python extension (i.e. the Proxy object), and execute it if found.
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
realthunder wrote: ↑Wed Mar 24, 2021 3:34 am
Yes that's pretty much it. If you are creating a python extension object for your own workbench, you can define a customized behavior when a Link is created and links to your object. You don't need to create yet another python extension for a new type of Link. The default behavior for Link when recomputed is to look for a method called 'appLinkExecute' in the linked object's python extension (i.e. the Proxy object), and execute it if found.