Skip to main content

define_constraints

Function define_constraints 

Source
pub fn define_constraints<Args: PartialEq + Clone + Debug + 'static>(
    ctx: &mut StepContext<'_>,
    args: &Args,
    generator: ConstraintGenerator<Args>,
) -> GeopResult<()>
Expand description

Defines the constraints generator makes of args in the step being run, one of the part’s Constraints. Each is checked: its derivatives are by states its generator read, a row per residual, as many numbers as a step of the state takes. A plain function, like a make (Make).

A constraint whose residual reads a target that itself read the state — geometry the state drives, a sketch following a placed part — is refused, naming the constraint, the target and the state: a solve differentiates a constraint by the states it reads, and could not see how such a target moves with them.

A step that fails here leaves a failed target, which fails Constraints::of: a solve must not go on without a constraint it could not make.