Cross document expression, relocate main file

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!
Post Reply
hreintke
Posts: 14
Joined: Sun Sep 29, 2019 11:47 am

Cross document expression, relocate main file

Post by hreintke »

Hi,

Learning how to use cross document expressions.

What I have now.
- Main file LegoDimensions which includes a spreadsheet with basic brick and beam dimensions-
- Testfile, LegoDimensionsTest which uses Part design to create a specific brick.

The Testfile uses the LegoDimensions spreadsheet.

Question is about the absolute path name of the Main file used for the cross linking in the Testfile.

When I move the Main LegoDimensions to another directory, Opening the testfile gives an error,
13:08:21 Exception opening file: C:/Userdata/Lego/Freecad/LegoDimensions.FCStd [File 'C:/Userdata/Lego/Freecad/LegoDimensions.FCStd' does not exist!]
Which of course is correct.
I tried opening the LegoDimensions main file from the new location, then opening the LegoDimensionsTest but that gives the same error.

Is there a way that I can update the path in the Testfile so that is uses the new file location of the Main file ?






OS: Windows 10 Version 2009
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24276 (Git)
Build type: Release
Branch: releases/FreeCAD-0-19
Hash: a88db11e0a908f6e38f92bfc5187b13ebe470438
Python version: 3.8.6+
Qt version: 5.15.1
Coin version: 4.0.1
OCC version: 7.5.0
Locale: English/Netherlands (en_NL)
Attachments
LegoDimensionsTest.FCStd
(9.42 KiB) Downloaded 23 times
LegoDimensions.FCStd
(2.03 KiB) Downloaded 26 times
User avatar
Roy_043
Veteran
Posts: 8552
Joined: Thu Dec 27, 2018 12:28 pm

Re: Cross document expression, relocate main file

Post by Roy_043 »

hreintke wrote: Tue Apr 13, 2021 11:41 am Is there a way that I can update the path in the Testfile so that is uses the new file location of the Main file ?
Actually the path to the LegoDimensions.FCStd file is not stored in the LegoDimensionsTest.FCStd file. If you open the LegoDimensions.FCStd file first all cross document expressions should work and you can just ignore the warning.
JeffWorley
Posts: 2
Joined: Tue Jan 11, 2022 1:34 am

Re: Cross document expression, relocate main file

Post by JeffWorley »

Roy_043 wrote: Sat Apr 17, 2021 1:33 pm
hreintke wrote: Tue Apr 13, 2021 11:41 am Is there a way that I can update the path in the Testfile so that is uses the new file location of the Main file ?
Actually the path to the LegoDimensions.FCStd file is not stored in the LegoDimensionsTest.FCStd file.
Does this imply that in the formula editor, the path to the other file does not matter at all?

When I cross-link to a spreasheet (in FreeCAD 0.19) in a file named "thisFile" in the formula editor I have something like
=<<otherFileName>>#<<spreasheetLabel>>.CellAlias

So I could open any file of name "otherFileName" that contains a spreadsheet with label "spreadsheetLabel" before I open "thisFile" and "thisFile"'s formula editor will resolve the formulas as defined by the specific "otherFileName" we opened?

I ask this because I've observed behavior where when I open "thisFile" it will load "otherFileName" but it's greyed out (so I assume not actually opened yet). Once I double-click on the greyed-out "otherFileName" the file I expect to open will open. How could this happen if there is no pathname (absolute or relative) associated with the <<otherFileName>># resolution?

This is important to me because a project I'm currently working on will change depending on whether this cross-linked file is referenced via absolute paths, relative paths, or just by whichever document is open that matches the file name. I'm very new to FreeCAD so sorry in advance for my lack of knowledge!

Thank you!
User avatar
Roy_043
Veteran
Posts: 8552
Joined: Thu Dec 27, 2018 12:28 pm

Re: Cross document expression, relocate main file

Post by Roy_043 »

You are correct, the relative path to the referenced file is stored in V0.19. I must have had the V0.18 behavior in mind when I wrote my previous message. The path to the LegoDimensions.FCStd file is missing, but in V0.19 this means that the referenced file is in the same folder.

JeffWorley wrote: Tue Jan 11, 2022 1:53 am I ask this because I've observed behavior where when I open "thisFile" it will load "otherFileName" but it's greyed out
There is a strange thing with this behavior: This does happen for PartDesign Bodies that reference the external spreadsheet, but not if you have a file with only a Part_Box that references the same external data.
JeffWorley
Posts: 2
Joined: Tue Jan 11, 2022 1:34 am

Re: Cross document expression, relocate main file

Post by JeffWorley »

Roy_043 wrote: Tue Jan 11, 2022 9:04 am the relative path to the referenced file is stored in V0.19. ... The path to the LegoDimensions.FCStd file is missing, but in V0.19 this means that the referenced file is in the same folder.
Thank you, your answer solves a lot of problems for me!
Post Reply