Recently i get a weird behavior while working with PartDesign. On every new function, the task dialog does not start, but when doubleclick on the feature in the tree, the task dialog works fine. The issue seems, that while starting a new function, that an error occurs.
Example:
2023-06-17 19-21.webm
Here it refuse to start the sketcher properly and refuses to start the pocket task dialog. While starting the sketch i get:
<Gui> Document.cpp(384): Invalid sub object 'Yoke#Part.Body.Sketch001.Body.'
and while starting the pocket i get:
<Gui> Document.cpp(384): Invalid sub object 'Yoke#Part.Body.Pocket.Body.'
error messages.
File:
Yoke.FCStd
Version (fresh build clean from scratch):
confirmed, interestingly, it works on first try but if you try activating the body and then creating a sketch it doesn’t here’s steps to reproduce from scratch:
-new document
-create Part
-create Body (body is automatically placed inside Part), however it is not highlighted as activated
(if you try now to create a sketch in this moment it works without problems)
-double click on Body to activate it
-attempt creating a sketch on body (or launch any PD task really), the task is not launched and the error shown in report view
14:57:31 <Gui> Document.cpp(385): Invalid sub object 'Unnamed#Part.Body.Box.Body.'
-create Body (body is automatically placed inside Part), however it is not highlighted as activated
When creating the Body then it IS highlighted and it IS activated. To reproduce the problem described by the OP I have to manually deactivate the Body before creating the sketch.
What happens is that
auto activeBody = activeView->getActiveObject<PartDesign::Body*>(PDBODYKEY,&parent,&subname);
unexpectedly sets subname to “Body”. Afterwards when calling getParent() then the string “Body.Sketch.” is prepended and “.” appended which results into the incorrect subname “Body.Sketch001.Body.”.
Fixing the issues is easy: before calling getParent() the string subname must be cleared.