Better selection system for constraints in Sketcher

A subforum for research and development of the user interface of FreeCAD

Moderator: agryson

jnxd
Posts: 116
Joined: Mon Mar 30, 2015 2:30 pm

Better selection system for constraints in Sketcher

Postby jnxd » Mon Oct 24, 2016 7:10 pm

The current system of adding constraints feels a bit annoying in that FreeCAD complains if we select a constraint before selecting the items on which to apply it. It should be possible to add some or all of the elements necessary for creating the constraint into the selection. A good example is the fillet option in sketch, which allows us to do so (rather makes us, it'd be good if it worked on the current selection too). I suggest we add the constraint icon next to the cursor like one that is there when making geometries, and put a short message on the status bar asking the user to select additional elements to the selection. The fillet tool can provide the skeleton for implementation of such a feature. Any coments?
triplus
Posts: 4866
Joined: Mon Dec 12, 2011 4:45 pm

Re: Better selection system for constraints in Sketcher

Postby triplus » Mon Oct 24, 2016 7:28 pm

jnxd wrote:The current system of adding constraints feels a bit annoying in that FreeCAD complains if we select a constraint before selecting the items on which to apply it.


Current system doesn't allow you to select constraint before selecting the sketcher geometry.

jnxd wrote:It should be possible to add some or all of the elements necessary for creating the constraint into the selection.


That is possible as you can do a multi-select of appropriate sketcher geometry and after apply constraints in one step.
chrisb
Posts: 1668
Joined: Tue Mar 17, 2015 9:14 am

Re: Better selection system for constraints in Sketcher

Postby chrisb » Tue Oct 25, 2016 12:34 am

The advantage of this new selection style does for me not outweigh the speed of the current system. Every now and then I get a message to select the right number of of points, e.g. when applying symmetry to two points, but the message states clear what the problem is. This happens on heavy usage of FreeCAD approximately twice a day, or let's say 10 times. The new style would not really solve that problem, in that case messages would have to be created as well in case of badly selected vertexes or edges. To restrict the selection to only admissible values would prevent the common use case of selecting elements and deselecting some of them before applying the constraint if the intermediate selection is not permitted.
jnxd
Posts: 116
Joined: Mon Mar 30, 2015 2:30 pm

Re: Better selection system for constraints in Sketcher

Postby jnxd » Tue Oct 25, 2016 9:09 am

chrisb wrote:The advantage of this new selection style does for me not outweigh the speed of the current system. ... This happens on heavy usage of FreeCAD approximately twice a day, or let's say 10 times.


I am pretty much at the other end of the usage spectrum. In addition, I very often use Abaqus instead due to my work requirements. So I can imagine how our experiences with the current method vary. In that case, what do you think of disabling certain constraints incompatible with the current selection? It would be a bit more code but IMHO a huge improvement in UX.

chrisb wrote:To restrict the selection to only admissible values would prevent the common use case of selecting elements and deselecting some of them before applying the constraint if the intermediate selection is not permitted.


Indeed, I can see how that would be a problem. But in exchange we get an option to successively apply the same constraint without having to click on the icon every time.
chrisb
Posts: 1668
Joined: Tue Mar 17, 2015 9:14 am

Re: Better selection system for constraints in Sketcher

Postby chrisb » Tue Oct 25, 2016 1:25 pm

jnxd wrote:But in exchange we get an option to successively apply the same constraint without having to click on the icon every time.

That is an advantage, indeed. My workflow is usually starting with a polyline then adding as many concidence constraints, then tangential and so on (the sequence my vary). For the "two-element-constraints" like tangential I could well imagine similar behaviour as during the creation process, that the system stays in the state of adding the same kind of constraint again.
jnxd
Posts: 116
Joined: Mon Mar 30, 2015 2:30 pm

Re: Better selection system for constraints in Sketcher

Postby jnxd » Tue Oct 25, 2016 3:22 pm

chrisb wrote:For the "two-element-constraints" like tangential I could well imagine similar behaviour as during the creation process, that the system stays in the state of adding the same kind of constraint again.


There is however a small problem when it comes to constraints that can take varying number of elements, like the angle constraint has an optional third point element that can be provided. Any suggestions on how to go about them?
jnxd
Posts: 116
Joined: Mon Mar 30, 2015 2:30 pm

Re: Better selection system for constraints in Sketcher

Postby jnxd » Sat Dec 17, 2016 4:28 pm

Okay so I have some time at hand and I'm going to try my hand at making this selection system. I think lock would be the easiest so that's which I'll use as a proof of concept. Comparing the files CommandCreateGeo.cpp and CommandConstraints.cpp, I see the main difference is that in the former, DrawSketchHandler is subclassed and used. I think following the same route should be okay for constraints, except that there'll be much more modification to the methods of DrawSketchHandler.
cox
Posts: 912
Joined: Wed Nov 26, 2014 11:37 pm

Re: Better selection system for constraints in Sketcher

Postby cox » Sat Dec 17, 2016 5:57 pm

This sounds like a nice usability improvement, I guess it could be extended to increase the selection hot sones of the possible entities when choosing the constraint tool first.

The major issue this would solve is when sketching on a obscured face, that makes you rotate the view to have visibility. When doing this it is many times very difficult to select points especially in inside corners.

The point that could be difficult to select in the image below, is the far end point of the external reference in the corner.
Spectacle.iR5669.png
Spectacle.iR5669.png (13.98 KiB) Viewed 808 times
Need help? Feel free to ask, but please read the guidelines first
jnxd
Posts: 116
Joined: Mon Mar 30, 2015 2:30 pm

Re: Better selection system for constraints in Sketcher

Postby jnxd » Sun Dec 18, 2016 4:16 am

cox wrote:...I guess it could be extended to increase the selection hot sones of the possible entities when choosing the constraint tool first.


I don't think I can follow you. Maybe an example of what we would have to click before, and what you want it to be after?

I started a branch for it here:https://github.com/AjinkyaDahale/FreeCAD/tree/constraintselect. I probably will be able to figure out my way through the code, but I'll need someone to teach me how and what kinds of tests should be done. Thanks in advance!

PS: I should also mention I got this idea from the way abaqus handles sketches. Somebady probably should just check if we'll get in trouble for using it.
User avatar
Pauvres_honteux
Posts: 73
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: Better selection system for constraints in Sketcher

Postby Pauvres_honteux » Sun Dec 18, 2016 6:42 am

Hi, and sorry for chiming in late, but I didn't notice this thread until a moment ago.
Now when our friendly soul of jnxd is picking up on this matter I'd like to put forward my old suggestion: 1416.

Extra argument: When it comes to working speed, it definitivly outperformes the current system.

I wonder if Abaqus have some similar selection system? Haven't worked with it for over 10 years now, so I guess things changed after the big french company bought it?

Oh, and another huge benefit: it'll be just one icon in/on the workbench, i.e. big space saving!

I guess some automagic stuff would be beneficial for checking what constrains are possible for the particular selections.

By the way: would this by any chance cover a whish for automagic horizontal, vertical and parallel when constraining distances? As it is now one can only set a distance between a point and, at the best, a line. With a bit of automagic the work for the user would be reduced to simply select two lines and type the desired value (or if non-parallel lines and you really want a distance, right click and choose Distance).

Edit: misspelled parallel...
Last edited by Pauvres_honteux on Sun Dec 18, 2016 9:36 am, edited 2 times in total.