Skip to main content

set_quantity_value

Function set_quantity_value 

Source
pub fn set_quantity_value(
    tx: &mut Transaction,
    model: &Model,
    id: EntityId,
    value: f64,
) -> Result<(), PropertyError>
Expand description

Stage a new value for an existing simple quantity.

The value is written into the slot the model’s declared release gives the quantity’s value attribute (release.rs has the binding), as a bare number: the schema fixes which measure each subtype carries, so no wrapper is written. A value read in the typed form (IFCAREAMEASURE(12.5)) is replaced by the bare one. This also repairs a quantity read as Quantity::Unresolved.

§Errors

Nothing is staged on an error: PropertyError::MissingEntity if id is not in the model, PropertyError::NotAQuantity if it is not a simple quantity, PropertyError::MultipleSchemas or PropertyError::UnsupportedSchema if the model binds no single release, PropertyError::EntityNotInSchema if that release does not declare the quantity’s entity, PropertyError::MalformedEntitySlots if the record does not have the release’s attribute count, and PropertyError::AuthoringInvalid for a value its measure cannot hold.