Assembly4: XLink absolute filepath problem

Discussion about the development of the Assembly workbench.
FCuser2019
Posts: 47
Joined: Fri Sep 13, 2019 12:15 pm

Assembly4: XLink absolute filepath problem

Postby FCuser2019 » Sun Oct 27, 2019 4:52 pm

Hi, I tried the tutorial https://github.com/Zolko-123/FreeCAD_As ... TORIAL1.md, I saved my files asm_tuto1.FCStd, axis.FCStd, bearing.FCStd in a directory I called "Tut1", everything works.
However, if I rename the directory with a different name, and try to open the file asm_tuto1.FCStd again, the assembly is not displayed and I get the following error messages:

Code: Select all

<PropertyLinks> PropertyLinks.cpp(2566): document not found /home/test/Documenti/FreeCAD/Forum/Assemly4/Tutorials/Tut1/axis.FCStd
<PropertyLinks> PropertyLinks.cpp(2566): document not found /home/test/Documenti/FreeCAD/Forum/Assemly4/Tutorials/Tut1/bearing.FCStd
Enumeration index -1 is out of range, ignore it
Enumeration index -1 is out of range, ignore it
Enumeration index -1 is out of range, ignore it
Enumeration index -1 is out of range, ignore it
3.68e-07 <App> Document.cpp(2549): asm_tuto1#axis.LinkedObject: Link not restored
Linked object: Model
Linked file: /home/test/Documenti/FreeCAD/Forum/Assemly4/Tutorials/Tut1/axis.FCStd
9.6373e-05 <App> Document.cpp(2549): asm_tuto1#bearing_1.LinkedObject: Link not restored
Linked object: Model
Linked file: /home/test/Documenti/FreeCAD/Forum/Assemly4/Tutorials/Tut1/bearing.FCStd
0.000144121 <App> Document.cpp(2549): asm_tuto1#bearing_2.LinkedObject: Link not restored
Linked object: Model
Linked file: /home/test/Documenti/FreeCAD/Forum/Assemly4/Tutorials/Tut1/bearing.FCStd
0.0001885 <App> Document.cpp(2549): asm_tuto1#bearing_3.LinkedObject: Link not restored
Linked object: Model
Linked file: /home/test/Documenti/FreeCAD/Forum/Assemly4/Tutorials/Tut1/bearing.FCStd
I downloaded all the files from https://github.com/Zolko-123/FreeCAD_As ... 4_Example2, I put them in a directory I called "Ex2", if I open the file asm_V4.FCStd the assembly is displayed correctly. If I rename the "Ex2" directory and open the file asm_V4.FCStd again, it is displayed without any problems.

This seems to be an absolute filepath problem in the links to objects.

Inside the Document.xml file of my asm_tuto1.FCStd I've seen that all XLinks have the absolute filepath:
<XLink file="/home/test/Documenti/FreeCAD/Forum/Assemly4/Tutorials/Tut1/bearing.FCStd"... />
<XLink file="/home/test/Documenti/FreeCAD/Forum/Assemly4/Tutorials/Tut1/axis.FCStd"... />

instead in Document.xml of asm_V4.FCStd all XLinks have the relative filepath:
<XLink file="Crankshaft.FCStd"... />
<XLink file="Cylindre.FCStd"... />
<XLink file="Bielle/asm_Bielle.fcstd" ... />
<XLink file="Piston/Piston.FCStd" ... />

Is there a way to tell Assembly4 to use the relative filepath when creating an assembly?

Thank you in advance for your help.

(Sorry for my english, I have used an online translator)

Assembly4 version: 0.6.3

OS: Linux Mint 18.1 (MATE/mate)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18614 (Git) AppImage
Build type: Release
Branch: master
Hash: efd55884ad7d40e77571a60c5bb906bbd8d1cbbd
Python version: 3.7.3
Qt version: 5.12.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Italian/Italy (it_IT)
Last edited by FCuser2019 on Sun Oct 27, 2019 5:45 pm, edited 1 time in total.
chrisb
Posts: 28029
Joined: Tue Mar 17, 2015 9:14 am

Re: Assembly4: XLink absolute filepath problem

Postby chrisb » Sun Oct 27, 2019 5:03 pm

Please edit your previous post and put the log output in code tags </>. That makes your post easier to read because it is easier to distinguish between system output and your text.
User avatar
Zolko
Posts: 1043
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly4: XLink absolute filepath problem

Postby Zolko » Sun Oct 27, 2019 6:01 pm

FCuser2019 wrote:
Sun Oct 27, 2019 4:52 pm
However, if I rename the directory with a different name, and try to open the file asm_tuto1.FCStd again, the assembly is not displayed and I get the following error messages:
...
I downloaded all the files from https://github.com/Zolko-123/FreeCAD_As ... 4_Example2, I put them in a directory I called "Ex2", if I open the file asm_V4.FCStd the assembly is displayed correctly. If I rename the "Ex2" directory and open the file asm_V4.FCStd again, it is displayed without any problems.

