ifcopenshell.api.unit.unassign_unit

Module Contents

ifcopenshell.api.unit.unassign_unit.unassign_unit(file: ifcopenshell.file, units: list[ifcopenshell.entity_instance] | None = None) None

Unassigns units as default units for the project

Parameters:

units (list[ifcopenshell.entity_instance],optional) – A list of units to assign as project defaults.

Returns:

None

Return type:

None

Example:

# You need a project before you can assign units.
ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcProject")

# Millimeters and square meters
length = ifcopenshell.api.run("unit.add_si_unit", model, unit_type="LENGTHUNIT", prefix="MILLI")
area = ifcopenshell.api.run("unit.add_si_unit", model, unit_type="AREAUNIT")

# Make it our default units, if we are doing a metric building
ifcopenshell.api.run("unit.assign_unit", model, units=[length, area])

# Actually, we don't need areas.
ifcopenshell.api.run("unit.unassign_unit", model, units=[area])