#include spreadsheet from another .FCStd file

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
Grue
Posts: 23
Joined: Thu Oct 20, 2016 8:50 am
Location: Moscow
Contact:

#include spreadsheet from another .FCStd file

Post by Grue »

Is there any way to maintain some kind of single spreadsheet configuration for multiple files? Spreadsheets are great and flexible, but very difficult to use when multiple parts rely on single configuration -- every minor change in spreadsheet triggers a lot of computations, even if I'm working on single part and right now don't care about changes in other parts... lattice2 helped sometimes, but manual toggle of recomputes is another can of worms (and does not work in 0.18.1 anyway, complains about "18.1" being invalid literal for int).
Life sucks, then you die.
User avatar
Boneshaker
Posts: 69
Joined: Sat Feb 20, 2016 2:20 pm
Location: Emden, Germany

Re: #include spreadsheet from another .FCStd file

Post by Boneshaker »

User avatar
Grue
Posts: 23
Joined: Thu Oct 20, 2016 8:50 am
Location: Moscow
Contact:

Re: #include spreadsheet from another .FCStd file

Post by Grue »

Awww, thanks! I wish there was description of this feature in Spreadsheet wiki page -- I remember searching for something like that, but I did not look for it in Expressions :)
Life sucks, then you die.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: #include spreadsheet from another .FCStd file

Post by Kunda1 »

Grue wrote: Mon May 20, 2019 2:37 pm Awww, thanks! I wish there was description of this feature in Spreadsheet wiki page -- I remember searching for something like that, but I did not look for it in Expressions :)
Someone should just tackle that <hint hint nudge nudge>
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
dxp.dev
Posts: 280
Joined: Tue Dec 11, 2018 12:57 pm

Re: #include spreadsheet from another .FCStd file

Post by dxp.dev »

Kunda1 wrote: Mon May 20, 2019 9:50 pm
Grue wrote: Mon May 20, 2019 2:37 pm Awww, thanks! I wish there was description of this feature in Spreadsheet wiki page -- I remember searching for something like that, but I did not look for it in Expressions :)
Someone should just tackle that <hint hint nudge nudge>
Hi,

I think that
For more specifics on how expressions are formed, see Expressions.
in the Spreadsheet wiki page is not very clear to indicate that possibility.

Maybe adding something like
For more specifics on how expressions are formed , such as Cross-document linking to include values from a spreadsheet from another document, see Expressions , section Cross-document linking.
What do you think ?

(by the way, discovering that saved me soooo much time, thanks)
Find your user.cfg and system.cfg files : Macro_findConfigFiles

Imperial system makes no sense, go metric ! ! !
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: #include spreadsheet from another .FCStd file

Post by jmaustpc »

Kunda1 wrote: Mon May 20, 2019 9:50 pm
Grue wrote: Mon May 20, 2019 2:37 pm Awww, thanks! I wish there was description of this feature in Spreadsheet wiki page -- I remember searching for something like that, but I did not look for it in Expressions :)
Someone should just tackle that <hint hint nudge nudge>
dxp.dev wrote: Sat Jul 06, 2019 5:03 pm in the Spreadsheet wiki page is not very clear to indicate that possibility.

Maybe adding something like

Guys, NO, absolutely not, you two are misunderstanding all this.....

It has nothing to do with "Spreadsheet" it only relates to "Expressions" and must only be documented there.

One point you are all missing is that this ability of Expressions to read from another document applies to ANYTHING that an Expression can read and not only Spreadsheets, but also any property of other things in the master FreeCAD document. Hence if you were to add a note to Spreadsheet in the wiki, you would also have to logically add the same note to almost every single piece of functionality in FreeCAD to the wiki, which of course doesn't make sense.

Second point, the original developer of Expressions said something like this ability to read from another document is just a hack, its useful so he left it there but at least at first, did not advertise it as its a limited hack that he was not sure was a good idea to encourage wide spread use of it.....or something along those lines. There has always been a long term plan to properly handle multi-document projects in FreeCAD.

Don't forget that you have to have the master document open in FreeCAD at the time you are entering the expression in the slave document, or if you want to recompute the slave.

Here is two example files, the "mastercube" file contains a Part Cube, the "slavefile" contains a Part Sphere which has its radius and X Placement values defined by the Length and Width properties of Cube in the "mastercube" file.
slavefile.FCStd
(8.95 KiB) Downloaded 114 times
mastercube.FCStd
(8.62 KiB) Downloaded 112 times
Jim
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: #include spreadsheet from another .FCStd file

Post by jmaustpc »

I updated the Expressions page in the wiki, so now the Expressions#Cross-document_linking section explains that this works with more than just Spreadsheet cell data.

Let me know, or edit yourselves, if you see any errors in my edit. :)

Jim
kisolre
Veteran
Posts: 4166
Joined: Wed Nov 21, 2018 1:13 pm

Re: #include spreadsheet from another .FCStd file

Post by kisolre »

Not on pc now but does recompute of slave show a warning or an error if master is not open? Maybe it could suggest to open the referenced document if it is not already open?
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: #include spreadsheet from another .FCStd file

Post by jmaustpc »

kisolre wrote: Sun Jul 07, 2019 8:41 am Not on pc now but does recompute of slave show a warning or an error if master is not open? Maybe it could suggest to open the referenced document if it is not already open?
Yeap, it does

Exception (Sun Jul 7 20:51:09 2019): Document not found: mastercube


There is a lot of things that it could, should or will one day do, but its current state is simply as far as the code has got, at this time. It needs someone to write the code but before that a decision on what it will do and how. We have previous talked about multi-documents in connection with assemblies, way back when we were working on the original Assembly WB.
dxp.dev
Posts: 280
Joined: Tue Dec 11, 2018 12:57 pm

Re: #include spreadsheet from another .FCStd file

Post by dxp.dev »

jmaustpc wrote: Sun Jul 07, 2019 5:52 am One point you are all missing is that this ability of Expressions to read from another document applies to ANYTHING that an Expression can read and not only Spreadsheets, but also any property of other things in the master FreeCAD document.
I was missing that point, thanks. So yes it makes sense not to add it everywhere.

jmaustpc wrote: Sun Jul 07, 2019 6:24 am I updated the Expressions page in the wiki, so now the Expressions#Cross-document_linking section explains that this works with more than just Spreadsheet cell data.
So in
For example, a cell in a spreadsheet or the Length of a Part Cube, etc. in one document can be defined by an Expression that references the X Placement value or another Property of an object contained in a different document.
you could add the example you gave in your message :

Code: Select all

mastercube#Cube.Length
Find your user.cfg and system.cfg files : Macro_findConfigFiles

Imperial system makes no sense, go metric ! ! !
Post Reply