Property Assignments
Property assignments define additional1properties of a workbench. The may appear anywhere within the building code of a workbench and can then be read from outside.
sketch MySketch(radius: Length) {
prop diameter = radius * 2;
std::geo2d::Circle(radius);
}
std::debug::assert_eq([MySketch(5cm).diameter, 10cm])
Restrictions
Not in source files
prop diameter = radius * 2; // error: not in source file
Not in functions
fn f() {
prop diameter = radius * 2; // error: not in functions
}
f();
Not in initialization code
sketch MySketch(radius: Length) {
prop diameter = radius * 2; // error: not in initialization code
init() {
radius = 1;
}
std::geo2d::Circle(radius);
}
std::debug::assert_eq([MySketch(5cm).diameter, 10cm])
Not in initializers
sketch MySketch(radius: Length) {
init() {
radius = 1;
prop diameter = radius * 2; // error: not in initializer
}
std::geo2d::Circle(radius);
}
MySketch(5cm)
-
Additional to properties which are automatically generated from a workbench's building plan. ↩