ifcopenshell.api.resource.add_resource_quantity#

Module Contents#

class ifcopenshell.api.resource.add_resource_quantity.Usecase(file, resource=None, ifc_class='IfcQuantityCount')#

Adds a quantity to a resource

The quantity of a resource represents the “unit quantity” of that resource. For example, labour might be hired on a daily basis (8 hours). There are different types of quantities (e.g. volume, count, or time). Which quantity is used depends on the type of resource. Material resources may be quantified in terms of length, area, volume, or weight. Equipment and labour resources are quantified in terms of time. Products resources are quantified in terms of counts.

This base quantity is then used in other calculations.

Parameters
  • resource (ifcopenshell.entity_instance.entity_instance) – The IfcConstructionResource to add a quantity to.

  • ifc_class (str,optional) – The type of quantity to add, chosen from IfcQuantityArea (for material), IfcQuantityCount (for products), IfcQuantityLength (for material), IfcQuantityTime (for equipment or labour), IfcQuantityVolume (for material), and IfcQuantityWeight (for material).

Returns

The newly created quantity depending on the IFC class

Return type

ifcopenshell.entity_instance.entity_instance

Example:

# Add our own crew
crew = ifcopenshell.api.run("resource.add_resource", model, ifc_class="IfcCrewResource")

# Add some labour to our crew.
labour = ifcopenshell.api.run("resource.add_resource", model,
    parent_resource=crew, ifc_class="IfcLaborResource")

# Labour resource is quantified in terms of time.
quantity = ifcopenshell.api.run("resource.add_resource_quantity", model,
    resource=labour, ifc_class="IfcQuantityTime")

# Store the time used in hours
ifcopenshell.api.run("resource.edit_resource_quantity", model,
    physical_quantity=quantity, attributes={"TimeValue": 8.0})
execute(self)#