-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Part: allow installing attacher extension on demand #3811
Conversation
Do not query linked object if the owner object has property with the given name.
I will test it before stating for sure, but i'm afraid there will be recompute issues because positionBySupport may not be called by object's Also, there is a bunch of unreachable code left by this change in TaskAttachmentEditor.py, soon after the code that adds the extension, where a message pops up saying the object is not attachable and thus will not be parametric. Basically, the whole |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When attachengine is installed on objects that don't expect it, attachment is not updating properly.
Example.
- make Part Cube, Cylinder and Sphere
- fuse cube and sphere
- select fusion, menu Part->Attachment. Attach to Cylinder in some way. OK.
- move cylinder
->fusion does not follow. Though it snaps into place as soon as I touch any attachment-related property.
Yeah, that's because Fusion does not call it's parent execute(), so no triggering of extensionExecute() in AttachExtension, like you said. The way I see it. Unless there is real harm, like crash or something, I don't see any problem enabling AttachExtension on demand. If the user finds out that some object with the extension does not working and report it, then we can fix it. Like the Fusion here. If some object is really not meant to have AttachExtension, then we can filter it in TaskAttachment.py here. Or maybe make ExtensionContainer::registerExtension() virtual, and let each object decide. |
To support extensions, e.g. AttachExtension
5bf3114
to
e26bba9
Compare
Thanks! |
I added code to handle exception when calling |
Some remarks:
|
There is one little problem with it: should extensions be executed before or after object's execute? What if the object needs it in the middle? |
It feels like a bit redundant. Because the intention of clicking that command is to use the attacher, the user will almost always say yes, unless we put some scary warning message in the dialog. A better way would be to make it possible to undo extension insertion, but that would be another topic. Anway, for attach extension in particular, I don't see any harm in adding it. Because if it has any ill effect, the user can always turn it off completely.
But the one in property editor is only available if the object has already installed attacher extension? I am not sure though. Looks like PropertyEnumAttacherItem is only used by AttachExtension.
Yeah, I have the same concern as DeepSOIC. No idea how to solve it yet. |
In the ExtensionContainer class we have the same situation that the extension methods are executed either before or after the methods of the base class -- so not much flexibility. But so far we never had a problem this way.
First of all, do we have consensus about to by default always call the extensionExecute() methods when recomputing a feature?
The flexibility you want is very easy to achieve: the method that invokes execute() is called recompute() and this is also a virtual method. So, e.g. the SketchObject class only has to override recompute() and first calls extensionExecute() and afterwards its actual execute() method.
Hmm, good question. I recently tested your PR with the example uploaded in the forum. By using the attachment dialog via property editor I never got it working as expected and it took me a while until I figured out to call the command from the menu. I will have a look again... |
One can:
the only inflexibility i see now is if there is a need to call superclass's execute but not let it execute extensions, there is no way to do it other than copy-pasting super's execute code with slight edits. Doesn't sound like a very big deal.
Okay =) |
Merged. The first commit has been added as it is: c5ce992 This way we don't have to care about implementation details of the execute() function of subclasses (e.g. SketchObject). |
Forum thread: https://forum.freecadweb.org/viewtopic.php?f=3&t=49464&sid=240cd565d4d4b079ad7297af6cf1b531