How to share an Assembly 4 without loosing link reference

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
OpenR
Posts: 4
Joined: Sun May 29, 2022 9:17 pm

How to share an Assembly 4 without loosing link reference

Post by OpenR »

Hello everyone, I'm doing some asemblies with the Assembly 4 workbench and the file itself works fine. However, when I change the location of the file, all the links become missing. Is there a way to keep that info? I would like to be able to share the assembly via GitHub so other people can see and use the file.
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: How to share an Assembly 4 without loosing link reference

Post by chrisb »

Moved from Open discussion forum.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: How to share an Assembly 4 without loosing link reference

Post by Zolko »

OpenR wrote: Sun May 29, 2022 9:25 pm However, when I change the location of the file, all the links become missing. Is there a way to keep that info?
can you be more precise in what you're doing (or want to do) ?

A link (App::Link) is like a shortcut or symbolic link to a specified file, it stores the path to the target file. Therefore, if you change the file location then you loose the link to it. Normally, path in App::Link are relative, meaning that if you move both files – the assembly containing the link and the target file – then the assembly should be able to find the dependent part.
try the Assembly4 workbench for FreCAD — tutorials here and here
OpenR
Posts: 4
Joined: Sun May 29, 2022 9:17 pm

Re: How to share an Assembly 4 without loosing link reference

Post by OpenR »

Zolko wrote: Mon May 30, 2022 9:32 am can you be more precise in what you're doing (or want to do) ?
Sorry for the late answer. I was expecting a notification from the thread but I didn't check the option...

The assemblies work fine on my computer (when I dont move them). However, its true that sometimes when I duplicate an asembly and move the copy to another location, the links keep working, But it seems this only works if the original file is open during the process. That's why I'm not sure if someone downloads the files from GitHub will be able to open the files without missing links.

When I have FreeCAD closed and I relocate the location of some of the assemblies, the links break. When this happens I use the Python console to set the linkedObjects in the assembly by sending each part to the console (atm it is the only solution I found)
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: How to share an Assembly 4 without loosing link reference

Post by Zolko »

OpenR wrote: Tue Jun 14, 2022 7:24 pm When I have FreeCAD closed and I relocate the location of some of the assemblies, the links break
If you copy/move the assembly without moving also the linked parts, then it's normal that the assembly looses the links. Did you try to move the assembly file AND all other part files that are linked in the assembly ? An assembly uses relative path to store the location of the linked parts, so the best way is to move/copy the entire directory of your project.

When this happens I use the Python console to set the linkedObjects in the assembly by sending each part to the console (atm it is the only solution I found)
if you select "insert link" on a broken link, it will give you the option to re-assign the linked object.
try the Assembly4 workbench for FreCAD — tutorials here and here
OpenR
Posts: 4
Joined: Sun May 29, 2022 9:17 pm

Re: How to share an Assembly 4 without loosing link reference

Post by OpenR »

Zolko wrote: Tue Jun 14, 2022 8:52 pm Did you try to move the assembly file AND all other part files that are linked in the assembly ?
The problem is that most of the parts are used in other assemblies, so I have a folder for "3d printed", another one for "metal sheets" and another with "Standard componets" as bolts, bearings, aluminum profiles, etc. That way I dont have duplicated files along the project.

I imagine, for what you said, that the best way is to have all the used elements in the same folder of the assembly if I want to share the assembly with other people. Am I right?
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: How to share an Assembly 4 without loosing link reference

Post by Zolko »

OpenR wrote: Tue Jun 14, 2022 9:05 pm The problem is that most of the parts are used in other assemblies, so I have a folder for "3d printed", another one for "metal sheets" and another with "Standard componets" as bolts, bearings, aluminum profiles, etc. That way I dont have duplicated files along the project.
what you can try is to have a symlink "Library" (or PartsLibrary or whatever you fancy) in the assembly directory, which points to the directory where you store your standard parts. That way you can access them through "Library/3Dprinted" and "Library/MetalSheets" ... then, all the people with whom you share the assembly need to have this symlink which points to where THEY store THEIR standard parts

But if you have your standard shared parts all over your hard drive, then it's going to be difficult.
try the Assembly4 workbench for FreCAD — tutorials here and here
OpenR
Posts: 4
Joined: Sun May 29, 2022 9:17 pm

Re: How to share an Assembly 4 without loosing link reference

Post by OpenR »

Thank you very much for all the useful info!
Zolko wrote: Tue Jun 14, 2022 9:12 pm if you have your standard shared parts all over your hard drive, then it's going to be difficult
Well, all the used parts are contained in a folder with a buch of sub folders. This is the repo so you can have an example of the distribution: https://github.com/TheOpenR/Open-Printer/tree/main/CAD
Lonfor
Posts: 133
Joined: Wed Mar 23, 2022 2:32 am

Re: How to share an Assembly 4 without loosing link reference

Post by Lonfor »

Zolko wrote: Tue Jun 14, 2022 9:12 pm But if you have your standard shared parts all over your hard drive, then it's going to be difficult.
Might be possible to add a feature to look for the missing files (links) recursively on a given _PATH_, as NX has?
Attachments
Screenshot_20220709_200248.png
Screenshot_20220709_200248.png (36.86 KiB) Viewed 1364 times
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: How to share an Assembly 4 without loosing link reference

Post by Zolko »

Lonfor wrote: Sun Jul 10, 2022 12:04 am
Zolko wrote: Tue Jun 14, 2022 9:12 pm But if you have your standard shared parts all over your hard drive, then it's going to be difficult.
Might be possible to add a feature to look for the missing files (links) recursively on a given _PATH_, as NX has?
yes, that would be great, we had talked about such things before, but this is core FreeCAD::Link functionality, nothing I can do about. Today, App::Link stores the files as relative path.

But you could make the suggestion, probably in the Open Discussion forum. Ideally, I'd like to be able to choose between relative path, absolute path, and user-configurable search path.
try the Assembly4 workbench for FreCAD — tutorials here and here
Post Reply