Expressions/de: Difference between revisions

From FreeCAD Documentation
(Created page with "=== Bedingte Ausdrücke ===")
(Updating to match new version of source page)
(32 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
{{TOCright}}


<div class="mw-translate-fuzzy">
{{Version/de|0.16}}
{{Version/de|0.16}}
</div>


<div class="mw-translate-fuzzy">
Seit der Version 0.16 ist es möglich, Modelleigenschaften durch Rechenformeln festzulegen und mit anderen Eigenschaften von der Benutzeroberfläche aus zu verknüpfen. Eingabefelder von Eigenschaften für Zahlen oder Größenangaben enthalten einen blauen Knopf [[Image:Sketcher_Expressions.png|24px]]. Wenn man auf dieses Symbol klickt oder das Gleichheitszeichen (=) eingibt, öffnet sich der Formeleditor für die entsprechende Eigenschaft.
Seit der Version 0.16 ist es möglich, Modelleigenschaften durch Rechenformeln festzulegen und mit anderen Eigenschaften von der Benutzeroberfläche aus zu verknüpfen. Eingabefelder von Eigenschaften für Zahlen oder Größenangaben enthalten einen blauen Knopf [[Image:Sketcher_Expressions.png|24px]]. Wenn man auf dieses Symbol klickt oder das Gleichheitszeichen (=) eingibt, öffnet sich der Formeleditor für die entsprechende Eigenschaft.
</div>


<div class="mw-translate-fuzzy">
Ein Rechenausdruck in FreeCAD ist ein mathematischer Ausdruck in der üblichen Schreibweise für die Standardrechenarten (+, -, * und /) und mathematische Funktionen (siehe unten). Zusätzlich können referenzierte Eigenschaften anderer Objekte und bedingte Ausdrücke verwendet werden. Zahlen in Rechenausdrücken können mit einer optionalen Einheit versehen sein.
Ein Rechenausdruck in FreeCAD ist ein mathematischer Ausdruck in der üblichen Schreibweise für die Standardrechenarten (+, -, * und /) und mathematische Funktionen (siehe unten). Zusätzlich können referenzierte Eigenschaften anderer Objekte und bedingte Ausdrücke verwendet werden. Zahlen in Rechenausdrücken können mit einer optionalen Einheit versehen sein.
</div>


Numbers may use either a comma ',' or a decimal point '.' separating whole digits from decimals.
Numbers may use either a comma ',' or a decimal point '.' separating whole digits from decimals.
When the decimal marker is used, it ''must'' be followed by at least one digit.
When the decimal marker is used, it ''must'' be followed by at least one digit.
Thus, the expressions '''1.+2.''' and '''1,+2,''' are invalid, but '''1.0+2.0''' and '''1,0+2,0''' are valid.
Thus, the expressions '''1.+2.''' and '''1,+2,''' are invalid, but '''1.0 + 2.0''' and '''1,0 + 2,0''' are valid.

Die Konstanten ''pi'' und ''e'' sind vordefiniert und müssen kleingeschrieben werden.


<div class="mw-translate-fuzzy">
Die Rechenarten und Funktionen verstehen sich auf Einheiten und erfordern deshalb bei der Verwendung von Einheiten zulässige Einheitenkombinationen. 2mm+4mm ist zum Beispiel ein zulässiger Rechenausdruck, während 2mm+4 nicht zulässig ist. (Der Grund dafür ist, das ein Ausdruck wie 1in + 4 von Menschen wohl als 1in + 4in interpretiert wird, das System dies jedoch nicht erraten kann, da alle Einheiten intern in das SI-System konvertiert werden.)
Die Rechenarten und Funktionen verstehen sich auf Einheiten und erfordern deshalb bei der Verwendung von Einheiten zulässige Einheitenkombinationen. 2mm+4mm ist zum Beispiel ein zulässiger Rechenausdruck, während 2mm+4 nicht zulässig ist. (Der Grund dafür ist, das ein Ausdruck wie 1in + 4 von Menschen wohl als 1in + 4in interpretiert wird, das System dies jedoch nicht erraten kann, da alle Einheiten intern in das SI-System konvertiert werden.)
</div>


You can use [[#Supported Constants|predefined constants]] and [[#Supported Functions|functions]].
== Unterstützte Funktionen ==


===Referencing objects===
=== Allgemeine mathematische Funktionen ===

You can reference to an object by its {{incode|Name}} or by its {{incode|Label}}. In the case of a {{incode|Label}}, it must be enclosed in double {{incode|<<}} and {{incode|>>}} symbols, such as {{incode|<<Label>>}}.

You can reference any numerical property of this object. For example, to refer to a Cylinder's height, you may use {{incode|Cylinder.Height}} or {{incode|<<Long_name_of_cylinder>>.Height}}.

To reference list objects, the syntax is {{incode|<<object_label>>.list[list_index]}} or {{incode|object_name.list[list_index]}}. If you want for example reference a constraint in a sketch, do it this way '''<<MySketch>>.Constraints[16]'''. If you are in the same sketch you can omit its name and just use '''Constraints[16]'''.<br/>
'''Note:''' The index starts with 0, therefore constraint 17 has the index 16.

For more info about referencing objects, see [[#Reference To CAD-Data|this section]].


The following operators are supported:
{| class="wikitable float-right mw-collapsible mw-uncollapsed"
!style="width: 33%;"|Operator
!style="width: 66%;"|Description
|-
| style="text-align:center;" |'''+'''
| [https://en.wikipedia.org/wiki/Addition Addition]
|-
| style="text-align:center;" |'''-'''
| [https://en.wikipedia.org/wiki/Subtraction Subtraction]
|-
| style="text-align:center;" | '''*'''
| [https://en.wikipedia.org/wiki/Multiplication Multiplication]
|-
| style="text-align:center;" | '''/'''
| Floating point [https://en.wikipedia.org/wiki/Division_(mathematics) Division]
|-
| style="text-align:center;" | '''%'''
| [https://en.wikipedia.org/wiki/Remainder Remainder]
|-
| style="text-align:center;" | '''^'''
| [https://en.wikipedia.org/wiki/Exponentiation Exponentiation]
|}


<div class="mw-translate-fuzzy">
<div class="mw-translate-fuzzy">
Mehrere Argumente einer Funktion können entweder durch Semikolon (';') oder ein Komma <em>gefolgt von einem Leerzeichen</em> getrennt werden.
Trigonometrische Funktionen verwenden Grad als Standardeinheit. Durch Hinzufügen von "''rad''" kann auch die Einheit Radiant verwendet werden.
Im letzteren Fall wird das Komma nach der Eingabe in ein Semikolon konvertiert.
Wenn ein Semikolon verwendet wurde, ist kein nachfolgendes Leerzeichen erforderlich.
</div>
</div>


The following constants are supported:
Multiple arguments to a function may be separated by either a semicolon (';') or
{| class="wikitable float-right mw-collapsible mw-uncollapsed"
a comma <em>followed by a space</em> (", ").
!style="width: 33%;"|Constant
In the latter case, the comma is converted to a semicolon after entry.
!style="width: 66%;"|Description
When a semicolon is used, no trailing space is necessary.
|-
| style="text-align:center;" | '''e'''
| [https://en.wikipedia.org/wiki/E_(mathematical_constant) Euler's number]
|-
| style="text-align:center;" | '''pi'''
| [https://en.wikipedia.org/wiki/Pi Pi]
|}


== Unterstützte Funktionen ==
Trigonometrische Funktionen verwenden Grad als Standardeinheit; durch Hinzufügen von '''rad''' nach dem <em>ersten</em> Wert kann auch die Einheit Radiant in einem Ausdruck verwendet werden.
Beispiel: cos(45) ist das Gleiche wie cos(pi rad / 4).


=== General Mathematical Functions ===
{{APIFunction |abs|x| Absolute value | value <nowiki> >= 0 </nowiki> }}

{{APIFunction |acos|x| Arc cosine; <nowiki> -1 <= x <= 1 </nowiki> | acos(x) }}
Die nachfolgend aufgeführten mathematischen Funktionen sind verfügbar.
{{APIFunction |asin|x| Arc sine; <nowiki> -1 <= x <= 1 </nowiki> | asin(x) }}

{{APIFunction |atan|x| Arc tangent | atan(x) }}
Multiple arguments to a function may be separated by either a semicolon ';' or a comma <em>followed by a space</em> ', '. In the latter case, the comma is converted to a semicolon after entry. When a semicolon is used, no trailing space is necessary.
{{APIFunction |atan2|y, x| Arc tangent of y / x; | atan2(y,x) }}

{{APIFunction |ceil|x| Ceiling | The smallest integer value greater than or equal to x {{Version|0.16}} }}
[https://en.wikipedia.org/wiki/Trigonometric_functions Trigonometric functions] use degree as their default unit. For radian measure, add '''rad''' following the <em>first</em> value in an expression. So e.g. '''cos(45)''' is the same as '''cos(pi rad / 4)'''. Expressions in degrees can use either '''deg''' or '''°''', e.g. '''360deg - atan2(3; 4)''' or '''360&deg; - atan2(3; 4)'''. If an expression is without units and needs to be converted to degrees or radians for compatibility, multiply by '''1&nbsp;deg''', '''1&nbsp;°''' or '''1&nbsp;rad''' as appropriate, e.g. '''(360 - X) * 1deg'''; '''(360 - X) * 1°'''; '''(0.5 + pi / 2) * 1rad'''. <br/>
{{APIFunction |cos|angle| Cosine; angle is in degrees (any value) | <nowiki> -1 <= cos(x) <= 1 </nowiki> }}
These trigonometric functions are supported:
{{APIFunction |cosh|x| Hyperbolic cosine of x | cosh(x) }}
{| class="wikitable float-right mw-collapsible mw-collapsed"
{{APIFunction |exp|y| Natural exponent | e<sup> y</sup> }}
!style="width: 33%;"|Function
{{APIFunction |floor|x| Floor | The largest integer value less than or equal to x {{Version|0.16}} }}
!style="width: 33%;"|Description
{{APIFunction |log|x| Natural logarithm | log<sub>e</sub> x }}
!style="width: 33%;"|Value range
{{APIFunction |log10|x| Logarithm base 10 | log<sub>10</sub> x }}
|-
{{APIFunction |mod|x, y| Remainder x/y | Remainder after dividing x by y }}
| acos(x)
{{APIFunction |pow|x, y| Power function| x<sup> y</sup> }}
| [https://en.wikipedia.org/wiki/Inverse_trigonometric_functions#Basic_properties Arc cosine]
{{APIFunction |round|x| | x rounded to the nearest integer {{Version|0.16}} }}
| -1 <= x <= 1
{{APIFunction |sin|angle| Cosine; angle in degrees (any value) | <nowiki> -1 <= sin(x) <= 1 </nowiki> }}
|-
{{APIFunction |sinh|x| Hyperbolic sine of x | sinh(x) }}
| asin(x)
{{APIFunction |sqrt|x| Square root; <nowiki> x >= 0 </nowiki> | Square root of x }}
| [https://en.wikipedia.org/wiki/Inverse_trigonometric_functions#Basic_properties Arc sine]
{{APIFunction |tan|angle| Tangent; angle in degrees (any value) | tan(angle) }}
| -1 <= x <= 1
{{APIFunction |tanh|x| Hyperbolic tangent of x | tanh(x) }}
|-
{{APIFunction |trunc|x| Truncate | x truncated to the nearest integer {{Version|0.16}} }}
| atan(x)
| [https://en.wikipedia.org/wiki/Inverse_trigonometric_functions#Basic_properties Arc tangent]
| all
|-
| atan2(x, y)
| [https://en.wikipedia.org/wiki/Inverse_trigonometric_functions#Basic_properties Arc tangent] of ''x/y''
| all, except y = 0
|-
| cos(x)
| [https://en.wikipedia.org/wiki/Trigonometric_functions#Right-angled_triangle_definitions Cosine]
| all
|-
| cosh(x)
| [https://en.wikipedia.org/wiki/Hyperbolic_function#Trigonometric_definitions Hyperbolic cosine]
| all
|-
| sin(x)
| [https://en.wikipedia.org/wiki/Trigonometric_functions#Right-angled_triangle_definitions Sine]
| all
|-
| sinh(x)
| [https://en.wikipedia.org/wiki/Hyperbolic_function#Trigonometric_definitions Hyperbolic sine]
| all
|-
| tan(x)
| [https://en.wikipedia.org/wiki/Trigonometric_functions#Right-angled_triangle_definitions Tangent]
| all, except of x = n·90 with n = integer
|-
| tanh(x)
| [https://en.wikipedia.org/wiki/Hyperbolic_function#Trigonometric_definitions Hyperbolic tangent]
| all
|}

These functions for exponentiation and logarithmization are supported:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Function
!style="width: 33%;"|Description
!style="width: 33%;"|Value range
|-
| exp(x)
| [https://en.wikipedia.org/wiki/Exponential_function#Formal_definition Exponential function]
| all
|-
| log(x)
| [https://en.wikipedia.org/wiki/Natural_logarithm Natural logarithm]
| x > 0
|-
| log10(x)
| [https://en.wikipedia.org/wiki/Common_logarithm Common logarithm]
| x > 0
|-
| pow(x, y)
| [https://en.wikipedia.org/wiki/Exponentiation Exponentiation]
| all
|-
| sqrt(x)
| [https://en.wikipedia.org/wiki/Square_root Square root]
| x >= 0
|}

These functions for rounding, truncation and remainder are supported:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 20%;"|Function
!style="width: 55%;"|Description
!style="width: 25%;"|Value range
|-
| abs(x)
| [https://en.wikipedia.org/wiki/Absolute_value Absolute value]
| all
|-
| ceil(x)
| [https://en.wikipedia.org/wiki/Floor_and_ceiling_functions Ceiling function] smallest integer value greater than or equal to x
| all
|-
| floor(x)
| [https://en.wikipedia.org/wiki/Floor_and_ceiling_functions Floor function], largest integer value less than or equal to x
| all
|-
| mod(x, y)
| [https://en.wikipedia.org/wiki/Remainder Remainder] after dividing ''x'' by ''y''
| all, except y = 0
|-
| round(x)
| [https://en.wikipedia.org/wiki/Rounding Rounding] to the nearest integer
| all
|-
| trunc(x)
| [https://en.wikipedia.org/wiki/Truncation Truncation] to the nearest integer
| all
|}


<div class="mw-translate-fuzzy">
<div class="mw-translate-fuzzy">
Line 57: Line 196:
</div>
</div>


These aggregate functions are supported:
{{APIFunction |average|x y| Average of values in cells x through y | sum(x, y) / count(x, y) }}
{| class="wikitable float-right mw-collapsible mw-collapsed"
{{APIFunction |count|x y| Number of cells from x through y | The number of cells from x through y, inclusive }}
!style="width: 20%;"|Function
{{APIFunction |max|x y| Maximum value in cells x through y | Maximum value }}
!style="width: 55%;"|Description
{{APIFunction |min|x y| Minimum value in cells x through y | Minimum value }}
!style="width: 25%;"|Value range
{{APIFunction |stddev|x y| Standard deviation of values in cells x through y | Standard deviation }}
|-
{{APIFunction |sum|x y| Sum of values in cells x through y | Sum }}
| average(x:y)
| [https://en.wikipedia.org/wiki/Arithmetic_mean Arithmetic mean] of values in cells x through y; sum(x:y) / count(x:y)
| all
|-
| count(x:y)
| [https://en.wikipedia.org/wiki/Counting Counting] of cells from x through y
| all
|-
| max(x:y)
| [https://en.wikipedia.org/wiki/Maxima_and_minima Maximum] value in cells x through y
| all
|-
| min(x:y)
| [https://en.wikipedia.org/wiki/Maxima_and_minima Minimum] value in cells x through y
| all
|-
| stddev(x:y)
| [https://en.wikipedia.org/wiki/Standard_deviation Standard deviation] of values in cells x through y
| all
|-
| sum(x: y)
| [https://en.wikipedia.org/wiki/Summation Sum] of values in cells x through y
| all
|}


=== Bedingte Ausdrücke ===
== Conditional Expressions ==


<div class="mw-translate-fuzzy">
<div class="mw-translate-fuzzy">
Bedingte Ausdrücke haben die Form ''Bedingung ? ResultatTrue : ResultatFalse''
Die Bedingung muss ein Ausdruck sein, der entweder 0 (für falsch) oder ungleich 0 für wahr ergibt. Die folgenden Vergleichsoperatoren stehen zur Verfügung: ==, !=, >, <, >=, und <=.
</div>

The following [https://en.wikipedia.org/wiki/Relational_operator#Standard_relational_operators relational operators] are defined:
{| class="wikitable float-right mw-collapsible mw-uncollapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| style="text-align:center;" | '''=='''
| equal to
|-
| style="text-align:center;" | '''!='''
| not equal to
|-
| style="text-align:center;" | '''>'''
| greater than
|-
| style="text-align:center;" | '''<'''
| less than
|-
| style="text-align:center;" | '''>='''
| greater than or equal to
|-
| style="text-align:center;" | '''<='''
| less than or equal to
|}

<div class="mw-translate-fuzzy">
Die Bedingung muss ein Ausdruck sein, der entweder 0 ({{FALSE}}) oder ungleich 0 ({{TRUE}}) ergibt. Die folgenden Vergleichsoperatoren stehen zur Verfügung: ==, !=, >, <, >= und <=.
</div>
</div>


Units can directly be used in expressions. The parser connects them to the previous value. So ''''2mm'''' or ''''2 mm'''' is valid while '''' mm'''' is invalid because there is no preceding value.
The condition is defined as an expression that evaluates to either 0 (false) or non-zero (true). The following comparison operators are defined: ==, !=, >, <, >=, and <=.

All values must have a unit. Therefore you must in general use a unit for values in spreadsheets.<br/>
In some cases it works even without a unit, for example if you have e.g. in spreadsheet cell B1 just the number ''1.5'' and refer to it for a pad height. This only works because the pad height predefines the unit ''mm'' that is used if no unit is given. It will nevertheless fail if you use for the pad height e.g. '''Sketch1.Constraints.Width - Spreadsheet.B1''' because ''Sketch1.Constraints.Width'' has a unit and ''Spreadsheet.B1'' has not.

Units with exponents can directly be entered. So e.g. '''mm^3''' will be recognized as mm³ and '''m^3''' will be recognized as m³.

<div class="mw-translate-fuzzy">
Trigonometrische Funktionen verwenden Grad als Standardeinheit; durch Hinzufügen von '''rad''' nach dem <em>ersten</em> Wert kann auch die Einheit Radiant in einem Ausdruck verwendet werden.
Beispiel: cos(45) ist das Gleiche wie cos(pi rad / 4).
</div>

The following units are recognized by the expression parser:

Amount of substance:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| mmol
| Milli[https://en.wikipedia.org/wiki/Mole_(unit) mole]
|-
| mol
| [https://en.wikipedia.org/wiki/Mole_(unit) Mole]
|}

Angle:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| °
| [https://en.wikipedia.org/wiki/Degree_(angle) Degree]; alternative to the unit ''deg''
|-
| deg
| [https://en.wikipedia.org/wiki/Degree_(angle) Degree]; alternative to the unit ''°''
|-
| rad
| [https://en.wikipedia.org/wiki/Radian Radian]
|-
| gon
| [https://en.wikipedia.org/wiki/Gon_(unit) Gradian]
|-
| S
| [https://en.wikipedia.org/wiki/Minute_and_second_of_arc Second of arc]
|-
| ″
| [https://en.wikipedia.org/wiki/Minute_and_second_of_arc Second of arc]; alternative to the unit ''S''
|-
| M
| [https://en.wikipedia.org/wiki/Minute_and_second_of_arc Minute of arc]
|-
| ′
| [https://en.wikipedia.org/wiki/Minute_and_second_of_arc Minute of arc]; alternative to the unit ''M''
|}

Current:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| mA
| Milli[https://en.wikipedia.org/wiki/Ampere ampere]
|-
| A
| [https://en.wikipedia.org/wiki/Ampere Ampere]
|-
| kA
| Kilo[https://en.wikipedia.org/wiki/Ampere ampere]
|-
| MA
| Mega[https://en.wikipedia.org/wiki/Ampere ampere]
|}

Electrical Capacitance:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| pF
| Pico[https://en.wikipedia.org/wiki/Farad farad], {{Version|0.19}}
|-
| nF
| Nano[https://en.wikipedia.org/wiki/Farad farad], {{Version|0.19}}
|-
| uF
| Micro[https://en.wikipedia.org/wiki/Farad farad]; alternative to the unit ''µF'', {{Version|0.19}}
|-
| µF
| Micro[https://en.wikipedia.org/wiki/Farad farad]; alternative to the unit ''uF'', {{Version|0.19}}
|-
| mF
| Milli[https://en.wikipedia.org/wiki/Farad farad], {{Version|0.19}}
|-
| F
| [https://en.wikipedia.org/wiki/Farad Farad]; 1 F = 1 s^4·A^2/m^2/kg, {{Version|0.19}}
|}

Electrical Conductance:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| uS
| Micro[https://en.wikipedia.org/wiki/Siemens_(unit) siemens]; alternative to the unit ''µS'', {{Version|0.19}}
|-
| µS
| Micro[https://en.wikipedia.org/wiki/Siemens_(unit) siemens]; alternative to the unit ''uS'', {{Version|0.19}}
|-
| mS
| Milli[https://en.wikipedia.org/wiki/Siemens_(unit) siemens], {{Version|0.19}}
|-
| S
| [https://en.wikipedia.org/wiki/Siemens_(unit) Siemens]; 1 S = 1 s^3·A^2/kg/m^2, {{Version|0.19}}
|}

Electrical Inductance:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| nH
| Nano[https://en.wikipedia.org/wiki/Henry_(unit) henry], {{Version|0.19}}
|-
| uH
| Micro[https://en.wikipedia.org/wiki/Henry_(unit) henry]; alternative to the unit ''µH'', {{Version|0.19}}
|-
| µH
| Micro[https://en.wikipedia.org/wiki/Henry_(unit) henry]; alternative to the unit ''uH'', {{Version|0.19}}
|-
| mH
| Milli[https://en.wikipedia.org/wiki/Henry_(unit) henry], {{Version|0.19}}
|-
| H
| [https://en.wikipedia.org/wiki/Henry_(unit) Henry]; 1 H = 1 kg·m^2/s^2/A^2, {{Version|0.19}}
|}

Electrical Resistance:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| Ohm
| [https://en.wikipedia.org/wiki/Ohm Ohm]; 1 Ohm = 1 kg·m^2/s^3/A^2, {{Version|0.19}}
|-
| kOhm
| Kilo[https://en.wikipedia.org/wiki/Ohm ohm], {{Version|0.19}}
|-
| MOhm
| Mega[https://en.wikipedia.org/wiki/Ohm ohm], {{Version|0.19}}
|}

Electric Charge:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| C
| [https://en.wikipedia.org/wiki/Coulomb Coulomb]; 1 C = 1 A·s, {{Version|0.19}}
|}

Electric Potential:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| mV
| Milli[https://en.wikipedia.org/wiki/Volt volt]
|-
| V
| [https://en.wikipedia.org/wiki/Volt Volt]
|-
| kV
| Kilo[https://en.wikipedia.org/wiki/Volt volt]
|}

Energy / Work:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| mJ
| Milli[https://en.wikipedia.org/wiki/Joule joule]
|-
| J
| [https://en.wikipedia.org/wiki/Joule Joule]
|-
| kJ
| Kilo[https://en.wikipedia.org/wiki/Joule joule], {{Version|0.19}}
|-
| eV
| [https://en.wikipedia.org/wiki/Electronvolt Electronvolt]; 1 ev = 1.602176634e-19 J, {{Version|0.19}}
|-
| keV
| Kilo[https://en.wikipedia.org/wiki/Electronvolt electronvolt], {{Version|0.19}}
|-
| MeV
| Mega[https://en.wikipedia.org/wiki/Electronvolt electronvolt], {{Version|0.19}}
|-
| kWh
| [https://en.wikipedia.org/wiki/Kilowatt_hour Kilowatt hour]; 1 kWh = 3.6e6 J, {{Version|0.19}}
|-
| Ws
| [https://en.wikipedia.org/wiki/Joule#Watt_second Watt second]; alternative to the unit ''Joule''
|-
| VAs
| [https://en.wikipedia.org/wiki/Joule Volt-ampere-second]; alternative to the unit ''Joule''
|-
| CV
| [https://en.wikipedia.org/wiki/Joule Coulomb-volt]; alternative to the unit ''Joule''
|-
| cal
| [https://en.wikipedia.org/wiki/Calorie Calorie]; 1 cal = 4.184 J, {{Version|0.19}}
|-
| kcal
| Kilo[https://en.wikipedia.org/wiki/Calorie calorie], {{Version|0.19}}
|}

Force:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| mN
| Milli[https://en.wikipedia.org/wiki/Newton_(unit) newton]
|-
| N
| [https://en.wikipedia.org/wiki/Newton_(unit) Newton]
|-
| kN
| Kilo[https://en.wikipedia.org/wiki/Newton_(unit) newton]
|-
| MN
| Mega[https://en.wikipedia.org/wiki/Newton_(unit) newton]
|-
| lbf
| [https://en.wikipedia.org/wiki/Pound_(force) Pound of force]
|}

Length:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| nm
| Nano[https://en.wikipedia.org/wiki/Metre meter]
|-
| um
| Micro[https://en.wikipedia.org/wiki/Metre meter]; alternative to the unit ''µm''
|-
| µm
| Micro[https://en.wikipedia.org/wiki/Metre meter]; alternative to the unit ''mu''
|-
| mm
| Milli[https://en.wikipedia.org/wiki/Metre meter]
|-
| cm
| Centi[https://en.wikipedia.org/wiki/Metre meter]
|-
| mm
| Milli[https://en.wikipedia.org/wiki/Metre meter]
|-
| dm
| Deci[https://en.wikipedia.org/wiki/Metre meter]
|-
| m
| [https://en.wikipedia.org/wiki/Metre Meter]
|-
| km
| Kilo[https://en.wikipedia.org/wiki/Metre meter]
|-
| mil
| [https://en.wikipedia.org/wiki/Thousandth_of_an_inch Thousandth of an inch]; alternative to the unit ''thou''
|-
| thou
| [https://en.wikipedia.org/wiki/Thousandth_of_an_inch Thousandth of an inch]; alternative to the unit ''mil''
|-
| in
| [https://en.wikipedia.org/wiki/Inch Inch]
|-
| ft
| [https://en.wikipedia.org/wiki/Foot_(unit) Foot]; alternative to the unit '
|-
| '
| [https://en.wikipedia.org/wiki/Foot_(unit) Foot]; alternative to the unit ''ft''
|-
| yd
| [https://en.wikipedia.org/wiki/Yard Yard]
|-
| mi
| [https://en.wikipedia.org/wiki/Mile Mile]
|}

Luminous Intensity:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| cd
| [https://en.wikipedia.org/wiki/Candela Candela]
|}

Magnetic Field Strength:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| Oe
| [https://en.wikipedia.org/wiki/Oersted Oersted]; 1 Oe = 79.57747 A/m, {{Version|0.19}}
|}

Magnetic Flux:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| Wb
| [https://en.wikipedia.org/wiki/Weber_(unit) Weber]; 1 Wb = 1 kg*m^2/s^2/A, {{Version|0.19}}
|}

Magnetic Flux Density:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| G
| [https://en.wikipedia.org/wiki/Gauss_(unit) Gauss]; 1 G = 1 e-4 T, {{Version|0.19}}
|-
| T
| [https://en.wikipedia.org/wiki/Tesla_(unit) Tesla]; 1 T = 1 kg/s^2/A, {{Version|0.19}}
|}

Mass:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| ug
| Micro[https://en.wikipedia.org/wiki/Gram gram]; alternative to the unit ''µg''
|-
| µg
| Micro[https://en.wikipedia.org/wiki/Gram gram]; alternative to the unit ''ug''
|-
| mg
| Milli[https://en.wikipedia.org/wiki/Gram gram]
|-
| g
| [https://en.wikipedia.org/wiki/Gram Gram]
|-
| kg
| Kilo[https://en.wikipedia.org/wiki/Gram gram]
|-
| t
| [https://en.wikipedia.org/wiki/Tonne Tonne]
|-
| oz
| [https://en.wikipedia.org/wiki/Ounce Ounce]
|-
| lb
| [https://en.wikipedia.org/wiki/Pound_(mass) Pound]; alternative to the unit ''lbm''
|-
| lbm
| [https://en.wikipedia.org/wiki/Pound_(mass) Pound]; alternative to the unit ''lb''
|-
| st
| [https://en.wikipedia.org/wiki/Stone_(weight) Stone]
|-
| cwt
| [https://en.wikipedia.org/wiki/Hundredweight Hundredweight]
|}

<div class="mw-translate-fuzzy">
=== Bedingte Ausdrücke ===
</div>

Pressure:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| Pa
| [https://en.wikipedia.org/wiki/Pascal_(unit) Pascal]
|-
| kPa
| Kilo[https://en.wikipedia.org/wiki/Pascal_(unit) pascal]
|-
| MPa
| Mega[https://en.wikipedia.org/wiki/Pascal_(unit) pascal]
|-
| GPa
| Giga[https://en.wikipedia.org/wiki/Pascal_(unit) pascal]
|-
| mbar
| Milli[https://en.wikipedia.org/wiki/Bar_(unit) Bar], {{Version|0.19}}
|-
| bar
| [https://en.wikipedia.org/wiki/Bar_(unit) Bar], {{Version|0.19}}
|-
| uTorr
| Micro[https://en.wikipedia.org/wiki/Torr torr]; alternative to the unit ''µTorr''
|-
| µTorr
| Micro[https://en.wikipedia.org/wiki/Torr torr]; alternative to the unit ''uTorr''
|-
| mTorr
| Milli[https://en.wikipedia.org/wiki/Torr torr]
|-
| Torr
| [https://en.wikipedia.org/wiki/Torr Torr]; 1 Torr = 133.32 Pa
|-
| psi
| [https://en.wikipedia.org/wiki/Pounds_per_square_inch Pound-force per square inch]; 1 psi = 6.895 kPa
|-
| ksi
| Kilo[https://en.wikipedia.org/wiki/Pounds_per_square_inch pound-force per square inch]
|-
| Mpsi
| Mega[https://en.wikipedia.org/wiki/Pounds_per_square_inch pound-force per square inch], {{Version|0.19}}
|}

Temperature:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| uK
| Micro[https://en.wikipedia.org/wiki/Kelvin kelvin]; alternative to the unit ''µK''
|-
| µK
| Micro[https://en.wikipedia.org/wiki/Kelvin kelvin]; alternative to the unit ''uK''
|-
| mK
| Milli[https://en.wikipedia.org/wiki/Kelvin kelvin]
|-
| K
| [https://en.wikipedia.org/wiki/Kelvin Kelvin]
|}

Time:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| s
| [https://en.wikipedia.org/wiki/Second Second]
|-
| min
| [https://en.wikipedia.org/wiki/Minute Minute]
|-
| h
| [https://en.wikipedia.org/wiki/Hour Hour]
|-
| Hz (1/s)
| [https://en.wikipedia.org/wiki/Hertz Hertz], {{Version|0.19}}
|-
| kHz
| Kilo[https://en.wikipedia.org/wiki/Hertz hertz], {{Version|0.19}}
|-
| MHz
| Mega[https://en.wikipedia.org/wiki/Hertz hertz], {{Version|0.19}}
|-
| GHz
| Giga[https://en.wikipedia.org/wiki/Hertz hertz], {{Version|0.19}}
|-
| THz
| Tera[https://en.wikipedia.org/wiki/Hertz hertz], {{Version|0.19}}
|}

Torque:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| Nm
| [https://en.wikipedia.org/wiki/Newton_metre Newton metre]
|}

Volume:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| ml
| Milli[https://en.wikipedia.org/wiki/Litre liter], {{Version|0.19}}
|-
| l
| [https://en.wikipedia.org/wiki/Litre Liter]
|-
| cft
| Cubic[https://en.wikipedia.org/wiki/Foot_(unit) foot], {{Version|0.19}}
|}

Special imperial units:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 33%;"|Unit
!style="width: 66%;"|Description
|-
| mph
| [https://en.wikipedia.org/wiki/Miles_per_hour Miles per hour], {{Version|0.19}}
|-
| sqft
| [https://en.wikipedia.org/wiki/Square_foot Square foot], {{Version|0.19}}
|}

The following commonly used units are not yet supported:
{| class="wikitable float-right mw-collapsible mw-collapsed"
!style="width: 25%;"|Unit
!style="width: 50%;"|Description
!style="width: 25%;"|Alternative
|-
| °C
| [https://en.wikipedia.org/wiki/Celsius Celsius ]
| [°C] + 273.15 K
|-
| °F
| [https://en.wikipedia.org/wiki/Fahrenheit Fahrenheit];
| ([°F] + 459.67) × ​5/9
|-
| u
| [https://en.wikipedia.org/wiki/Unified_atomic_mass_unit Atomic mass unit]; alternative to the unit 'Da'
| 1.66053906660e-27 kg
|-
| Da
| [https://en.wikipedia.org/wiki/Unified_atomic_mass_unit Dalton]; alternative to the unit 'u'
| 1.66053906660e-27 kg
|-
| sr
| [https://en.wikipedia.org/wiki/Steradian Steradian]
| not directly
|-
| lm
| [https://en.wikipedia.org/wiki/Lumen_(unit) Lumen]
| not directly
|-
| lx
| [https://en.wikipedia.org/wiki/Lux Lux]
| not directly
|-
| px
| [https://en.wikipedia.org/wiki/Pixel Pixel]
| not directly
|}


== Referenzen auf CAD-Daten ==
== Referenzen auf CAD-Daten ==
Line 126: Line 858:


<div class="mw-translate-fuzzy">
<div class="mw-translate-fuzzy">
Es ist möglich eine Tabelle der Tabellenkalkulation in einem Dokument zu haben und aus anderen Dokumenten auf Werte dieser Tabelle zu referenzieren.
Es ist möglich, eine Tabelle in einem Dokument aus einem anderen Dokument zu referenzieren.
</div>
</div>


Line 136: Line 868:
Danach können weitere Dokumente erstellt werden in denen entsprechende Rechenausdrücke eingesetzt werden. Angenommen, dass das Stammdokument "Stammdaten" genannt wurde, können Referenzen auf das Stammdokument wie folgt eingesetzt werden: Stammdaten#Spreadsheet.Length
Danach können weitere Dokumente erstellt werden in denen entsprechende Rechenausdrücke eingesetzt werden. Angenommen, dass das Stammdokument "Stammdaten" genannt wurde, können Referenzen auf das Stammdokument wie folgt eingesetzt werden: Stammdaten#Spreadsheet.Length
</div>
</div>

{{Code|code=master#modelConstants.Length}}

'''Note:''' that the master document must be loaded for the values in the master to be available to the dependent document.


<div class="mw-translate-fuzzy">
<div class="mw-translate-fuzzy">
Line 151: Line 887:
</div>
</div>


{{Powerdocnavi{{#translation:}}}}
<div class="mw-translate-fuzzy">
[[Category:User Documentation/de]]
[[Category:Spreadsheet{{#translation:}}]]
</div>

{{clear}}
{{clear}}

Revision as of 19:49, 15 May 2020

Seit der Version 0.16 ist es möglich, Modelleigenschaften durch Rechenformeln festzulegen und mit anderen Eigenschaften von der Benutzeroberfläche aus zu verknüpfen. Eingabefelder von Eigenschaften für Zahlen oder Größenangaben enthalten einen blauen Knopf File:Sketcher Expressions.png. Wenn man auf dieses Symbol klickt oder das Gleichheitszeichen (=) eingibt, öffnet sich der Formeleditor für die entsprechende Eigenschaft.

Ein Rechenausdruck in FreeCAD ist ein mathematischer Ausdruck in der üblichen Schreibweise für die Standardrechenarten (+, -, * und /) und mathematische Funktionen (siehe unten). Zusätzlich können referenzierte Eigenschaften anderer Objekte und bedingte Ausdrücke verwendet werden. Zahlen in Rechenausdrücken können mit einer optionalen Einheit versehen sein.

Numbers may use either a comma ',' or a decimal point '.' separating whole digits from decimals. When the decimal marker is used, it must be followed by at least one digit. Thus, the expressions 1.+2. and 1,+2, are invalid, but 1.0 + 2.0 and 1,0 + 2,0 are valid.

Die Rechenarten und Funktionen verstehen sich auf Einheiten und erfordern deshalb bei der Verwendung von Einheiten zulässige Einheitenkombinationen. 2mm+4mm ist zum Beispiel ein zulässiger Rechenausdruck, während 2mm+4 nicht zulässig ist. (Der Grund dafür ist, das ein Ausdruck wie 1in + 4 von Menschen wohl als 1in + 4in interpretiert wird, das System dies jedoch nicht erraten kann, da alle Einheiten intern in das SI-System konvertiert werden.)

You can use predefined constants and functions.

Referencing objects

You can reference to an object by its Name or by its Label. In the case of a Label, it must be enclosed in double << and >> symbols, such as <<Label>>.

You can reference any numerical property of this object. For example, to refer to a Cylinder's height, you may use Cylinder.Height or <<Long_name_of_cylinder>>.Height.

To reference list objects, the syntax is <<object_label>>.list[list_index] or object_name.list[list_index]. If you want for example reference a constraint in a sketch, do it this way <<MySketch>>.Constraints[16]. If you are in the same sketch you can omit its name and just use Constraints[16].
Note: The index starts with 0, therefore constraint 17 has the index 16.

For more info about referencing objects, see this section.


The following operators are supported:

Operator Description
+ Addition
- Subtraction
* Multiplication
/ Floating point Division
% Remainder
^ Exponentiation

Mehrere Argumente einer Funktion können entweder durch Semikolon (';') oder ein Komma gefolgt von einem Leerzeichen getrennt werden. Im letzteren Fall wird das Komma nach der Eingabe in ein Semikolon konvertiert. Wenn ein Semikolon verwendet wurde, ist kein nachfolgendes Leerzeichen erforderlich.

The following constants are supported:

Constant Description
e Euler's number
pi Pi

Unterstützte Funktionen

General Mathematical Functions

Die nachfolgend aufgeführten mathematischen Funktionen sind verfügbar.

Multiple arguments to a function may be separated by either a semicolon ';' or a comma followed by a space ', '. In the latter case, the comma is converted to a semicolon after entry. When a semicolon is used, no trailing space is necessary.

Trigonometric functions use degree as their default unit. For radian measure, add rad following the first value in an expression. So e.g. cos(45) is the same as cos(pi rad / 4). Expressions in degrees can use either deg or °, e.g. 360deg - atan2(3; 4) or 360° - atan2(3; 4). If an expression is without units and needs to be converted to degrees or radians for compatibility, multiply by 1 deg, 1 ° or 1 rad as appropriate, e.g. (360 - X) * 1deg; (360 - X) * 1°; (0.5 + pi / 2) * 1rad.
These trigonometric functions are supported:

Function Description Value range
acos(x) Arc cosine -1 <= x <= 1
asin(x) Arc sine -1 <= x <= 1
atan(x) Arc tangent all
atan2(x, y) Arc tangent of x/y all, except y = 0
cos(x) Cosine all
cosh(x) Hyperbolic cosine all
sin(x) Sine all
sinh(x) Hyperbolic sine all
tan(x) Tangent all, except of x = n·90 with n = integer
tanh(x) Hyperbolic tangent all

These functions for exponentiation and logarithmization are supported:

Function Description Value range
exp(x) Exponential function all
log(x) Natural logarithm x > 0
log10(x) Common logarithm x > 0
pow(x, y) Exponentiation all
sqrt(x) Square root x >= 0

These functions for rounding, truncation and remainder are supported:

Function Description Value range
abs(x) Absolute value all
ceil(x) Ceiling function smallest integer value greater than or equal to x all
floor(x) Floor function, largest integer value less than or equal to x all
mod(x, y) Remainder after dividing x by y all, except y = 0
round(x) Rounding to the nearest integer all
trunc(x) Truncation to the nearest integer all

Die Konstanten pi und e sind vordefiniert.

These aggregate functions are supported:

Function Description Value range
average(x:y) Arithmetic mean of values in cells x through y; sum(x:y) / count(x:y) all
count(x:y) Counting of cells from x through y all
max(x:y) Maximum value in cells x through y all
min(x:y) Minimum value in cells x through y all
stddev(x:y) Standard deviation of values in cells x through y all
sum(x: y) Sum of values in cells x through y all

Conditional Expressions

Bedingte Ausdrücke haben die Form Bedingung ? ResultatTrue : ResultatFalse

The following relational operators are defined:

Unit Description
== equal to
!= not equal to
> greater than
< less than
>= greater than or equal to
<= less than or equal to

Die Bedingung muss ein Ausdruck sein, der entweder 0 (false) oder ungleich 0 (true) ergibt. Die folgenden Vergleichsoperatoren stehen zur Verfügung: ==, !=, >, <, >= und <=.

Units can directly be used in expressions. The parser connects them to the previous value. So '2mm' or '2 mm' is valid while ' mm' is invalid because there is no preceding value.

All values must have a unit. Therefore you must in general use a unit for values in spreadsheets.
In some cases it works even without a unit, for example if you have e.g. in spreadsheet cell B1 just the number 1.5 and refer to it for a pad height. This only works because the pad height predefines the unit mm that is used if no unit is given. It will nevertheless fail if you use for the pad height e.g. Sketch1.Constraints.Width - Spreadsheet.B1 because Sketch1.Constraints.Width has a unit and Spreadsheet.B1 has not.

Units with exponents can directly be entered. So e.g. mm^3 will be recognized as mm³ and m^3 will be recognized as m³.

Trigonometrische Funktionen verwenden Grad als Standardeinheit; durch Hinzufügen von rad nach dem ersten Wert kann auch die Einheit Radiant in einem Ausdruck verwendet werden. Beispiel: cos(45) ist das Gleiche wie cos(pi rad / 4).

The following units are recognized by the expression parser:

Amount of substance:

Unit Description
mmol Millimole
mol Mole

Angle:

Unit Description
° Degree; alternative to the unit deg
deg Degree; alternative to the unit °
rad Radian
gon Gradian
S Second of arc
Second of arc; alternative to the unit S
M Minute of arc
Minute of arc; alternative to the unit M

Current:

Unit Description
mA Milliampere
A Ampere
kA Kiloampere
MA Megaampere

Electrical Capacitance:

Unit Description
pF Picofarad, introduced in version 0.19
nF Nanofarad, introduced in version 0.19
uF Microfarad; alternative to the unit µF, introduced in version 0.19
µF Microfarad; alternative to the unit uF, introduced in version 0.19
mF Millifarad, introduced in version 0.19
F Farad; 1 F = 1 s^4·A^2/m^2/kg, introduced in version 0.19

Electrical Conductance:

Unit Description
uS Microsiemens; alternative to the unit µS, introduced in version 0.19
µS Microsiemens; alternative to the unit uS, introduced in version 0.19
mS Millisiemens, introduced in version 0.19
S Siemens; 1 S = 1 s^3·A^2/kg/m^2, introduced in version 0.19

Electrical Inductance:

Unit Description
nH Nanohenry, introduced in version 0.19
uH Microhenry; alternative to the unit µH, introduced in version 0.19
µH Microhenry; alternative to the unit uH, introduced in version 0.19
mH Millihenry, introduced in version 0.19
H Henry; 1 H = 1 kg·m^2/s^2/A^2, introduced in version 0.19

Electrical Resistance:

Unit Description
Ohm Ohm; 1 Ohm = 1 kg·m^2/s^3/A^2, introduced in version 0.19
kOhm Kiloohm, introduced in version 0.19
MOhm Megaohm, introduced in version 0.19

Electric Charge:

Unit Description
C Coulomb; 1 C = 1 A·s, introduced in version 0.19

Electric Potential:

Unit Description
mV Millivolt
V Volt
kV Kilovolt

Energy / Work:

Unit Description
mJ Millijoule
J Joule
kJ Kilojoule, introduced in version 0.19
eV Electronvolt; 1 ev = 1.602176634e-19 J, introduced in version 0.19
keV Kiloelectronvolt, introduced in version 0.19
MeV Megaelectronvolt, introduced in version 0.19
kWh Kilowatt hour; 1 kWh = 3.6e6 J, introduced in version 0.19
Ws Watt second; alternative to the unit Joule
VAs Volt-ampere-second; alternative to the unit Joule
CV Coulomb-volt; alternative to the unit Joule
cal Calorie; 1 cal = 4.184 J, introduced in version 0.19
kcal Kilocalorie, introduced in version 0.19

Force:

Unit Description
mN Millinewton
N Newton
kN Kilonewton
MN Meganewton
lbf Pound of force

Length:

Unit Description
nm Nanometer
um Micrometer; alternative to the unit µm
µm Micrometer; alternative to the unit mu
mm Millimeter
cm Centimeter
mm Millimeter
dm Decimeter
m Meter
km Kilometer
mil Thousandth of an inch; alternative to the unit thou
thou Thousandth of an inch; alternative to the unit mil
in Inch
ft Foot; alternative to the unit '
' Foot; alternative to the unit ft
yd Yard
mi Mile

Luminous Intensity:

Unit Description
cd Candela

Magnetic Field Strength:

Unit Description
Oe Oersted; 1 Oe = 79.57747 A/m, introduced in version 0.19

Magnetic Flux:

Unit Description
Wb Weber; 1 Wb = 1 kg*m^2/s^2/A, introduced in version 0.19

Magnetic Flux Density:

Unit Description
G Gauss; 1 G = 1 e-4 T, introduced in version 0.19
T Tesla; 1 T = 1 kg/s^2/A, introduced in version 0.19

Mass:

Unit Description
ug Microgram; alternative to the unit µg
µg Microgram; alternative to the unit ug
mg Milligram
g Gram
kg Kilogram
t Tonne
oz Ounce
lb Pound; alternative to the unit lbm
lbm Pound; alternative to the unit lb
st Stone
cwt Hundredweight

Bedingte Ausdrücke

Pressure:

Unit Description
Pa Pascal
kPa Kilopascal
MPa Megapascal
GPa Gigapascal
mbar MilliBar, introduced in version 0.19
bar Bar, introduced in version 0.19
uTorr Microtorr; alternative to the unit µTorr
µTorr Microtorr; alternative to the unit uTorr
mTorr Millitorr
Torr Torr; 1 Torr = 133.32 Pa
psi Pound-force per square inch; 1 psi = 6.895 kPa
ksi Kilopound-force per square inch
Mpsi Megapound-force per square inch, introduced in version 0.19

Temperature:

Unit Description
uK Microkelvin; alternative to the unit µK
µK Microkelvin; alternative to the unit uK
mK Millikelvin
K Kelvin

Time:

Unit Description
s Second
min Minute
h Hour
Hz (1/s) Hertz, introduced in version 0.19
kHz Kilohertz, introduced in version 0.19
MHz Megahertz, introduced in version 0.19
GHz Gigahertz, introduced in version 0.19
THz Terahertz, introduced in version 0.19

Torque:

Unit Description
Nm Newton metre

Volume:

Unit Description
ml Milliliter, introduced in version 0.19
l Liter
cft Cubicfoot, introduced in version 0.19

Special imperial units:

Unit Description
mph Miles per hour, introduced in version 0.19
sqft Square foot, introduced in version 0.19

The following commonly used units are not yet supported:

Unit Description Alternative
°C Celsius [°C] + 273.15 K
°F Fahrenheit; ([°F] + 459.67) × ​5/9
u Atomic mass unit; alternative to the unit 'Da' 1.66053906660e-27 kg
Da Dalton; alternative to the unit 'u' 1.66053906660e-27 kg
sr Steradian not directly
lm Lumen not directly
lx Lux not directly
px Pixel not directly

Referenzen auf CAD-Daten

Größenangaben von anderen Elementen der Konstruktion können in Rechenausdrücken verwendet werden. Die Syntax für eine Referenz auf ein Eigenschaftenfeld sieht wie folgt aus: Objekt.Eigenschaft. Wenn sich die Eigenschaft aus einer Reihe von Feldern zusammensetzt, kann wie folgt darauf zugegriffen werden: Object.Eigenschaft.Feldname.

Die folgende Tabelle zeigt einige Beispiele:

CAD-Daten Aufruf im Rechenausdruck Ergebnis
Parametrische Länge eines Quaders vom Arbeitsbereich Part Cube.Length Länge mit der Einheit mm
Volumen des Quaders Cube.Shape.Volume Volumen in mm³ Ausgabe ohne Einheiten
Typ des Quader-Shapess (geometrische Figur) Cube.Shape.ShapeType String: Solid
Label des Quader-Objekts Cube.Label String: Cube
x-Koordinate des Schwerpunktes des Quaders Cube.Shape.CenterOfMass.x x-Koordinate in mm ohne Einheiten
Wert einer Beschränkung in einer Skizze Constraints.Breite Numerischer Wert der benannten Beschränkung 'Breite' in der Skizze
Wert eines Alias einer Kalkulationstabelle Spreadsheet.Tiefe Wert des Alias "Tiefe" in der Kalkulationstabelle "Spreadsheet"
Wert einer lokalen Eigenschaft des Objekts Length Wert der Eigenschaft Length von z. B. einem Pad-Objekt, wenn es in dem Ausdruck z. B. in der Eigenschaft Length2 im gleichen Objekt benutzt wird.

Dokumentweit gültige globale Variablen

Es gibt aktuell keine Infrastruktur für globale Variablen in FreeCAD. Stattdessen können beliebige Variablen als Zellwerte innerhalb einer Tabelle des Arbeitsbereiches Tabellenkalkulation (Spreadsheet) definiert werden und ihnen ein Name mittels der Alias-Eigenschaft für Zellen zugeordnet werden(Rechtsklick auf die Zelle). Danach können die Zellwerte in allen Rechenausdrücken verwendet werden, sie wie andere Eigenschaften von Objekten auch.

Dokumentübergreifende Verlinkung

Es ist möglich, eine Tabelle in einem Dokument aus einem anderen Dokument zu referenzieren.

Wichtiger Hinweis: Der Name des Dokuments muss angegeben werden, um es von einem anderen Dokument aus referenzieren zu können. Wenn ein Dokument nun zum ersten Mal gespeichert wird, muss dem Dokument ein Name gegeben werden, der normalerweise nicht "Unbenannt1" (oder eine anderssprachige Version) ist, und dann sind die Links beim erneuten Öffnen verloren. Deshalb ist es empfehlenswert zuerst das Stammdokument mit der Tabelle zu erstellen, zu speichern und zu schließen. Nach dem erneuten Öffnen wird der interne Name auf den Dateinamen gesetzt. Danach kann das Dokument geändert und gespeichert werden, aber es darf nicht umbenannt werden.

Danach können weitere Dokumente erstellt werden in denen entsprechende Rechenausdrücke eingesetzt werden. Angenommen, dass das Stammdokument "Stammdaten" genannt wurde, können Referenzen auf das Stammdokument wie folgt eingesetzt werden: Stammdaten#Spreadsheet.Length

master#modelConstants.Length

Note: that the master document must be loaded for the values in the master to be available to the dependent document.

Unglücklicherweise ist der eingebaute Formelprüfer mehr verwirrend als hilfreich, weil er immer wieder Interpretationsfehler meldet, dass dieses oder jenes nicht existiert. Daher einfach mit dem Eintippen fortfahren. Wenn man fertig ist und der Inhalt stimmt, dann wird plötzlich OK gemeldet.

Bei der Verwendung verknüpfter Dokumente ist der Benutzer dafür verantwortlich, dass alle Dokumente auch geöffnet sind, wenn irgendwelche Änderungen vorzunehmen sind.

Bekannte Probleme / Verbliebene Aufgaben

  • Der Abhängigkeitsgraph basiert auf der Beziehung zwischen Objekten des Dokuments und nicht auf Beziehungen zwischen Eigenschaften. Das bedeutet, dass man nicht Daten einem Objekt zur Verfügung stellen kann und gleichzeitig Daten von diesem Objekt abfragt, selbst wenn keine zyklische Verknüpfung auf Basis der Eigenschaften besteht. Zur Umgehung des Problems können mehrere Tabellen angelegt werden: Eine Tabelle, die die Objektdaten zur Verfügung stellt und eine andere zur Datenauswertung.
  • Es gibt keinen Manager für Rechenausdrücke, mit dem alle vorhandenen Rechenausdrücke aufgelistet werden können oder sonst wie erstellt, gelöscht oder gesucht werden können.
  • Offene Fehler/Tickets für die Rechenausdrücke (Expressions) können hier nachgeschlagen werden: FreeCAD Bugtracker Expressions category