[Bug] A non-editable Draft projection produces strange behavior when trying to edit it

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!
Post Reply
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

[Bug] A non-editable Draft projection produces strange behavior when trying to edit it

Post by vocx »

The Draft_Shape2DView tool allows you to create a 2D projection of a 3D object created from Part Module or Part PartDesign_Workbench. This 2D object is not editable, as it's just a flat projection.

However, if you double click this projection in the model tree it gets a yellow highlight. A message with "This object type is not editable" is shown in the Report view.
FreeCad_Draft_non-editable_01.png
FreeCad_Draft_non-editable_01.png (119.41 KiB) Viewed 644 times
When the non-editable object is highlighted like this, pressing the «Delete» key in the keyboard doesn't perform a delete action, but a recompute of the model.

The «Delete» key normally produces an App.getDocument("draft_projection").removeObject("some_object") command, as can be seen from the Python console.
  1. When a non-editable object is double-clicked, this produces a Gui.ActiveDocument.setEdit('Shape2DView',0) command, and the yellow highlight.
  2. Then, pressing the «Delete» key produces App.getDocument("draft_projection").recompute().
This is confusing because if you accidentally double click a non-editable element in the model tree, you cannot delete other elements until the highlight is removed. The highlight cannot be deactivated until you press the «Escape» key in the keyboard, or you edit an editable object.

In the image above, you can obviously see the Shape2DView is selected, but this is not evident if there are many objects in the model tree, or if these are inside Std_Groups. I came across this bug when I was modelling a building with many elements, walls, doors, wires, projections, etc. Sometimes I couldn't delete elements and I didn't know why; I didn't understand why the «Delete» key would produce recomputes and not deletes. I practically had to close the model and open it again to restore the model to continue working on it. Only after many days (years?) did I find what was causing this issue.

The expected behavior is that, when double-clicked, the non-editable Draft_Shape2DView should (1) show the translate dialog to move or rotate the object (image below), or (2) not respond to edit attempts at all and not show the yellow highlight.

I suppose this yellow highlight indicates that the element is in an "Edit" state. Other elements quickly flash in yellow when they are edited but the Shape2DView, since it's non-editable, gets stuck in this state, it seems.
FreeCad_Draft_non-editable_02.png
FreeCad_Draft_non-editable_02.png (78.23 KiB) Viewed 644 times
OS: Ubuntu 18.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.14995 (Git)
Build type: Release
Branch: master
Hash: 7b866816785ac1ca9787b63d4bff12873bb3a593
Python version: 2.7.15rc1
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
Attachments
draft_projection.FCStd
(35.92 KiB) Downloaded 25 times
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
chrisb
Veteran
Posts: 54168
Joined: Tue Mar 17, 2015 9:14 am

Re: [Bug] A non-editable Draft projection produces strange behavior when trying to edit it

Post by chrisb »

If I double click on a Shape2DView, the object does not turn yellow, and does not block anything, instead the grid is reinitialized (which is a pain). The object changes nevertheless its state, and I get the same message in report view.
vocx wrote: Sun Oct 21, 2018 11:17 pm The highlight cannot be deactivated until you press the «Escape» key in the keyboard, or you edit an editable object.
I guess you can use the RMB context menu and select "Finish editing" as well.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: [Bug] A non-editable Draft projection produces strange behavior when trying to edit it

Post by vocx »

chrisb wrote: Mon Oct 22, 2018 5:47 am If I double click on a Shape2DView, the object does not turn yellow, and does not block anything, instead the grid is reinitialized (which is a pain). The object changes nevertheless its state, and I get the same message in report view.
vocx wrote: Sun Oct 21, 2018 11:17 pm The highlight cannot be deactivated until you press the «Escape» key in the keyboard, or you edit an editable object.
I guess you can use the RMB context menu and select "Finish editing" as well.
Don't click the object itself in the 3D viewport, double click the object in the tree view, to the left, as shown in the first picture.

Yes, I can use right click and Finish editing. But imagine the object is inside a Group, so you cannot see what object is actually edited (yellow in my case).

I think you are using Qt5? I'm still on Qt4.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
chrisb
Veteran
Posts: 54168
Joined: Tue Mar 17, 2015 9:14 am

Re: [Bug] A non-editable Draft projection produces strange behavior when trying to edit it

Post by chrisb »

vocx wrote: Mon Oct 22, 2018 6:07 am Don't click the object itself in the 3D viewport, double click the object in the tree view, to the left, as shown in the first picture.
That's what I did. I didn't distinguish clearly in my post between tree view and 3D view.
I think you are using Qt5? I'm still on Qt4.
Yes, and different OS.

OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.14976 (Git)
Build type: Release
Branch: (HEAD detached at e79a19828)
Hash: e79a19828e2e92269ff96110dfeadaa245ad17c2
Python version: 2.7.15
Qt version: 5.11.2
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: German/Germany (de_DE)
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply