Sketcher - Processing issue

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
Pauvres_honteux
Posts: 728
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: Sketcher - Processing issue

Post by Pauvres_honteux »

abdullah wrote:
Wonder if using some sort of "is_touched"-flag could be exploited here?

For example: attach a "flag" to each element and then 'just' check them. I don't know, but in my world it sounds cheap with respect to cpu clock cycles?
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher - Processing issue

Post by abdullah »

Pauvres_honteux wrote: Fri Dec 03, 2021 6:26 am
abdullah wrote:
Wonder if using some sort of "is_touched"-flag could be exploited here?

For example: attach a "flag" to each element and then 'just' check them. I don't know, but in my world it sounds cheap with respect to cpu clock cycles?
Reality is more complicated than that.

There two sides:
a) the change on the sketch does not modify the end shape generated, but intermediate operations changed the end shape (Auto-update on).
b) the change on the sketch does not modify the end shape generated and the intermediate operations did not change the end shape.
c) the change on the sketch modifies the end shape, but I really wished I hadn't modify the sketch at all, so I want to cancel.
d) the change on the sketch modifies the end shape and I want to modify it.

in a) you need to recompute the shape and this will trigger recomputes on all dependant objects. No way to avoid this.

in c) one can generally undo the operations. There could be a functionality to undo everything in one go (set the properties back to the state they had upon entering the sketch in edit mode). I am not sure how much such a feature would be used. It is likely something in the order of 0,1% of the cases. However, here you will need to solve and recompute.

in d) you need the recompute.

This leads to the very specific case b). Here you have:
case b1) you did modify the sketch object, but your modification did not modify the end shape (you added reference constraints or construction geometry only).

case b2) you did not do anything at all (open/close).

In b1) you definitely need to solve the equation system, but you could spare the recompute. In b2) you could spare both.

The problem here is tracking the changes. I guess one could leverage the hash of each geometry, excluding the construction ones. I am unsure however, if this would be meaningful having regard to the frequency of occurrence of such event.

In fact, I would go deeper into what is the root cause of entering edit mode of a sketch in case b2. If the issue is that one does not know what is being opened, then the solution might rather come from helping the use better decide what to open (for example by visual aids before entering edit mode).
User avatar
Pauvres_honteux
Posts: 728
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: Sketcher - Processing issue

Post by Pauvres_honteux »

abdullah wrote: Sat Dec 04, 2021 5:56 am
a) the change on the sketch does not modify the end shape generated, but intermediate operations changed the end shape (Auto-update on).
Make Auto-update "flag"-aware? I mean, if user did something that did not affect the end shape or its orientation, then I, as a user, expect the sketch to remain "untouched" and therefor shall not be updated at all.


b) the change on the sketch does not modify the end shape generated and the intermediate operations did not change the end shape.
With the flag principle it would just be a matter of checking "is_touched flag" set or not. No need to compare anything.


c) the change on the sketch modifies the end shape, but I really wished I hadn't modify the sketch at all, so I want to cancel.

TheMarkster wrote: Wed Dec 01, 2021 2:10 am ... make a copy of the sketch when opening the task dialog, and then when the user cancels restore the sketch from the copy.
Adding: if "is_touched"-flag is set then delete sketch copy.


d) the change on the sketch modifies the end shape and I want to modify it.
Here the "is_touched"-flag is set. Go ahead and do what is done today, i.e. no change of behaviour.


in a) you need to recompute the shape and this will trigger recomputes on all dependant objects. No way to avoid this.
This will be on the user account. She/he will be fully accountable for clicking the recompute button. No shadow shall fall on the programmer in this case.
Same goes for "Auto-update on".


in c) ... I am not sure how much such a feature would be used. It is likely something in the order of 0,1% of the cases.
Hmmm, 0,1% = 1/1000 of opened sketches. That sounds too low compared to what I'm experiencing at work.


The problem here is tracking the changes. I guess one could leverage the hash of each geometry, excluding the construction ones.
Hashing, I would say, sound like an excellent idea!


... what is the root cause of entering edit mode of a sketch in case b2. If the issue is that one does not know what is being opened, then the solution might rather come from helping the use better decide what to open (for example by visual aids before entering edit mode).
All visual aids are welcomed with open arms! Even small aids goes a long way.
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketcher - Processing issue

Post by chrisb »

abdullah wrote: Sat Dec 04, 2021 5:56 am in c) one can generally undo the operations. There could be a functionality to undo everything in one go (set the properties back to the state they had upon entering the sketch in edit mode). I am not sure how much such a feature would be used. It is likely something in the order of 0,1% of the cases. However, here you will need to solve and recompute.
I would rate this higher. If a recompute could be avoided, then this would cover b2 as well.
case b2) you did not do anything at all (open/close).
I do this quite often, and for me it would be sufficient if only this use case was improved with not recomputing. One rather special and thus in general neglectable use case is my work as helper here, where I check many foreign sketches. But I do this with my own models too, inspect references, look up names, ...
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: Sketcher - Processing issue

Post by abdullah »

chrisb wrote: Sat Dec 04, 2021 10:04 am I do this quite often, and for me it would be sufficient if only this use case was improved with not recomputing. One rather special and thus in general neglectable use case is my work as helper here, where I check many foreign sketches. But I do this with my own models too, inspect references, look up names, ...
Ok. Put it in the tracker and I will eventually take a look.
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketcher - Processing issue

Post by chrisb »

abdullah wrote: Sat Dec 04, 2021 11:19 pm Thanks!
issue #4797
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
leoheck
Veteran
Posts: 1222
Joined: Tue Mar 13, 2018 5:56 pm
Location: Coffee shop

Re: Sketcher - Processing issue

Post by leoheck »

I also would say that my rate of entering on edit mode is definitely pretty higher than that.

Actually, I enter the edit mode, every time. I would rather call it to view mode. Where I can (re)view my constraints. Otherwise, I have to guess what I made before.

another problem of recalculating every time it is not the recomputation itself, but the domino effect that, then, recomputes the next features and also other linked objects.
leoheck
Veteran
Posts: 1222
Joined: Tue Mar 13, 2018 5:56 pm
Location: Coffee shop

Re: Sketcher - Processing issue

Post by leoheck »

This cancel button - that reverts to a previous copy of the feature - could be applied to this scenario too.

Here one more digit was entered on the input field by mistake (this happens a lot). Far more than 1/1000.

And don't get this wrong. But the operation does not succeed yet. The green text is an old text. It should have been updated before doing the computation to something like... "Processing the transformation..."

Then Freecad dies. There is no escape from it. The operation has to end or I have to close the software. Closing the software is the worst thing that may happen.

I cannot confirm now since this thing is still processing... but one possible way to harden this is to have the whole text selected when the input field is clicked, any mistake will override the old value. But the same issue still may occur.
Screenshot-20211215110747-650x691.png
Screenshot-20211215110747-650x691.png (42.78 KiB) Viewed 1350 times
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Sketcher - Processing issue

Post by adrianinsaval »

uncheck update view for stuff that takes a lot to process
User avatar
Pauvres_honteux
Posts: 728
Joined: Sun Feb 16, 2014 12:05 am
Location: Far side of the moon

Re: Sketcher - Processing issue

Post by Pauvres_honteux »

leoheck wrote: Wed Dec 15, 2021 6:50 am ... another problem of recalculating every time it is not the recomputation itself, but the domino effect that, then, recomputes the next features and also other linked objects.
Hi leoheck, that particular thing may be covered by this feature request: [Ticket #4728] Local update function/button

In short it would "recompute up to here", that is, where you set Tip or where you right clicked and chose "recompute up to here" in the popup menu.
Post Reply