Skip to main content

Module definition

Module definition 

Source
Expand description

Parameters: the named values a program’s design is given by — numbers, tables of variants, the part’s colour and what it is made of.

A parameter is defined once, in the program, and read by name wherever a number is typed (NumericInput): a sketch dimension of width / 2, a number parameter of 2 * wall. A table is a family of variants — screw sizes, say — of which one row is selected: screw.diameter is that row’s value in the column diameter.

What a parameter is defined as is the program’s own, in a step of it — a number in crate::parameters::steps::DefineParameters, a table in a crate::parameters::steps::LookupTable of its own; what it is built with may be set by a program placing the part, by the same name: the run’s input of that name (see geop_core_program::values::Settings). So a placed screw is made M5 by the program placing it, without touching the screw’s own file.

Structs§

Material
What a part is made of: a name, and its density in kg/m³ — what its mass and inertia are computed with (see geop-ops-inspect). Lengths are millimetres, so a part of V mm³ weighs density · V · 1e-9 kg.
NumberParameter
A number parameter, as its crate::parameters::steps::DefineParameters step holds it: a formula of the parameters defined before it — 12, width / 2. min and max are what a slider offers when the part is placed, not what is valid.
Parameter
A named parameter.
Parameters
A program’s parameters and properties, as an editor lists and edits them together: the part’s colour and material, what it is called and ordered as (crate::parameters::steps::PartProperties), and the values it is designed with (crate::parameters::steps::DefineParameters), in order.
Row
One row of a table (ParameterKind::Table, crate::parameters::steps::LookupTableArgs): a variant, by name, with a value per column.

Enums§

ParameterKind
What a parameter of a program is, as an editor lists them all: a number its crate::parameters::steps::DefineParameters step defines, or a table a crate::parameters::steps::LookupTable step of its own looks up.

Constants§

COLOR
The name the part’s colour is set by.
CONFIGURATION
The parameter a program’s configurations are looked up by: the table of its configurations is the one looked up by it (see crate::parameters::configurations).

Functions§

validate_color
Whether color is a colour, #rrggbb.
validate_name
Whether name can name a parameter: a letter or _, then letters, digits and _ — so that a formula reads it as one, and name.column names a table’s column without ambiguity.