MMpy.SchedulerAttrributeScale.set_unit

Syntax

MMpy.SchedulerAttributeScale.set_unit()

Description

Set a new unit for the attribute scale object.

Parameters

Name Type Description
unit_id Str​ Unit identifier.​

Returns

Type

Description

SchedulerAttributeScale Scale object with the updated label.​

Notes

Please be aware that this method creates a new object that has the label updated.

Examples

schedule = MMpy.SchedulerProject.get_schedule()
with schedule.open_transaction():
    attribute_units = schedule.new_attribute_units()
    attribute_units.set_name("Tonnes")
    attribute_units.set_decimals(3)
    attribute_units.set_base_unit("t")
    attribute_units.set_scales([MMpy.SchedulerAttributeScale(MMpy.SchedulerUnitScaleOperator.greater_than, 1000).set_unit("kt").set_label("KT")])
    schedule.add_attribute_units(attribute_units)

Resource ID

IDPH_SCHEDULER_ATTRIBUTE_SCALE_SET_UNIT