[Bug?] Cosmetic CenterLines misbehave if the face/edges they are based on disappear

Discussions about the development of the TechDraw workbench
aapo
Posts: 93
Joined: Mon Oct 29, 2018 6:41 pm

[Bug?] Cosmetic CenterLines misbehave if the face/edges they are based on disappear

Postby aapo » Mon Nov 04, 2019 6:55 pm

Hi!

I've noticed that the Cosmetic CenterLines misbehave if the faces/edges they are based on disappear. The faces or edges may disappear, if one edits the underlying 3D model. Obviously, the centerlines cannot be re-drawn, if the geometry they are based on does not exist any more. However, currently I've experienced a lot of errors and even crashes, when trying to delete dimensions or centerlines under such situation. Moreover, it is impossible to erase a cosmetic line that is not possible to be drawn anymore, as it also cannot be selected, because it could not be drawn on the screen. I have attached a simple FCStd file where there are a lot of recompute errors and unknown exceptions, because the faces that the Cosmetic CenterLines are based on, have been (intentionally) erased from the 3D geometry.

So, in the screenshot below, the TechDraw PorjGroup Views are not updated to reflect the 3D geometry, due to the errors caused by the recompute of impossible CenterLines. As these impossible CenterLines cannot (and should not) be drawn, I would suggest that there should be an algorithm to test for missing edges/faces of CenterLines, and permanently delete all CenterLines that are based on missing 2D geometry.

At least in my case, I'm not able to manually erase the offending CenterLines in the attached file; if I press the erase icon, then nothing happens. There is a workaround, however: if the 3D-geometry is fixed to match the 2D-geometry, then the CenterLines become "alive" again, and they can be erased. After that, changing the 3D geometry works as expected, and the TechDraw drawing again shows the correct geometry. Also, the unknown exceptions sometimes cause FreeCAD to crash, when trying to erase dimensions or cosmetic geometry; or sometimes even when exiting Sketcher (if FreeCAD decides to recompute the TechDraw drawing at that point).

Also, completely unrelated, the angle dimension seems to be missing the degree sign. However, it can be added manually, so it kind of works; but in earlier TechDraw versions it appeared automatically.

Code: Select all

CL::calcEndPoints - faceBox is void!
4.9e-08 <App> Document.cpp(3451): Unknown exception in _0191104__FreeCAD_TechDraw_Centerline_bug#ProjItem thrown
CL::calcEndPoints - faceBox is void!
0.0187972 <App> Document.cpp(3451): Unknown exception in _0191104__FreeCAD_TechDraw_Centerline_bug#ProjItem002 thrown
Recompute failed! Please check report view.
CL::calcEndPoints - faceBox is void!
0.079459 <App> Document.cpp(3451): Unknown exception in _0191104__FreeCAD_TechDraw_Centerline_bug#ProjItem thrown
CL::calcEndPoints - faceBox is void!
0.0881563 <App> Document.cpp(3451): Unknown exception in _0191104__FreeCAD_TechDraw_Centerline_bug#ProjItem002 thrown
Recompute failed! Please check report view.
20191104 _FreeCAD_TechDraw_Centerline_bug.png
20191104 _FreeCAD_TechDraw_Centerline_bug.png (179.85 KiB) Viewed 121 times


Trying to edit the CenterLines that are in the misbehaving state in the example file, causes the following error every time the edit icon is pressed:

Code: Select all

C++ exception thrown (vector::_M_range_check: __n (which is 14) >= this->size() (which is 7))
C++ exception thrown (vector::_M_range_check: __n (which is 7) >= this->size() (which is 4))
C++ exception thrown (vector::_M_range_check: __n (which is 7) >= this->size() (which is 4))
C++ exception thrown (vector::_M_range_check: __n (which is 7) >= this->size() (which is 4))
C++ exception thrown (vector::_M_range_check: __n (which is 7) >= this->size() (which is 4))

OS: Debian GNU/Linux bullseye/sid (KDE//usr/share/xsessions/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18670 (Git)
Build type: Unknown
Branch: master
Hash: 2f5b2bc83dd0d86ea4dc2e239625e1c9a0cacb23
Python version: 3.7.5
Qt version: 5.11.3
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
Attachments
20191104 _FreeCAD_TechDraw_Centerline_bug.FCStd
(27.96 KiB) Downloaded 3 times
User avatar
wandererfan
Posts: 3144
Joined: Tue Nov 06, 2012 5:42 pm

Re: [Bug?] Cosmetic CenterLines misbehave if the face/edges they are based on disappear

Postby wandererfan » Mon Nov 04, 2019 11:54 pm

aapo wrote:
Mon Nov 04, 2019 6:55 pm
I've noticed that the Cosmetic CenterLines misbehave if the faces/edges they are based on disappear. The faces or edges may disappear, if one edits the underlying 3D model. Obviously, the centerlines cannot be re-drawn, if the geometry they are based on does not exist any more.
Thanks for the feedback. I'll see what I can do to make CenterLines more "robust".
User avatar
wandererfan
Posts: 3144
Joined: Tue Nov 06, 2012 5:42 pm

Re: [Bug?] Cosmetic CenterLines misbehave if the face/edges they are based on disappear

Postby wandererfan » Mon Nov 04, 2019 11:56 pm

aapo wrote:
Mon Nov 04, 2019 6:55 pm
Also, completely unrelated, the angle dimension seems to be missing the degree sign. However, it can be added manually, so it kind of works; but in earlier TechDraw versions it appeared automatically.
Might have fallen off in the big standards compliance rewrite. I'll have a look.