How to reference document/global properties?

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!
kisolre
Veteran
Posts: 4166
Joined: Wed Nov 21, 2018 1:13 pm

Re: How to reference document/global properties?

Post by kisolre »

The question is how to access property "BearingInnerDiameter" under the group "DIMS" from the properties of the file "MyModel.FCStd" (current file) in an expression. What is the name of the freecad object that represents the file, in which any other object is inside?
PAS_Drafter
Posts: 339
Joined: Mon Aug 02, 2021 6:29 am
Location: California, USA

Re: How to reference document/global properties?

Post by PAS_Drafter »

Well, I didn't even know this tool DynamicData Workbench existed until I read this post. This is another great tool from FreeCAD!

The documentation shows how to use it.

https://github.com/mwganson/DynamicData ... /README.md

I was able to make a quick file using it attached. You create the DynamicData object and then can access it just like you do a spreadsheet.
Attachments
DynamicDataExample.FCStd
(18.52 KiB) Downloaded 18 times
naasking
Posts: 28
Joined: Tue Sep 28, 2021 12:28 pm

Re: How to reference document/global properties?

Post by naasking »

Thanks I'll look into DynamicData. Is there a reason why Spreadsheet is so slow? It seems like it might be recomputing everything whenever something changes, rather than only the dependencies on what changed.
drmacro
Veteran
Posts: 8983
Joined: Sun Mar 02, 2014 4:35 pm

Re: How to reference document/global properties?

Post by drmacro »

naasking wrote: Tue Oct 04, 2022 1:17 pm ... It seems like it might be recomputing everything whenever something changes, rather than only the dependencies on what changed.
Exactly.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
adrianinsaval
Veteran
Posts: 5551
Joined: Thu Apr 05, 2018 5:15 pm

Re: How to reference document/global properties?

Post by adrianinsaval »

DynamicData isn't any different on that regard AFAIk, if you stuff that is fully independent and shouldn't trigger a recompute of some stuff you might need to create several containers/spreadsheets.
naasking
Posts: 28
Joined: Tue Sep 28, 2021 12:28 pm

Re: How to reference document/global properties?

Post by naasking »

DynamicData seems to work when you're setting up the properties, but I can't seem to do any arithmetic on them in expressions. For instance, I setup a property of type App::PropertyLength, and if I try to use this in an expression with an offset I get "unit mismatch in minus operation":
Gear diameter.png
Gear diameter.png (22.91 KiB) Viewed 389 times

It only seems to work if I specify the type as "PropertyFloat".
User avatar
Shalmeneser
Veteran
Posts: 9560
Joined: Wed Dec 23, 2020 12:04 am
Location: Fr

Re: How to reference document/global properties?

Post by Shalmeneser »

Code: Select all

... - 1 mm
Unit mismatch !
User avatar
onekk
Veteran
Posts: 6206
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: How to reference document/global properties?

Post by onekk »

naasking wrote: Fri Oct 07, 2022 8:44 pm expression with an offset I get "unit mismatch in minus operation":
Well known behaviour, you must specify a unit when adding or subtracting.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
Post Reply