Sketcher grid : fundamental change

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Sketcher grid : fundamental change

Post by wmayer »

- The focal plane is the same as sketch plane ?
Yes, they are equal. See ViewProviderSketch::setEditViewer.
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Sketcher grid : fundamental change

Post by openBrain »

paddle wrote: Mon Nov 14, 2022 5:03 pm Great. I'll get that started then.
Probably before diving into code, we should discuss some details about what should be sketcher-specific and what should not be. ;)
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketcher grid : fundamental change

Post by chrisb »

openBrain wrote: Mon Nov 14, 2022 3:23 pm Just imagine when you look at your sketch from a very skewed view, especially in perspective mode. ;)
That's why I had asked about the orientation of the grid. In Sketcher I can imagine to show exactly those parts of the grid which would be shown in "Sketcher ViewSketch" mode. And turning it wouldn't change the size. Well, we could even double it.

I'm not sure though if this approach would also work well in Draft. And I really would like to see the same grid in both WBs.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Bance
Veteran
Posts: 4185
Joined: Wed Feb 11, 2015 3:00 pm
Location: London

Re: Sketcher grid : fundamental change

Post by Bance »

I think the fundamental change should just be to do away with it altogether. :D

If we must have it, then make it as good as it gets.

Just my 2$. :lol:

Thanks for the effort, it's good to see people involved.
User avatar
pathfinder
Posts: 315
Joined: Mon Oct 04, 2021 10:27 am

Re: Sketcher grid : fundamental change

Post by pathfinder »

I sound like a broken record, but I think taking a look at how Blender does the adaptive grid may be interesting. If you zoom in or out, lines fade in or out and are replaced by other lines. Blender is mostly used in perspective mode, but it also works in orthographic mode or plane mode.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Sketcher grid : fundamental change

Post by adrianinsaval »

pathfinder wrote: Mon Nov 14, 2022 7:58 pm I sound like a broken record, but I think taking a look at how Blender does the adaptive grid may be interesting. If you zoom in or out, lines fade in or out and are replaced by other lines. Blender is mostly used in perspective mode, but it also works in orthographic mode or plane mode.
can you share a video and perhaps better explain how it works? not everyone here uses blender
User avatar
Chris_G
Veteran
Posts: 2579
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Sketcher grid : fundamental change

Post by Chris_G »

adrianinsaval wrote: Mon Nov 14, 2022 8:51 pm can you share a video and perhaps better explain how it works? not everyone here uses blender
If you have Curves WB installed, you can give a try at an old unfinished experiment to mimic Blender grid :

Code: Select all

from freecad.Curves import grid
grid.main()
Zoom in and out around origin, to see the fading effect
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher grid : fundamental change

Post by abdullah »

paddle wrote: Mon Nov 14, 2022 2:53 pm Current grid is drawn as a static 3D object centered on the sketch origin.
...
Please let me know your thoughts @abdullah, @uwestoehr, @wmayer (who's already reviewing the grid PR, I'm not just pinging all mergers :lol: ) and all other people interested of course.
I would like to keep an option to set the grid size to a given value, as an alternative to automatic grid resizing. Over a given density, I think it makes sense not to draw this fixed grid size (so, if let's say I have a gridsize of 0.40 mm, and I zoom out a lot, I think it should not be drawn, as it is both useless as a grid, and only contributes to slowing down), but redraw it again if, after zoom in, the grid density goes below a given quantity.

Some thoughts:
- If you strictly tie the grid to the camera, you will need to change the grid on every camera change. This may get slow when zooming in/out with the wheel.
- If you want a sketcher specific grid, then the place to code it is in ViewProviderSketch, or better, in a new coinmanager class that encapsulates all the node changes and additions (so a delegate). You may look at the coinmanager classes that handle all the remaining coin operations for inspiration. This helps keep ViewProviderSketch size under control. If you think your approach is good for other WBs, including Draft WB, then you may generalise the code there.

@openBrain
Would you like to review this PR?
User avatar
paddle
Veteran
Posts: 1391
Joined: Mon Feb 03, 2020 4:47 pm

Re: Sketcher grid : fundamental change

Post by paddle »

abdullah wrote: Tue Nov 15, 2022 12:38 pm I would like to keep an option to set the grid size to a given value, as an alternative to automatic grid resizing.
I'm keeping the fix size capability and it will act as you describe. Auto resize is an option.

I'm currently putting in ViewProviderSketch which was already pretty tought change to do.

Zooming in/on is not a problem there no slow down. I think the problem is more for paning. Though I have some ideas to mitigate that.
Last edited by paddle on Thu Nov 17, 2022 10:29 am, edited 1 time in total.
bleber
Posts: 259
Joined: Thu Jun 30, 2016 5:12 pm

Re: Sketcher grid : fundamental change

Post by bleber »

I thing that the grid only need to be around the work area to give a sense of proportions when sketching or make some change and need a reference..
Post Reply