Restore a link

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!
steve123
Posts: 68
Joined: Fri Sep 04, 2015 8:58 pm

Restore a link

Postby steve123 » Tue Nov 10, 2020 4:57 am

I encountered an issue with Assembly4 where the file that was linked was moved to another directory. I see a console message "LinkedObject: Link not restored". Is there a way to "restore" the link and tell FreeCAD where the file moved to?
jmaustpc
Posts: 11105
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Restore a link

Postby jmaustpc » Tue Nov 10, 2020 11:56 am

steve123 wrote: Tue Nov 10, 2020 4:57 am I encountered an issue with Assembly4 where the file that was linked was moved to another directory. I see a console message "LinkedObject: Link not restored". Is there a way to "restore" the link and tell FreeCAD where the file moved to?
don't use Assembly 4 but its developer said it uses the Expressions engine for Assembly, so I imagine that the multi-document linking works the same way as Expressions in any property. If so, you have to have the second file that you are linking something to, loaded in FreeCAD at the same time. I don't think it matters where it is in your file system once it has been opened in FreeCAD, but it could make sense to keep both files together.

here is the relevant part of the FreeCAD Expressions wiki page
https://wiki.freecadweb.org/Expressions ... nt_linking


Also you have to recompute the property's expression after the second document has been edited, so that the object in the first file knows to read and update that changed value. There are several ways to do that, recompute just that property, or the object or the complete project file. that can be done by opening then closing the Expressions edit dialogue for that property in property editor, right click in treeview on the object or the complete document and select recompute (or "mark for recompute" followed by clicking the recompute icon with the double curved arrows (that will now be not greyed out) left of the workbench drop down selector.
steve123
Posts: 68
Joined: Fri Sep 04, 2015 8:58 pm

Re: Restore a link

Postby steve123 » Tue Nov 10, 2020 4:17 pm

have the second file that you are linking something to, loaded in FreeCAD at the same time
I thought to try that approach but I was not able to resolve the issue. I should have mentioned that I am linking several part models with Assembly 4. I have several parts that have their own FreeCAD model and are in separate FreeCAD files in their own directory. I added the parts to an assembly using the "insert a link to a part" feature. I subsequently broke the link to the file by moving it to another directory and saw the error message mentioned above. I did have the file open in FreeCAD in its new location but that did not resolve the link.

I noticed that when the link is valid, the properties for the object show the path to the file. However, when the link is not resolved, these properties do not appear. I could not find the file path property anywhere else. So, I was wondering if I am looking in the wrong place or if this capability is not available at the present time. My assumption at the moment is the path cannot be edited if the link is not resolved which is a bit of a catch22.

My work around was to delete the link and create a new one.
orionrobots
Posts: 24
Joined: Sun Dec 13, 2020 9:01 pm
Contact:

Re: Restore a link

Postby orionrobots » Sat Jul 24, 2021 11:12 am

I ran into the same problem and found a solution.

I made a detailed post about it at https://orionrobots.co.uk/robot%20build ... issue.html.

The short version is that it can be fixed with the Python console by re-associating the obj.LinkedObject property with the body that should be linked.