This seems to be an absolute filepath problem in the links to objects.
ah yeah, you're right. I hadn't seen that, I'll have to investigate. realthunder, any ideas ? Is there a way to specify relative and absolute paths for App::Links ?

realthunder wrote:
Thu Oct 24, 2019 12:36 am
?
try the Assembly4 workbench for FreCAD v0.19
install with Tools > Addon Manager > Assembly4 — tutorials here and here
User avatar
Zolko
Posts: 1043
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly4: XLink absolute filepath problem

Postby Zolko » Mon Oct 28, 2019 8:26 am

FCuser2019 wrote:
Sun Oct 27, 2019 4:52 pm
However, if I rename the directory with a different name, and try to open the file asm_tuto1.FCStd again, the assembly is not displayed and I get the following error messages:
...
I downloaded all the files from https://github.com/Zolko-123/FreeCAD_As ... 4_Example2, I put them in a directory I called "Ex2", if I open the file asm_V4.FCStd the assembly is displayed correctly. If I rename the "Ex2" directory and open the file asm_V4.FCStd again, it is displayed without any problems.
So, the difference comes from between FreeCAD-asm3 and FreeCAD-0.19-pre. I did the exact same thing in both, and -asm3 gives relative paths while 0.19-pre gives absolute paths:
  • create 3 new documents
  • save them as asm, part1, part2, in the same directory
  • close them
  • re-open them
  • create a link (not Assembly4 link, a pure App::Link) in asm
  • assign the linked part as part1
  • create a link in asm
  • assign the linked part as part2
  • save
then when I rename the directory, -asm3 finds the links again while 0.19-pre looses them.

realthunder wrote:
Thu Oct 24, 2019 12:36 am
?
realthunder, did you modify the paths behaviour between -asm3 and 0.19-pre ?
try the Assembly4 workbench for FreCAD v0.19
install with Tools > Addon Manager > Assembly4 — tutorials here and here
User avatar
Zolko
Posts: 1043
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly4: XLink absolute filepath problem

Postby Zolko » Mon Oct 28, 2019 8:29 am

EDIT: duplicate message
Last edited by Zolko on Mon Oct 28, 2019 8:55 pm, edited 1 time in total.
realthunder
Posts: 1759
Joined: Tue Jan 03, 2017 10:55 am

Re: Assembly4: XLink absolute filepath problem

Postby realthunder » Mon Oct 28, 2019 9:28 am

Zolko wrote:
Mon Oct 28, 2019 8:29 am
realthunder, did you modify the paths behaviour between -asm3 and 0.19-pre ?
Thanks for reporting. That's a serious problem. Yes, something wrong when merging this part. 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
FCuser2019
Posts: 47
Joined: Fri Sep 13, 2019 12:15 pm

Re: Assembly4: XLink absolute filepath problem

Postby FCuser2019 » Mon Oct 28, 2019 8:45 pm

Zolko, thanks for your quick investigation.
So let's wait for good news from realthunder.
adrianinsaval
Posts: 344
Joined: Thu Apr 05, 2018 5:15 pm

Re: Assembly4: XLink absolute filepath problem

Postby adrianinsaval » Thu Nov 07, 2019 9:51 pm

realthunder wrote:
Mon Oct 28, 2019 9:28 am
Zolko wrote:
Mon Oct 28, 2019 8:29 am
realthunder, did you modify the paths behaviour between -asm3 and 0.19-pre ?
Thanks for reporting. That's a serious problem. Yes, something wrong when merging this part. I'll fix it soon.
Sorry to bother you but are there any news on this front?
realthunder
Posts: 1759
Joined: Tue Jan 03, 2017 10:55 am

Re: Assembly4: XLink absolute filepath problem

Postby realthunder » Fri Nov 08, 2019 12:09 am

adrianinsaval wrote:
Thu Nov 07, 2019 9:51 pm
Sorry to bother you but are there any news on this front?
It got stuck in one of my feature branch. I have just split it out and submitted the PR here.
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
adrianinsaval
Posts: 344
Joined: Thu Apr 05, 2018 5:15 pm

Re: Assembly4: XLink absolute filepath problem

Postby adrianinsaval » Fri Nov 08, 2019 12:47 am

realthunder wrote:
Fri Nov 08, 2019 12:09 am
adrianinsaval wrote:
Thu Nov 07, 2019 9:51 pm
Sorry to bother you but are there any news on this front?
It got stuck in one of my feature branch. I have just split it out and submitted the PR here.
Thanks for the quick response! :D