Assembly4: XLink absolute filepath problem

Discussion about the development of the Assembly workbench.
aapo
Posts: 227
Joined: Mon Oct 29, 2018 6:41 pm

Re: Assembly4: XLink absolute filepath problem

Postby aapo » Fri Nov 08, 2019 8:07 am

realthunder wrote:
Fri Nov 08, 2019 12:09 am
It got stuck in one of my feature branch. I have just split it out and submitted the PR here.
After this patch will be applied, will it be possible to load old Assembly4 files containing absolute filepaths; or will there be a need to convert the files somehow?

Reading the code in the patch leads me to think, that if it's possible to read an old FCStd file, then saving the file with the patch enabed should make the xlink paths relative. Thus, I'd think that a simple load and save would make any Assembly4 files "good", but is this true?
realthunder
Posts: 1816
Joined: Tue Jan 03, 2017 10:55 am

Re: Assembly4: XLink absolute filepath problem

Postby realthunder » Fri Nov 08, 2019 11:05 pm

aapo wrote:
Fri Nov 08, 2019 8:07 am
realthunder wrote:
Fri Nov 08, 2019 12:09 am
It got stuck in one of my feature branch. I have just split it out and submitted the PR here.
After this patch will be applied, will it be possible to load old Assembly4 files containing absolute filepaths; or will there be a need to convert the files somehow?

Reading the code in the patch leads me to think, that if it's possible to read an old FCStd file, then saving the file with the patch enabed should make the xlink paths relative. Thus, I'd think that a simple load and save would make any Assembly4 files "good", but is this true?
Yes, just load and save. You may need to manually save all the linked documents, because they are not marked as changed. Just set each document as active, and save.
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: 49
Joined: Fri Sep 13, 2019 12:15 pm

Re: Assembly4: XLink absolute filepath problem

Postby FCuser2019 » Mon Nov 11, 2019 8:51 pm

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 this fix, FreeCAD_0.19-18714 works :)
project4
Posts: 192
Joined: Fri Jul 12, 2013 12:53 pm

Re: Assembly4: XLink absolute filepath problem

Postby project4 » Tue Aug 25, 2020 7:46 pm

Hi guys,

I'm facing exactly the same problem with asm4.
I'm with 0.19 pre-release daily build, so I guess the realthunder's fix should be in.
Is there anything I should check to make sure I have that fix?

My physical path include symbolic links and on some PCs also a NFS mount, that's probably that cause the problem along the way.

Will appreciate a fix or workaround for that problem.
Thanks.
User avatar
Zolko
Posts: 1112
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly4: XLink absolute filepath problem

Postby Zolko » Tue Aug 25, 2020 8:06 pm

project4 wrote:
Tue Aug 25, 2020 7:46 pm
I'm with 0.19 pre-release daily build, so I guess the realthunder's fix should be in.
could you please try with the AppImage:

https://github.com/FreeCAD/FreeCAD/rele ... g/0.19_pre
try the Assembly4 workbench for FreCAD v0.19
install with Tools > Addon Manager > Assembly4 — tutorials here and here
project4
Posts: 192
Joined: Fri Jul 12, 2013 12:53 pm

Re: Assembly4: XLink absolute filepath problem

Postby project4 » Wed Aug 26, 2020 6:39 am

Running from the latest AppImage gave the same results :(

More information here:
https://github.com/Zolko-123/FreeCAD_As ... /issues/95
realthunder
Posts: 1816
Joined: Tue Jan 03, 2017 10:55 am

Re: Assembly4: XLink absolute filepath problem

Postby realthunder » Wed Aug 26, 2020 8:33 am

project4 wrote:
Wed Aug 26, 2020 6:39 am
Running from the latest AppImage gave the same results :(

More information here:
https://github.com/Zolko-123/FreeCAD_As ... /issues/95
PR submitted here for the fix.
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
Zolko
Posts: 1112
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly4: XLink absolute filepath problem

Postby Zolko » Wed Aug 26, 2020 8:49 am

realthunder wrote:
Wed Aug 26, 2020 8:33 am
PR submitted here for the fix.
hold-on, this doesn't look right:

Code: Select all

We used to rely on QFileInfo::canonicalFilePath() to resolve it,
but has now been changed to simply use the absoluteFilePath()
We had absolute file paths before and that wasn't good either. Why not use filePath() ?

https://doc.qt.io/qt-5/qfileinfo.html
try the Assembly4 workbench for FreCAD v0.19
install with Tools > Addon Manager > Assembly4 — tutorials here and here
realthunder
Posts: 1816
Joined: Tue Jan 03, 2017 10:55 am

Re: Assembly4: XLink absolute filepath problem

Postby realthunder » Wed Aug 26, 2020 8:52 am

Zolko wrote:
Wed Aug 26, 2020 8:49 am
We had absolute file paths before and that wasn't good either. Why not use filePath() ?

https://doc.qt.io/qt-5/qfileinfo.html
The absolute path is not used for saving, it is used as a key to lookup already loaded document. Just compare the documentation of QFileInfo::canonicalFilePath() and absoluteFilePath(), you'll know the difference.
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
Zolko
Posts: 1112
Joined: Mon Dec 17, 2018 10:02 am

Re: Assembly4: XLink absolute filepath problem

Postby Zolko » Wed Aug 26, 2020 8:56 am

realthunder wrote:
Wed Aug 26, 2020 8:52 am
The absolute path is not used for saving, it is used as a key to lookup already loaded document.
Ah OK, thanks.

And what happens if we load the same document through different symlink-path into the assembly ?
try the Assembly4 workbench for FreCAD v0.19
install with Tools > Addon Manager > Assembly4 — tutorials here and here