[Merged] Refactoring ViewProviderSketch

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!
Post Reply
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Refactoring ViewProviderSketch

Post by adrianinsaval »

:o what do you think about using that drawing style by default for construction geometry?
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Refactoring ViewProviderSketch

Post by abdullah »

adrianinsaval wrote: Mon Dec 06, 2021 12:31 pm :o what do you think about using that drawing style by default for construction geometry?
I do not quite like to impose defaults. Some may like that, others may not like it:
Screenshot_20211206_135751.png
Screenshot_20211206_135751.png (80.8 KiB) Viewed 1914 times
The idea is that a layer can have a different drawstyle, meaning dashes, or line with, or anything else that can be done with a DrawStyle in Coin. Any geometry assigned to this layer will have that drawstyle. Above, what I did is move the construction geometries to layer 1, which has that style. Layer 0 is the usual sketcher drawstyle.

So a configuration option may create by default a first layer with this dashed style. Another option may add construction geometry to the dashed style layer by default. Maybe this idea can be improved. But we are not there yet...
User avatar
-alex-
Veteran
Posts: 1856
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: Refactoring ViewProviderSketch

Post by -alex- »

adrianinsaval wrote: Mon Dec 06, 2021 12:31 pm using that drawing style by default for construction geometry?
+1
Would be great for blind color users.
My 2 cts

PS: Would be greater if dashed construction lines could be displayed and selected outside of the sketch edit mode.
In this way construction elements could be used as reference geometries only, but not to pad as solid objects (pad, sweep, etc).
But it was already discussed in other topic, and IIRC is not easy to code.

BTW: great job here!
Last edited by -alex- on Mon Dec 06, 2021 2:54 pm, edited 1 time in total.
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Refactoring ViewProviderSketch

Post by openBrain »

-alex- wrote: Mon Dec 06, 2021 2:45 pm Would be great for blind color users.
IIRC, @abdullah already has great concern about that. :D
User avatar
-alex-
Veteran
Posts: 1856
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: Refactoring ViewProviderSketch

Post by -alex- »

abdullah wrote: Mon Dec 06, 2021 12:52 pm I do not quite like to impose defaults.
I guess I see your point. But in my opinion "defaut" settings are always imposed. Isn't it?
IMHO dashed style for construction lines is the very best default setting.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Refactoring ViewProviderSketch

Post by abdullah »

-alex- wrote: Mon Dec 06, 2021 3:02 pm
abdullah wrote: Mon Dec 06, 2021 12:52 pm I do not quite like to impose defaults.
I guess I see your point. But in my opinion "defaut" settings are always imposed. Isn't it?
IMHO dashed style for construction lines is the very best default setting.
There are several use cases and there might be performance considerations.

Use cases

Let's assume we impose that construction lines are into a second layer with dashed drawstyle. Now imagine that you have a very complicated sketch, the result of recursive use of carbon copy on a master sketch. You may prefer to use dashed drawstyle for the master sketch geometry only. Imposing the default renders this a lost opportunity.

There is nobody else better than the users and power users of this community to find creative use cases. I want to enable you to use your creativity. This is why:

1) I want to finish and merge this refactor. Refactors should not add additional functionality. This refactor is borderline because one objective is to separate functionalities to support multiple layers. But I am committed to keep new functionality to bare minimum (the user should not see any modification at all in the refactored code).

2) Then I want to code a generic UI so that you can create your layers, assign different representation properties to different layers, assign your geometry to different layers. Hide layers (except for layer 0, that contains the root point and the axes and cannot be hidden).

3) Then half a year or a full year later, I want to look into what you have come with. What is really useful for you. Layers is not only about different representation or hiding. It is also about management of geometry. Should carbon copy import the underlying sketch as a layer? Should carbon copy import all the layers of the underlying sketch as different layers? Should carbon copy enable some degree of synchronisation taking advantage that now we may know exactly what we "imported"?

You will tell me ;)

Performance

If different styles and coin layers did not come with a penalty, one could have expected that the creators of the sketcher had implemented it directly like that. After all, they are much more competent than I am.

While the performance is not noticeable for two layers in my computer. I know that among you there will be at least one, probably tens of you, that will try to do sketcher animations. Those tens will not like to have such default, if that means that they can generate less frames or if it increases substantially the animation time.

