Issue #7376 - [Bug] Link to TechDraw template is lost when a document is resaved

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
bensay
Posts: 202
Joined: Wed Dec 22, 2021 8:14 pm
Location: Danmark
Contact:

Issue #7376 - [Bug] Link to TechDraw template is lost when a document is resaved

Post by bensay »

The link to the TechDraw template is lost when doing "Save as" after the file has already been saved. The issue is confirmed on both MacOS and Ubuntu. Steps to reproduce:
1) Create a new Document in FreeCAD
2) Add a new TechDraw page in the TechDraw workbench
3) Save the document in a location
4) Close the document internally (close the tabs but keep the same FreeCAD window open)
5) Reopen the same document
6) Save the document by "Save as" with a new filename
7) Make a change in the template field (eg. date) and recompute it
The connection to the template should now be lost

Reported by the bughunter @wolflu05

Video for lazy purposes: https://youtu.be/tWtotlsUQZM (credits once again to @wolflu05)

This issue is the same as https://forum.freecadweb.org/viewtopic.php?t=25081 but under a different use case that a lot more common: it is simply if the file is re-saved and not necessarily making a copy and closing one of the copies after having both open. I have made a GitHub issue so it won't be lost: https://github.com/FreeCAD/FreeCAD/issues/7376
Last edited by Kunda1 on Sun Aug 21, 2022 2:52 pm, edited 3 times in total.
Reason: Added GH ticket number to thread title
user1234
Veteran
Posts: 3319
Joined: Mon Jul 11, 2016 5:08 pm

Re: [Bug] Link to TechDraw template is lost when a document is resaved

Post by user1234 »

bensay wrote: Wed Aug 17, 2022 10:01 pm 7) Make a change in the template and recompute it
What kind of change in the template? The properties are locked, except the label. When i change the label, nothing unexpected happens.

Greetings
user1234
User avatar
bensay
Posts: 202
Joined: Wed Dec 22, 2021 8:14 pm
Location: Danmark
Contact:

Re: [Bug] Link to TechDraw template is lost when a document is resaved

Post by bensay »

user1234 wrote: Wed Aug 17, 2022 10:07 pm
bensay wrote: Wed Aug 17, 2022 10:01 pm 7) Make a change in the template and recompute it
What kind of change in the template? The properties are locked, except the label. When i change the label, nothing unexpected happens.

Greetings
user1234
A label change.
After having saved as under a new filename, changed a label and then recomputing the template, you should get a linkage error.
See the video if necessary
user1234
Veteran
Posts: 3319
Joined: Mon Jul 11, 2016 5:08 pm

Re: [Bug] Link to TechDraw template is lost when a document is resaved

Post by user1234 »

bensay wrote: Wed Aug 17, 2022 11:06 pm See the video if necessary
The videos was not working before, it was on privae. Now it works.

bensay wrote: Wed Aug 17, 2022 11:06 pm A label change.
A label (properties) change works, but not an editable field (like in the video). So i can confirm the issue.

Code: Select all

Log: DrawSVGTemplate::execute() not able to open /home/user/.cache/FreeCAD/Cache/FreeCAD_Doc_56ae100c-648e-4328-898b-e1d82ee7dcd1_7b1132_49315/A4_Landscape_ISO7200TD.svg!
Log: DrawSVGTemplate::execute() not able to open /home/user/.cache/FreeCAD/Cache/FreeCAD_Doc_56ae100c-648e-4328-898b-e1d82ee7dcd1_7b1132_49315/A4_Landscape_ISO7200TD.svg!
Err: Recompute failed! Please check report view.

Code: Select all

OS: Debian GNU/Linux 11 (bullseye) (X-Cinnamon/lightdm-xsession)
Word size of FreeCAD: 64-bit
Version: 0.21.30092 (Git)
Build type: Release
Branch: master
Hash: f2ba030ebb12c0d0a96a9d7aabdc02aa8ba89dda
Python 3.9.2, Qt 5.15.2, Coin 4.0.0, Vtk 9.0.1, OCC 7.6.3
Locale: English/United States (en_US)

Greetings
user1234
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: [Bug] Link to TechDraw template is lost when a document is resaved

Post by chrisb »

bensay wrote: Wed Aug 17, 2022 10:01 pm I have made a GitHub issue so it won't be lost: https://github.com/FreeCAD/FreeCAD/issues/7376
It is ok, now that the issue is confirmed. But please follow in the future our bug reporting process, which says to discuss an issue before creating a report. Otherwise we get tons of reports which actually are none.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
wandererfan
Veteran
Posts: 6265
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: [Bug] Link to TechDraw template is lost when a document is resaved

Post by wandererfan »

Most of the Template code is original and needs a big overhaul. I don't expect to look at this issue until that overhaul takes place.
User avatar
bensay
Posts: 202
Joined: Wed Dec 22, 2021 8:14 pm
Location: Danmark
Contact:

Re: [Bug] Link to TechDraw template is lost when a document is resaved

Post by bensay »

wandererfan wrote: Thu Aug 18, 2022 2:52 pm Most of the Template code is original and needs a big overhaul. I don't expect to look at this issue until that overhaul takes place.
Can you give some more details about the overhaul? Maybe it will be on my todo list
User avatar
wandererfan
Veteran
Posts: 6265
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: [Bug] Link to TechDraw template is lost when a document is resaved

Post by wandererfan »

bensay wrote: Thu Aug 18, 2022 7:33 pm Can you give some more details about the overhaul? Maybe it will be on my todo list
Off the top of my head:
- replace the green dots and dialogs with proper data entry fields on the page
- handle PropertyFileIncluded with setup and replace functions as in DrawHatch, DrawGeomHatch, etc
- move the Svg parsing code out of execute(), similar to DrawSymbol
- clean up onChanged

The second item will probably fix the issue reporting in this post.
Post Reply