Sketcher: Erase all sketch command

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
abdullah
Posts: 3578
Joined: Sun May 04, 2014 3:16 pm

Sketcher: Erase all sketch command

Postby abdullah » Sat Nov 04, 2017 3:39 pm

Hi!

This is for getting feedback.

Do you think it would be useful a button in sketcher edit mode to delete all the content of the sketch?

Background:
- Deleting is very slow on complex sketches. Even more if constraints are linked through expressions. It can get to several minutes to just delete the content of the sketch (e.g. to start over again).
- Why would I want to delete all the content? To start over again. Maybe you have already a lot of operations depending on that sketch you tried to modify but it went south. Now you want to just start over again in that sketch.

I am not sure if it would be useful or not, therefore I ask. There is no need to bloat the sketcher UI with commands if they are not useful. Just throw me your opinion. ;)
chrisb
Posts: 28972
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketcher: Erase all sketch command

Postby chrisb » Sat Nov 04, 2017 5:10 pm

There are already two possibilities to erase a sketch: Rubberband and the list of elements to the left. I personally don't need a third. What I would fancy though is the possibilty to select all elements with Ctrl-A, in the list as well as in 3D-View.
A Sketcher Lecture with in-depth information is available in English, auf deutsch, en français, en español.
HoWil
Posts: 1199
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Sketcher: Erase all sketch command

Postby HoWil » Sat Nov 04, 2017 7:09 pm

chrisb wrote:
Sat Nov 04, 2017 5:10 pm
What I would fancy though is the possibilty to select all elements with Ctrl-A, in the list as well as in 3D-View.
+1
It is very problematic that Ctrl+A selects in background everything in 3D while working on a 2D-Sketch.
BTW: When I red your question was my first guess ... Why not selecting everything with Ctrl-A and press Del.
BR
HoWil
chrisb
Posts: 28972
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketcher: Erase all sketch command

Postby chrisb » Sat Nov 04, 2017 11:59 pm

HoWil wrote:
Sat Nov 04, 2017 7:09 pm
Why not selecting everything with Ctrl-A and press Del.
That was my intention.
A Sketcher Lecture with in-depth information is available in English, auf deutsch, en français, en español.
abdullah
Posts: 3578
Joined: Sun May 04, 2014 3:16 pm

Re: Sketcher: Erase all sketch command

Postby abdullah » Sun Nov 05, 2017 7:01 am

chrisb wrote:
Sat Nov 04, 2017 11:59 pm
HoWil wrote:
Sat Nov 04, 2017 7:09 pm
Why not selecting everything with Ctrl-A and press Del.
That was my intention.
abdullah wrote:
Sat Nov 04, 2017 3:39 pm
Background:
- Deleting is very slow on complex sketches. Even more if constraints are linked through expressions. It can get to several minutes to just delete the content of the sketch (e.g. to start over again).
- Why would I want to delete all the content? To start over again. Maybe you have already a lot of operations depending on that sketch you tried to modify but it went south. Now you want to just start over again in that sketch.
The only problem with the current methods of deleting elements is time. Because they are designed for a partial deletion, each and every single element must be deleted at a time, involving an update of all the sketch. In complex sketches (with broken expressions) this can be as much as 15-20 minutes to delete some 60 constraint elements in a i7 computer (sometimes including several times the annoying modal pop-up about "duplicated constraint"). I think it is possible to improve the general method for deletion (now geometry elements and constraints have unique id, which could be exploited to improve it). It is in my list. However I do not have the time now for it.

Anyway, you provided me with the feedback I was expecting. A UI command is too much for it. I have created and I am testing a command that can be run from the python console, even out of sketch edit mode, that can achieve this cheap deletion of geometry. It would be something like:

Code: Select all

ActiveSketch = App.ActiveDocument.getObject('Sketch061')
ActiveSketch.deleteAllGeometry()
About Ctrl+A, mea culpa, it is by default assigned to the probably least useful shortcut in all FreeCAD, Internal Alignment Constraint. Something that clearly does not need a shortcut, because I guess almost nobody has ever used it manually (maybe only people who tested ellipses a couple of years ago) and for sure nobody uses it manually in a normal workflow. I think that "Ctrl+A" for selection is also locale dependent (maybe somebody not english, german, french can confirm this point). Probably it is best to rethink the whole sketch shortcuts first (it is something anybody could do, for example people from UX if they are interested). I would tend to think that Drafts WB way of shortcuts (e.g. C,L for clone) is a very elegant way of solving the issue. It may make sense to drop all CTRL or CTRL+SHIFT shortcuts. I think we need some kind of harmonisation here. Here we do not need a coder/developer. We need somebody with a sense of ergonomics.

(marketing mode on)So if you are reading this and you would like to contribute to your favourite CAD software, maybe you could start a thread in UX subforum (I think it belongs there) to make FreeCAD a little bit more yours. Remember actual users are suffering frustrated with the current shortcuts of the Sketcher. You can make the difference. Thousands of happy users will show you gratitude for it. It is within the reach of your hands. Do not let this opportunity pass you by and open the thread right now. (marketing mode off).
chrisb
Posts: 28972
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketcher: Erase all sketch command

Postby chrisb » Sun Nov 05, 2017 7:19 am

I was afraid that the execution of the delete was the time consuming part. I looked at the menu of Part Design, which is not too crowded. Such a function could find its place in PartDesign->SketcherTools.
I have thought about simply deleting and recreating the sketch but if it is in the middle of the dependency graph this is no option.
Last edited by chrisb on Sun Nov 05, 2017 8:33 pm, edited 1 time in total.
A Sketcher Lecture with in-depth information is available in English, auf deutsch, en français, en español.
abdullah
Posts: 3578
Joined: Sun May 04, 2014 3:16 pm

Re: Sketcher: Erase all sketch command

Postby abdullah » Sun Nov 05, 2017 6:44 pm

I have put it here:
DeleteAllGeometry.png
DeleteAllGeometry.png (146.57 KiB) Viewed 866 times
abdullah
Posts: 3578
Joined: Sun May 04, 2014 3:16 pm

Re: Sketcher: Erase all sketch command

Postby abdullah » Sun Nov 05, 2017 6:46 pm

User avatar
microelly2
Posts: 4690
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Sketcher: Erase all sketch command

Postby microelly2 » Sun Nov 05, 2017 7:12 pm

It's good to have such a method.
I think we should think on more methods too.

In my feedbacksketches I use the method to set all constraints to blue and then step by step set them back to red to find the last level
where my problem is still solveable.
in a sketch with no red constraints it's easy to bring all in a wished position and
then freeze it and add the real problem.
this is a good way to separate problems.
As discussed some month ago hiding some constraints would be a big step forward to clean up the environment.
abdullah
Posts: 3578
Joined: Sun May 04, 2014 3:16 pm

Re: Sketcher: Erase all sketch command

Postby abdullah » Mon Nov 06, 2017 4:15 pm

microelly2 wrote:
Sun Nov 05, 2017 7:12 pm
As discussed some month ago hiding some constraints would be a big step forward to clean up the environment.
It is not forgotten ;)

I have several improvements for the sketcher in the pipeline, but it is getting challenging to find time for it :(

Anyway do not hesitate to remind me from time to time...