Model Assignments
Model assignments look like value assignments but instead having a value on the right side they store a model.
m = std::geo2d::Circle(radius = 10mm); // assign the model of a circle into m
std::debug::assert_eq([m.radius, 10mm]); // access property radius of m
Using a model as a value or vice versa does not work without further operations.
m = std::geo2d::Circle(radius = 10mm); // assign the model of a circle into m
std::geo2d::Circle(radius = m); // error: cannot use m as value
Restrictions
No Shadowing
Like with value assignments so-called "shadowing" (reusing a name) is prohibited. Another assignment of a variable with the same name without an additional scope is prohibited.
Not in modules
Model assignments are not available in modules:
mod my_module {
a = std::geo2d::Circle(radius = 1mm); // error
}
Not in initialization code
Model assignments are not available in workbenches' initialization code:
sketch MySketch() {
a = std::geo2d::Circle(radius = 1mm); // error
init(_x: Scalar) {}
}
MySketch();