Making constraint 'clear' when sketchHandler active

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Making constraint 'clear' when sketchHandler active

Post by openBrain »

paddle wrote: Wed Jan 19, 2022 6:46 pm Hmm I have no idea how to get your branch on my local git.
I'll search for it and try it! My new git challenge!
IMO the simple way is to create a new branch with master locally on your computer and 'git cherry-pick' my commit. ;)

Getting a PR can be a bit simpler as you have no other remote to add, hence my proposal for a draft PR. Tell me if needed.
User avatar
paddle
Veteran
Posts: 1392
Joined: Mon Feb 03, 2020 4:47 pm

Re: Making constraint 'clear' when sketchHandler active

Post by paddle »

openBrain wrote: Wed Jan 19, 2022 6:49 pm
paddle wrote: Wed Jan 19, 2022 6:46 pm Hmm I have no idea how to get your branch on my local git.
I'll search for it and try it! My new git challenge!
IMO the simple way is to create a new branch with master locally on your computer and 'git cherry-pick' my commit. ;)

Getting a PR can be a bit simpler as you have no other remote to add, hence my proposal for a draft PR. Tell me if needed.
Hmm I tried that but I get fatal: bad object d42bdf082355330cee9fb22846293a1899b7bc7b
I'm not sure why. I see your master is behind 6xx commits so that may be why?

I think I'll just copy paste the modifications manually :mrgreen:
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Making constraint 'clear' when sketchHandler active

Post by openBrain »

paddle wrote: Wed Jan 19, 2022 8:58 pm Hmm I tried that but I get fatal: bad object d42bdf082355330cee9fb22846293a1899b7bc7b
I'm not sure why. I see your master is behind 6xx commits so that may be why?

I think I'll just copy paste the modifications manually :mrgreen:
Maybe worth explaining a bit more :)

Method 1 : from external fork
This is the more versatile method as you may apply it for any external repo.

Code: Select all

git remote add 0penBrainFork https://github.com/0penBrain/FreeCAD.git # '0penBrainFork' is a free name
git fetch 0penBrainFork sketchConsSelect # 'sketchConsSelect' is the branch name limiting fetching to this branch. It is optional.
From there 2 possibilities.

1.1 Checking out the remote branch

Code: Select all

git branch sketchConsSelect FETCH_HEAD
git checkout sketchConsSelect
1.2 Cherry-picking the commit

Code: Select all

git checkout -b test0penBrainCommit # you should run this from an up-to-date master branch
git cherry-pick d42bdf082355330cee9fb22846293a1899b7bc7b
Method 2 : from PR
This is simpler but needs to have a PR running. I did a draft one : https://github.com/FreeCAD/FreeCAD/pull/5398

Code: Select all

git fetch upstream pull/5398/head:pr5398 # 'pr5398' is a free name. I assume you have your own fork so official repo is 'upstream'
git checkout pr5398
Then compile and run whatever is the method :)
User avatar
paddle
Veteran
Posts: 1392
Joined: Mon Feb 03, 2020 4:47 pm

Re: Making constraint 'clear' when sketchHandler active

Post by paddle »

openBrain wrote: Thu Jan 20, 2022 7:46 am Then compile and run whatever is the method :)
Thanks for the detailed instruction !
So after a frustratingly long compiling time, it turns out to be working perfectly !
It's a nice little fix that makes the software more fluent to use so thanks a lot.

By the way this could be quite useful in edit mode while not using a tool. Say you want to drag a line or select a line.
Obviously we want to be able to select constrain too when not using a tool.

So what about deactivating constrain selectability when a key is pressed and hold?
So when holding ctrl or an unused key, then the constraints become not selectable.

What do you think?

If you can already merge it as is it would be great.
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Making constraint 'clear' when sketchHandler active

Post by openBrain »

paddle wrote: Thu Jan 20, 2022 9:50 am It's a nice little fix that makes the software more fluent to use so thanks a lot.
Ok. I'd like to have some more community feedback before unleashing the PR. Is that feature useful/appreciated? Should that be always there, or optionally enabled/disabled? If optional, should that be a preference or a Sketcher task panel option?
By the way this could be quite useful in edit mode while not using a tool. Say you want to drag a line or select a line.
Obviously we want to be able to select constrain too when not using a tool.

So what about deactivating constrain selectability when a key is pressed and hold?
So when holding ctrl or an unused key, then the constraints become not selectable.

What do you think?
Looks doable. Here again community feedback would be good.
If you can already merge it as is it would be great.
For this I'll be quite strict about the method. If we go for this other evolution, I'll make another PR as I prefer to keep the PR as atomic as possible (short, easy to review, easy to merge). ;)
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Making constraint 'clear' when sketchHandler active

Post by adrianinsaval »

openBrain wrote: Thu Jan 20, 2022 11:30 am Ok. I'd like to have some more community feedback before unleashing the PR. Is that feature useful/appreciated? Should that be always there, or optionally enabled/disabled? If optional, should that be a preference or a Sketcher task panel option?
very useful IMO and I c'ant think of a usecase for selecting a constraint while a tool is active, I don't think it's even possible, they just get preselected and prevent you from using the geometry bellow. So I vote for no preference parameter for this.
So what about deactivating constrain selectability when a key is pressed and hold?
So when holding ctrl or an unused key, then the constraints become not selectable.
Looks doable. Here again community feedback would be good.
I think this would also be useful since sometimes constraints get in the way, however IMO the best solution would be to have some way to control the depth of the selection, in the case of coincident points I don't know of a way of choosing which point is selected, and if you rotate the sketch and edit backwards you straight up can't select endpoints because the edge is above it. Similar issue if a constraint is above another.
User avatar
paddle
Veteran
Posts: 1392
Joined: Mon Feb 03, 2020 4:47 pm

Re: Making constraint 'clear' when sketchHandler active

Post by paddle »

adrianinsaval wrote: Thu Jan 20, 2022 1:44 pm and if you rotate the sketch and edit backwards you straight up can't select endpoints because the edge is above it. Similar issue if a constraint is above another.
Yes I had this problem while looking at the edit backwards. It's very annoying. Specially because when I do look at the edit backwards I have a reason to do so (some objects that I don't want to hide that are blocking the view)

One solution could be that points be rendered both on top and below the edges. This way they can be selected from both side.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Making constraint 'clear' when sketchHandler active

Post by adrianinsaval »

paddle wrote: Thu Jan 20, 2022 4:09 pm One solution could be that points be rendered both on top and below the edges. This way they can be selected from both side.
I had thought about that too, would be nice to have but it should be generalized considering the configured rendering order not just points I think.
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Making constraint 'clear' when sketchHandler active

Post by openBrain »

Released the PR : https://github.com/FreeCAD/FreeCAD/pull/5398
BAsed on (somewhat limited) feedback, behavior isn't optional. :)
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Making constraint 'clear' when sketchHandler active

Post by openBrain »

paddle wrote: Thu Jan 20, 2022 9:50 am So what about deactivating constrain selectability when a key is pressed and hold?
OK, I have a prototype working.
However I'd like community feedback about both usefulness and key choice (this only if useful :P).
ATM I choose the Space key because it looks to me easy to catch, and unused in this context.
However, the problem is that this key won't be user settable. So we have to choose it carefully. It means that with my current implementation, Space key is no more usable for another action/command in Sketcher edit mode.
Thoughts ?
Post Reply