Automatically create body?
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Automatically create body?
Just a little UI question - If there is no body at all, is there a situation where it would be wrong for FreeCAD to create a new body instead of popping up this modal? -Ian-
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: Automatically create body?
Maybe. It may create a new body even if there are bodies already, just one isn't active. I think making New Sketch and Addtive <Primitive> commands may do it. Maybe datum features too, but that is more questionable. Remaining tools require input shapes that should be already in a body, so they shouldn't create bodies.
Re: Automatically create body?
I was thinking on the same lines, though I planned to suggest making any available bodies active. We could have a dropdown of sorts, with one of the options being "add new body".
The message must also restrict the option to the parent body if, say a sketch is to be edited.
The message must also restrict the option to the parent body if, say a sketch is to be edited.
My latest (or last) project: B-spline Construction Project.
Re: Automatically create body?
Ahh, good point. So, perhaps it should only make the new body automatically for operations that don't depend on other shapes.DeepSOIC wrote: Remaining tools require input shapes that should be already in a body, so they shouldn't create bodies.
I'm probably not following your suggestion, but generally I'm not a fan of adding UI elements when there's already UI for a particular task. To me, the modal popup makes sense when FreeCAD can't know what to do. I'm just suggesting that in the specific case of a document with no bodies, the "right" thing to do is sometimes obvious enough that it shouldn't require more clicks or any questions from FreeCAD.jnxd wrote:We could have a dropdown of sorts, with one of the options being "add new body".
Basically, the issue I have with the popup is that it adds a click to my usual workflow (which starts by making a sketch), where I don't see any benefit. Will think about it a bit more and maybe come up with some proposed code changes in a few days. -Ian-
Re: Automatically create body?
What I suggest is simply "You need an active body to perform this action. Please select a body to activate." and give the user the options, including creating a new body. This is only necessary if there are any bodies and we are not going to edit something already present. Indeed if there is no body, we should default to creating a new one automatically, and if the user is editing something, we should directly switch to the body the feature/sketch belongs to, or create a body and put said feature/sketch into it. However, when a body is made, the user might want to rename it, and in any case, we should indicate to the user that bodies are needed, just in case they don't know about PDN.ian.rees wrote: I'm probably not following your suggestion, but generally I'm not a fan of adding UI elements when there's already UI for a particular task. To me, the modal popup makes sense when FreeCAD can't know what to do. I'm just suggesting that in the specific case of a document with no bodies, the "right" thing to do is sometimes obvious enough that it shouldn't require more clicks or any questions from FreeCAD.
Basically, the issue I have with the popup is that it adds a click to my usual workflow (which starts by making a sketch), where I don't see any benefit. Will think about it a bit more and maybe come up with some proposed code changes in a few days. -Ian-
My latest (or last) project: B-spline Construction Project.
- kkremitzki
- Veteran
- Posts: 2515
- Joined: Thu Mar 03, 2016 9:52 pm
- Location: Illinois
Re: Automatically create body?
In this thread I talked about changing the "Create Body/Create Part" introductory Task Panel. I looked into it, and figured the most straightforward fix would be to add a button that has a "pick amongst the bodies in the document" button to replace the "create part" button. I wasn't sure if it would be worth implementing but I think it might be based on this thread.
If I made something like that, it could have an optional "before" message passed to it by e.g. the code that runs when you click a button and don't have an active part. That way, it would be something like:
If I made something like that, it could have an optional "before" message passed to it by e.g. the code that runs when you click a button and don't have an active part. That way, it would be something like:
Then this could get called whenever a PartDesign button is clicked and no Body is found in the document.|=============|
|- BodyPicker -|
|=============|
|<custom msg>|
|=============|
| - Workspace -|
|-|--> Body ----|
|-|--> Body001-|
| - Body002 --- |
| -Create body-|
|=============|
Re: Automatically create body?
jnxd - sorry I'm still not following, but there seems to be a lot more going on in your post than what I'm proposing. What I want is one less click in the workflow that goes "Start FreeCAD, create sketch, ...".
Anyways, if I can get around to it in the next few days, I'll try to implement my proposed change and see what people think about it. -Ian-
I think the Task Panel is problematic in general; I think most uses of it make FreeCAD too modal. But, that's diverging from this thread, I'll go post there...kkremitzki wrote:In this thread I talked about changing the "Create Body/Create Part" introductory Task Panel.
Anyways, if I can get around to it in the next few days, I'll try to implement my proposed change and see what people think about it. -Ian-
Re: Automatically create body?
How does this look? https://github.com/ianrrees/FreeCAD_tin ... -auto-body -Ian-
-
- Posts: 62
- Joined: Tue Mar 14, 2017 2:11 pm
Re: Automatically create body?
+1 for addressing the simple use case of a user with an empty document/a document without a body who runs an action that needs a body by automatically creating a body would be a nice fix to streamline this basic/simple workflow.ian.rees wrote:Basically, the issue I have with the popup is that it adds a click to my usual workflow (which starts by making a sketch), where I don't see any benefit. Will think about it a bit more and maybe come up with some proposed code changes in a few days. -Ian-
I still run into this every now and then.
In other situations where there already exists a body, that body might or might not be the one the user wants to use, which makes it a bit more complicated. So maybe leave that for now?
Nice! Small question: Where does the text in the current pop-up come from? I expected a changed message but I only see additions.ian.rees wrote:How does this look? https://github.com/ianrrees/FreeCAD_tin ... -auto-body -Ian-
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: Automatically create body?
Add it for primitives too, I think. Thus, it may be a good idea to wrap the code you added to new-sketch command into a standalone routine, like "autoNewBody()"...ian.rees wrote:How does this look? https://github.com/ianrrees/FreeCAD_tin ... -auto-body -Ian-