[Feature idea] Smart constraint tool
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
[Feature idea] Smart constraint tool
So I was thinking about the constraint tools in FreeCad.
I remember when I learned to use FreeCad that each constraint have its button was very painful. And only after learning some shortcuts did it get easier. Though it still isn't as fast as I'd like.
I was thinking that a 'smart constraint' tool could be very nice and speed up work.
The idea is that this tool will make different constraint based on what you are clicking.
So for instance :
- You select the 'smart constraint' tool.
- You click on a line
- A preview of distance constraint appears
- You click on a second non parallel line
- The preview switch to angle constraint.
- You click on empty space
- It brings the dialog box of the last previewed constraint tool.
Other example :
- You select a circle
- Preview of radius constraint
- You select a line
- Preview of tangency constraint.
...
While this does not cover all the constraint and won't replace the other tools, it would cover most of the workflow and would speed the process, especially for beginners who don't know shortcuts (let's be honest, even after two years I don't know half of the shortcuts and still struggle some times).
For reference, this tool is found on Catia for instance. And before anyone gets on the 'freecad won't be a clone of other cad software' let me clear things up: it doesn't mean that I want FreeCad to be turned in a clone of Catia. It's just a nice feature that make things faster. Catia has its own annoying flaws that FreeCad handle much better (vertical and horizontal distances for instance). I just think it would be best to take the best of both.
Your thoughts ? If enough people are interested to get it integrated then I'd like to develop it.
Thanks
I remember when I learned to use FreeCad that each constraint have its button was very painful. And only after learning some shortcuts did it get easier. Though it still isn't as fast as I'd like.
I was thinking that a 'smart constraint' tool could be very nice and speed up work.
The idea is that this tool will make different constraint based on what you are clicking.
So for instance :
- You select the 'smart constraint' tool.
- You click on a line
- A preview of distance constraint appears
- You click on a second non parallel line
- The preview switch to angle constraint.
- You click on empty space
- It brings the dialog box of the last previewed constraint tool.
Other example :
- You select a circle
- Preview of radius constraint
- You select a line
- Preview of tangency constraint.
...
While this does not cover all the constraint and won't replace the other tools, it would cover most of the workflow and would speed the process, especially for beginners who don't know shortcuts (let's be honest, even after two years I don't know half of the shortcuts and still struggle some times).
For reference, this tool is found on Catia for instance. And before anyone gets on the 'freecad won't be a clone of other cad software' let me clear things up: it doesn't mean that I want FreeCad to be turned in a clone of Catia. It's just a nice feature that make things faster. Catia has its own annoying flaws that FreeCad handle much better (vertical and horizontal distances for instance). I just think it would be best to take the best of both.
Your thoughts ? If enough people are interested to get it integrated then I'd like to develop it.
Thanks
Support me on Patreon: https://www.patreon.com/FreeCadDevDiary
FreeCad Dev Diary channel:[/b] https://www.youtube.com/channel/UCGMTmJ ... NiPSSEhBHA
FreeCad Dev Diary channel:[/b] https://www.youtube.com/channel/UCGMTmJ ... NiPSSEhBHA
Re: [Feature idea] Smart constraint tool
When I'm constraining I prefer to add geometric constraints, so I would call this a "smart dimensioning" tool.
When I select a line, they are very often horizontal or vertical. If I dimension such lines it is mostly
- horizontal distance for horizontal lines
- vertical distance for vertical lines.
When I select a line, they are very often horizontal or vertical. If I dimension such lines it is mostly
- horizontal distance for horizontal lines
- vertical distance for vertical lines.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: [Feature idea] Smart constraint tool
Additionally, I dislike using the term 'smart' in this case, even though I realize other cad software uses the term. A more accurate term would be 'contextual constraints'. For constraints or dimensioning, this would have to be something that is an optional feature, because many prefer to apply constraints/dimensions 100% manually. Personally I find value in both approaches.
- adrianinsaval
- Veteran
- Posts: 5541
- Joined: Thu Apr 05, 2018 5:15 pm
Re: [Feature idea] Smart constraint tool
This would be a welcomed addition by most people I think, also consider making the m key switch between the different constraints available for the selection.
Re: [Feature idea] Smart constraint tool
Smartconstraint was just a name idea, it's not important, it can be something else. Contextual is fine for me
Support me on Patreon: https://www.patreon.com/FreeCadDevDiary
FreeCad Dev Diary channel:[/b] https://www.youtube.com/channel/UCGMTmJ ... NiPSSEhBHA
FreeCad Dev Diary channel:[/b] https://www.youtube.com/channel/UCGMTmJ ... NiPSSEhBHA
- Pauvres_honteux
- Posts: 728
- Joined: Sun Feb 16, 2014 12:05 am
- Location: Far side of the moon
Re: [Feature idea] Smart constraint tool
issue #1416 Constraints creation "on the fly"
Re: [Feature idea] Smart constraint tool
Oh I see, yes that's exactly what I had in mind.
Hi Abdullah!abdullah wrote: Thanks for the pictures. I have understood what you mean.
Some of the concepts are similar to an old idea called "Constrinator", which was never implemented. I intended to start developing parts of that tool this year.
I will consider your input when giving shape to that new tool.
Is it actually being worked on or not yet? If yes I can help on the 'if tree' of the tool. If not I have started to think on it and have a few questions on how constraints code work.
Code: Select all
CmdSketcherConstrainHorizontal::activated(int iMsg)
Code: Select all
CmdSketcherConstrainHorizontal::applyConstraint(std::vector<SelIdPair> &selSeq, int seqIndex)
But then what is seqIndex ? And where is it defined? Why the function code use a Switch on this and not directly a 'if tree' on selSeq vector?
What is strange for me is that the seqIndex seems to represent different case between the different constraint functions. So it's hard to make sens of it.
Support me on Patreon: https://www.patreon.com/FreeCadDevDiary
FreeCad Dev Diary channel:[/b] https://www.youtube.com/channel/UCGMTmJ ... NiPSSEhBHA
FreeCad Dev Diary channel:[/b] https://www.youtube.com/channel/UCGMTmJ ... NiPSSEhBHA
Re: [Feature idea] Smart constraint tool
Does anyone know why the horizontal and vertical constraints are two different constraints and not one?
Re: [Feature idea] Smart constraint tool
Because one makes a line vertical and the other makes it horizontal?
- Attachments
-
- SnipScreenshot-364db8.png (1.33 KiB) Viewed 14819 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: [Feature idea] Smart constraint tool
One problem I face is that the commands clear the selection (not the point but the edges yes).
So for instance :
clears the selection.
Is there a way to prevent that?
Or alternatively I could reselect all the perviously selected geometries as their GeoId are stored. But how to add to selection with GeoIds ? Now I'm using
Which use onSketchPos so I can't use that to reselect all the geometries.
So for instance :
Code: Select all
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Add equality constraint"));
Gui::cmdAppObjectArgs(Obj, "addConstraint(Sketcher.Constraint('Equal',%d,%d)) ",
GeoId1, GeoId2);
Gui::Command::commitCommand();
Is there a way to prevent that?
Or alternatively I could reselect all the perviously selected geometries as their GeoId are stored. But how to add to selection with GeoIds ? Now I'm using
Code: Select all
Gui::Selection().addSelection(Obj->getDocument()->getName(),
Obj->getNameInDocument(),
ss.str().c_str(), onSketchPos.x, onSketchPos.y, 0.f);
Support me on Patreon: https://www.patreon.com/FreeCadDevDiary
FreeCad Dev Diary channel:[/b] https://www.youtube.com/channel/UCGMTmJ ... NiPSSEhBHA
FreeCad Dev Diary channel:[/b] https://www.youtube.com/channel/UCGMTmJ ... NiPSSEhBHA