Feature #4162 - Draft: change pointer 'Pick Radius' based on if the user is editing or selecting

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Feature #4162 - Draft: change pointer 'Pick Radius' based on if the user is editing or selecting

Post by Kunda1 »

This thread is a discussion thread for issue #4162 - Draft Feature: change pointer 'Pick Radius' based on if the user is editing or selecting
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Feature #4162 - Draft: change pointer 'Pick Radius' based on if the user is editing or selecting

Post by carlopav »

Great, you can assign it to me since it's concerning edit command I guess.
follow my experiments on BIM modelling for architecture design
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Feature #4162 - Draft: change pointer 'Pick Radius' based on if the user is editing or selecting

Post by Kunda1 »

carlopav wrote: Sun Oct 13, 2019 10:11 am Great, you can assign it to me since it's concerning edit command I guess.
Done (added you as a 'Developer', congrats ;) )
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Feature #4162 - Draft: change pointer 'Pick Radius' based on if the user is editing or selecting

Post by carlopav »

Kunda1 wrote: Sun Oct 13, 2019 4:44 pm added you as a 'Developer', congrats ;)
Wow, that's a huge resposibility, hope I haven't been too hasty :). Just to be sure if i got it right:
- we should create a new Parameter for "DraftEditPickRadius" (in BaseApp\Preferences\Mod\Draft) (Float);
- this line https://github.com/FreeCAD/FreeCAD/blob ... dit.py#L68 should fetch it;
- in the Draft user preferences a new entry should give the user the chance to modify it (maybe in snap and grid sheet?);
follow my experiments on BIM modelling for architecture design
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Feature #4162 - Draft: change pointer 'Pick Radius' based on if the user is editing or selecting

Post by Kunda1 »

carlopav wrote: Sun Oct 13, 2019 9:04 pm Wow, that's a huge resposibility, hope I haven't been too hasty :). Just to be sure if i got it right:
- we should create a new Parameter for "DraftEditPickRadius" (in BaseApp\Preferences\Mod\Draft) (Float);
- this line https://github.com/FreeCAD/FreeCAD/blob ... dit.py#L68 should fetch it;
AFAICT, that makes sense.
carlopav wrote: Sun Oct 13, 2019 9:04 pm - in the Draft user preferences a new entry should give the user the chance to modify it (maybe in snap and grid sheet?);
Yea, that works though not ideal. Having it's own section makes sense to me...like 'Mouse'.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Feature #4162 - Draft: change pointer 'Pick Radius' based on if the user is editing or selecting

Post by carlopav »

Does something like this make sense at the beginning of Draft Edit?
It works as expected: if the parameter exhist it returns != 0 and the self.pick_radius can get it. Otherwise the parameter is set.

Code: Select all

if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetInt("DraftEditPickRadius") == 0:
    FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").SetInt("DraftEditPickRadius", 20)

self.pick_radius = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetInt("DraftEditPickRadius", 20)
I just find it not so elegant...

EDIT: This is the second option. perhaps it's better:

Code: Select all

        param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")
        self.pick_radius = param.GetInt("DraftEditPickRadius", 0)
        if self.pick_radius == 0: 
            param.SetInt("DraftEditPickRadius", 20)
            self.pick_radius = 20
follow my experiments on BIM modelling for architecture design
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Feature #4162 - Draft: change pointer 'Pick Radius' based on if the user is editing or selecting

Post by Kunda1 »

carlopav wrote: Wed Oct 16, 2019 9:43 pm
EDIT: This is the second option. perhaps it's better:

Code: Select all

        param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")
        self.pick_radius = param.GetInt("DraftEditPickRadius", 0)
        if self.pick_radius == 0: 
            param.SetInt("DraftEditPickRadius", 20)
            self.pick_radius = 20
Yea, this does seem more sleek
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Feature #4162 - Draft: change pointer 'Pick Radius' based on if the user is editing or selecting

Post by DeepSOIC »

BTW, pick radius can be also manipulated with

Code: Select all

Gui.ActiveDocument.ActiveView.getViewer().getPickRadius()
Gui.ActiveDocument.ActiveView.getViewer().setPickRadius(15)
EDIT: and then I realized that advice wasn't asked for. If you already know, sorry for the noise.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Feature #4162 - Draft: change pointer 'Pick Radius' based on if the user is editing or selecting

Post by Kunda1 »

DeepSOIC wrote: Thu Oct 17, 2019 12:07 am BTW, pick radius can be also manipulated with

Code: Select all

Gui.ActiveDocument.ActiveView.getViewer().getPickRadius()
Gui.ActiveDocument.ActiveView.getViewer().setPickRadius(15)
EDIT: and then I realized that advice wasn't asked for. If you already know, sorry for the noise.
That's even cooler! Thanks @DeepSOIC
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Feature #4162 - Draft: change pointer 'Pick Radius' based on if the user is editing or selecting

Post by carlopav »

Here you can find the PR: https://github.com/FreeCAD/FreeCAD/pull/2642.
Hope it works since i'm not able to compile and this was the first time trying to edit the preferences UI.
follow my experiments on BIM modelling for architecture design
Post Reply