Another situation may be these users running 1000 elements and 1000 constraints. It might have an impact on them too. Not sure. You will tell me :D :D :D

Of course, what is found useful can be made into a profile for those user that want that behaviour.
chrisb
Veteran
Posts: 53920
Joined: Tue Mar 17, 2015 9:14 am

Re: Refactoring ViewProviderSketch

Post by chrisb »

Looks great! If the thickness can be adjusted too, then the problem which kind of lines to have on top - real or construction - would be minimized.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Refactoring ViewProviderSketch

Post by abdullah »

chrisb wrote: Mon Dec 06, 2021 4:35 pm Looks great! If the thickness can be adjusted too, then the problem which kind of lines to have on top - real or construction - would be minimized.
Sure. The line width can be adjusted too.

HakanSeven12 posted a nice list of dashed styles:
https://forum.freecadweb.org/viewtopic. ... 0&p=524538
User avatar
-alex-
Veteran
Posts: 1856
Joined: Wed Feb 13, 2019 9:42 pm
Location: France

Re: Refactoring ViewProviderSketch

Post by -alex- »

abdullah wrote: Mon Dec 06, 2021 3:32 pm Let's assume we impose that construction lines are into a second layer with dashed drawstyle. Now imagine that you have a very complicated sketch, the result of recursive use of carbon copy on a master sketch. You may prefer to use dashed drawstyle for the master sketch geometry only. Imposing the default renders this a lost opportunity.
I can imagine this use case, but as I'm concerned I will not practice this way, because AFAIK:
- complicated sketches is not a good practice
- carbone copy is useful, but CPU consuming
However I understand that some users could want to use such workflow, if so I wish good luck to them ;)

There is nobody else better than the users and power users of this community to find creative use cases. I want to enable you to use your creativity. This is why:
1)
2)
3)
Sounds like a large plan, well elaborated. So I trust in your vision and I'm exited to test someday :)

Performance
On this point I'm not sure to agree with you. IMO you can not consider what is an extrem use of sketch from some users to mind the global design of sketcher WB.
IMO a reliable and flexible workflow is:
- a lot of small and simple sketches
- a lot of simple features
- a reliable topological behavior -> FC Linkstage3 branch ATM
If some users like big and complicated sketches, they should better use LibreCAD with static sketches.
But maybe I miss the point here or I get you wrong.
So, I should not comment too much maybe. I let you code quietly ;)
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Refactoring ViewProviderSketch

Post by abdullah »

-alex- wrote: Mon Dec 06, 2021 11:47 pm I can imagine this use case, but as I'm concerned I will not practice this way, because AFAIK:
- complicated sketches is not a good practice
- carbone copy is useful, but CPU consuming
However I understand that some users could want to use such workflow, if so I wish good luck to them ;)
I like carbon copy a lot. In the past I was addicted. I have undergone my own detox. I would like to improve it so that I still get the kick without the negative consequences (mostly when the master sketch needs to be changed after the whole model is already finished). As for CPU consuming, carbon copy is not CPU consuming (unless you belong to the big sketchs guys), the chaining of recomputes may well be CPU consuming... but the chain of recomputes is what enables to change one parameter and rebuild your model automatically (subject to you having taken precautions to make your model robust)...
-alex- wrote: Mon Dec 06, 2021 11:47 pm On this point I'm not sure to agree with you. IMO you can not consider what is an extrem use of sketch from some users to mind the global design of sketcher WB.
IMO a reliable and flexible workflow is:
- a lot of small and simple sketches
- a lot of simple features
- a reliable topological behavior -> FC Linkstage3 branch ATM
If some users like big and complicated sketches, they should better use LibreCAD with static sketches.
But maybe I miss the point here or I get you wrong.
So, I should not comment too much maybe. I let you code quietly ;)
I agree with your list (except that I prefer to stay with the Official FC master). That is basically what 90% of the users should do to construct their models. Every user should imagine Chrisb whispering these things upon start of a new model. Ok, maybe not whispering... just imagine the virtual ruler that is going to hit your fingers if you dare to... :lol: Now, FreeCAD is about enabling people. I want to enable that extra 10% who, for whatever reasons, need to handle big sketches or like to do animations, or may have a once in a while specific need. I am not mainstream (life would have been easier for me if I were). I think it is possible to cover substantially well the needs of the 90% while enabling the 10% to use it their way. I do not let any user behind ;)
Post Reply