[BUG?] [App::Link] Partial Document Loading Issue (Link not restored) in 19.1

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
gbroques
Posts: 106
Joined: Thu Jan 23, 2020 3:28 am
Location: St. Louis, Missouri

[BUG?] [App::Link] Partial Document Loading Issue (Link not restored) in 19.1

Postby gbroques » Fri Apr 09, 2021 12:18 am

Can anyone please help me with what seems to be a partial document loading issue in my project?

---
  • Any common gotchas that can cause a link to not be restored?
  • Any common fixes for a non restorable link?
See the below screenshot and Steps to Reproduce.
realthunder wrote:
partial-document-loading-error.png
partial-document-loading-error.png (80.81 KiB) Viewed 219 times
REPORT VIEW
19:06:53 <PropertyLinks> PropertyLinks.cpp(2646): object 'Body' not found in document 'Flange'
19:06:53 1.119e-06 <App> Document.cpp(2857): Hub#Link.LinkedObject: Link not restored
Linked object: Body
Linked document: Flange

19:06:53 0.237285 <App> Document.cpp(2855): Alternator#Link.LinkedObject: Time stamp changed on link Hub#Part


STEPS TO REPRODUCE I can manually fix this by:
  • Double-clicking the document where the link was not restored (i.e. Flange.FCStd).
  • Going back to the document with the non restored link and recomputing the object containing the link (i.e. recompute Hub in Alternator.FCStd).
However, I have requirements that this needs to be automatically loaded without manual user intervention.

FREECAD ABOUT

Code: Select all

OS: Ubuntu 20.04.2 LTS (ubuntu:GNOME/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24276 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 0.19.1)
Hash: a88db11e0a908f6e38f92bfc5187b13ebe470438
Python version: 3.8.8
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United States (en_US)
Last edited by gbroques on Sat Apr 10, 2021 2:53 pm, edited 3 times in total.
User avatar
gbroques
Posts: 106
Joined: Thu Jan 23, 2020 3:28 am
Location: St. Louis, Missouri

Re: [App::Link] Partial Document Loading Issue in 19.1

Postby gbroques » Fri Apr 09, 2021 12:56 am

I've seemed to have fixed this problem and found a workaround (checkout commit 2b542c0f23ab105063).

The problem seemed to be caused by a document (Alternator) containing two references to a child document (Flange) -- where each of the two references were to two different objects:
  • The first reference is a direct reference to a spreadsheet in Flange from the spreadsheet in Alternator.
  • The second reference is a indirect reference via a direct Link to Hub, and Hub links to a body in Flange (which is the link that fails to restore).
Note, Flange is not an immediate child of Alternator.

The document relationship hierarchy is:
Alternator -> Hub -> Flange

I fixed this by removing the following reference in the spreadsheet to the Flange document, and instead hardcoding MiddlePadThickness in the Alternator spreadsheet (see below before and after screenshots).

Is this a bug, or expected behavior?

---

BEFORE FIX
spreadsheet-reference-document.png
spreadsheet-reference-document.png (93.2 KiB) Viewed 196 times
---

AFTER FIX
after-fix-middle-flange-pad-hardcoed.png
after-fix-middle-flange-pad-hardcoed.png (83.29 KiB) Viewed 189 times
Last edited by gbroques on Sat Apr 10, 2021 3:02 pm, edited 3 times in total.
realthunder
Posts: 1963
Joined: Tue Jan 03, 2017 10:55 am

Re: [BUG?] [App::Link] Partial Document Loading Issue in 19.1

Postby realthunder » Sat Apr 10, 2021 1:45 am

This looks like a bug if file dependency calculation. Thanks for the detailed report. I'll fix it soon.
Try Assembly3 (latest version 0.11) along with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
User avatar
gbroques
Posts: 106
Joined: Thu Jan 23, 2020 3:28 am
Location: St. Louis, Missouri

Re: [BUG?] [App::Link] Partial Document Loading Issue in 19.1

Postby gbroques » Sat Apr 10, 2021 2:43 pm

realthunder wrote: Sat Apr 10, 2021 1:45 am This looks like a bug if file dependency calculation. Thanks for the detailed report. I'll fix it soon.
Thanks for taking a look! Your drive to improve FreeCAD and willingness to help others is commendable and exceptional sir! :D

I made an initial attempt to recreate this with a minimal example, but was unable to.

Thus, I'm not exactly sure what combination of factors created the "Link not restored" issue.

I know you're busy with many other things, so feel free to put your foot down and say that you need a minimal example pin-pointing the exact cause of the "bug". I understand completely.

Of course, if you're willing to take a look at my complex example. I appreciate it! 🥳