TechDraw / using expressions for dynamically positioned dimensions

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
chrili_rakete
Posts: 54
Joined: Thu May 15, 2014 11:51 am

TechDraw / using expressions for dynamically positioned dimensions

Post by chrili_rakete »

Hello all!

I aim to have drawings that follow datum changes of my parametric models, especially for the positioning of the dimension in relation to the model (source). I found out how to bind the X/Y-value of a dimension via expressions. This example will set the Y-value of a horizontal dimension which references "Edge3" of a "Cube" that is represented in a "View" 10 units above this edge:

Code: Select all

<<View>>.<<$Cube.Edge3>>._shape.CenterOfMass[2] + 10
I would like to optimize this expression by directly using the dimension's property "References2D" which points to "View.Edge3"

Code: Select all

[(<DrawViewPart object>, ('Edge3',))]
but I am not able to build this expression correctly. Would anybody help me, please?

Thanks in advance!
--
Christoph

OS: Ubuntu 20.04 LTS (KDE/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 2021.922.24301 +4188 (Git) AppImage
Build type: Release
Branch: LinkDaily
Hash: 3de879c7a2ba7111cc769d98636eb6d43189459d
Python version: 3.9.7
Qt version: 5.12.9
Coin version: 4.0.1
OCC version: 7.5.2
Locale: German/Austria (de_AT)
Post Reply