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.
User avatar
Kunda1
Posts: 5515
Joined: Thu Jan 05, 2017 9:03 pm

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

Postby Kunda1 » Sat Oct 12, 2019 10:25 pm

This thread is a discussion thread for issue #4162 - Draft Feature: change pointer 'Pick Radius' based on if the user is editing or selecting
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
carlopav
Posts: 242
Joined: Mon Dec 31, 2018 1:49 pm

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

Postby carlopav » Sun Oct 13, 2019 10:11 am

Great, you can assign it to me since it's concerning edit command I guess.
User avatar
Kunda1
Posts: 5515
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

Postby Kunda1 » Sun Oct 13, 2019 4:44 pm

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 ;) )
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
carlopav
Posts: 242
Joined: Mon Dec 31, 2018 1:49 pm

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

Postby carlopav » Sun Oct 13, 2019 9:04 pm

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?);
User avatar
Kunda1
Posts: 5515
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

Postby Kunda1 » Sun Oct 13, 2019 10:16 pm

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'.
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
carlopav
Posts: 242
Joined: Mon Dec 31, 2018 1:49 pm

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

Postby carlopav » Wed Oct 16, 2019 9:43 pm

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
User avatar
Kunda1
Posts: 5515
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

Postby Kunda1 » Thu Oct 17, 2019 12:03 am

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
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
DeepSOIC
Posts: 6967
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

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

Postby DeepSOIC » 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.
User avatar
Kunda1
Posts: 5515
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

Postby Kunda1 » Thu Oct 17, 2019 12:22 am

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
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features