More helpful "need active body" message
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Be nice to others! Read the FreeCAD code of conduct!
More helpful "need active body" message
I wanted to run a small UI improvement idea I was trying for the PartDesign workbench, and would like some input from the community before spending more time on it. It is intended to make life slightly easier by replacing the dialog box, telling the user there is no active body, with another containing a combo-box with present bodies to make active.
A similar issue is mentioned in an old bug report issue #4288 from March 2020. There the OP's issue seemed to arise from following instructions for an older version of FreeCAD. However I do concur that dialog box could be more useful. Currently, if a user tries to create a part design feature without an active body when there are multiple bodies present, they are presented with an error box like one of the following: Instead, I propose we add a combo-box containing the bodies to the message as follows: The box will also have an option to create a new body and make it active instead.
I have put up the work done so far here: https://github.com/AjinkyaDahale/FreeCA ... e-body-qol.
I spent a few hours putting together the dialog for a new sketch because it was relatively straightforward. However, after changing the dialog box I also had to change the flow of the command so it continues after throwing the dialog and doesn't just return. The "new sketch" command (also the "primitive" command) does not ask the PartDesign::getBody() function to throw the error message, and instead throws it separately. If I wanted to make the change for all other PD features, I suspect I will have to alter the behavior of ALL the commands that use PartDesign::getBody() in order for this to work smoothly, or make changes in the function itself.
So before I proceed further I would like to know if people have any inputs regarding this, either on the new UI or on it's implementation. Please feel free to ask for any clarifications because I might have gone too much into the details of the implementation.
A similar issue is mentioned in an old bug report issue #4288 from March 2020. There the OP's issue seemed to arise from following instructions for an older version of FreeCAD. However I do concur that dialog box could be more useful. Currently, if a user tries to create a part design feature without an active body when there are multiple bodies present, they are presented with an error box like one of the following: Instead, I propose we add a combo-box containing the bodies to the message as follows: The box will also have an option to create a new body and make it active instead.
I have put up the work done so far here: https://github.com/AjinkyaDahale/FreeCA ... e-body-qol.
I spent a few hours putting together the dialog for a new sketch because it was relatively straightforward. However, after changing the dialog box I also had to change the flow of the command so it continues after throwing the dialog and doesn't just return. The "new sketch" command (also the "primitive" command) does not ask the PartDesign::getBody() function to throw the error message, and instead throws it separately. If I wanted to make the change for all other PD features, I suspect I will have to alter the behavior of ALL the commands that use PartDesign::getBody() in order for this to work smoothly, or make changes in the function itself.
So before I proceed further I would like to know if people have any inputs regarding this, either on the new UI or on it's implementation. Please feel free to ask for any clarifications because I might have gone too much into the details of the implementation.
Re: More helpful "need active body" message
If possible I would prefer a list over a drop down menu. But even more important, I would like to see an educated guess which body to activate. With a new sketch or a new primitive no guess can be made and you have of course to ask the user.
But this dialog occurs as well, if a new feature is created, i.e. a new pad, pocket, ... In these cases the new feature should obviously belong to the same body as the current selection and I would like to see that body activated.
But this dialog occurs as well, if a new feature is created, i.e. a new pad, pocket, ... In these cases the new feature should obviously belong to the same body as the current selection and I would like to see that body activated.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: More helpful "need active body" message
I wonder how important this might be?
Unless the tree is already very long the available bodies are clearly shown. What does this extra coding and verbiage add?
I see this message once in a while, but I instantly know what to do.
I believe even beginners will be confused only once.
Gene
Unless the tree is already very long the available bodies are clearly shown. What does this extra coding and verbiage add?
I see this message once in a while, but I instantly know what to do.
I believe even beginners will be confused only once.
Gene
Re: More helpful "need active body" message
I don't expect it'd be too hard to change it to a list if people want that.chrisb wrote: ↑Wed Jul 28, 2021 7:22 am If possible I would prefer a list over a drop down menu. But even more important, I would like to see an educated guess which body to activate. With a new sketch or a new primitive no guess can be made and you have of course to ask the user.
But this dialog occurs as well, if a new feature is created, i.e. a new pad, pocket, ... In these cases the new feature should obviously belong to the same body as the current selection and I would like to see that body activated.
I was also thinking of maybe having an educated guess for the selected body, but I don't believe it'll be that straightforward. It's probably very much doable however: if something is selected in the view-port, find the body it belongs to and select it in the drop-down (regardless of what feature is being created, to avoid implementation complication).
I would say it's a matter of convenience. Consider the following case: We have two bodies, none active, and we have selected a face on one of them. We are on "tasks" in the combo view.GeneFC wrote: ↑Wed Jul 28, 2021 2:31 pm I wonder how important this might be?
Unless the tree is already very long the available bodies are clearly shown. What does this extra coding and verbiage add?
I see this message once in a while, but I instantly know what to do.
I believe even beginners will be confused only once.
Gene
Old way:
1. Press "create sketch"
2. Error box appears press ok.
3. Switch to model view, right click/double click on body and make active (doesn't happen by double clicking in view-port). This will clear our face selection.
4. Select the face again.
5. Press "create sketch" again.
New way:
1. Press "create sketch"
2. Dialog box appears. Select body and press OK. We are in sketcher
Now that I look at it, it seems implementing it for the rest of the features is more probably more straightforward than I thought: simply replace the old message in getBody() with a call to the new one, possibly with a new message.
Re: More helpful "need active body" message
I was responding.jnxd wrote: ↑Wed Jul 28, 2021 3:03 am I suspect I will have to alter the behavior of ALL the commands that use PartDesign::getBody() in order for this to work smoothly, or make changes in the function itself.
So before I proceed further I would like to know if people have any inputs regarding this, either on the new UI or on it's implementation.
The first line I quoted above is pretty worrisome. Altering the behavior of "ALL" should not be take lightly.
If you don't want responses don't ask, just do it.
Gene
Re: More helpful "need active body" message
The response is indeed appreciated. And agreeably changing code in all commands would need a rather good amount of testing. However, it does really seem that I just need to make changes in a couple of places, and a change at one spot won't affect the others.GeneFC wrote: ↑Wed Jul 28, 2021 7:19 pmI was responding.jnxd wrote: ↑Wed Jul 28, 2021 3:03 am I suspect I will have to alter the behavior of ALL the commands that use PartDesign::getBody() in order for this to work smoothly, or make changes in the function itself.
So before I proceed further I would like to know if people have any inputs regarding this, either on the new UI or on it's implementation.
The first line I quoted above is pretty worrisome. Altering the behavior of "ALL" should not be take lightly.
If you don't want responses don't ask, just do it.
Gene
As for the last line, I would definitely skip doing it if the response was overwhelmingly negative, or if there was a reason apart from "it wouldn't be that useful". That said, there are some implementation level questions I have, for which I could use some input from someone with a good knowledge of PartDesign.
Re: More helpful "need active body" message
I'm a little like Gene in respect of the fact that I don't really care about this much, however I am very pleased that you care enough to make this change.
This is a prime example of FOSS "I think I can improve this, so I will "
I hope this leads you to make other contributions....
This is a prime example of FOSS "I think I can improve this, so I will "
I hope this leads you to make other contributions....