diff --git a/src/ifcopenshell-python/ifcopenshell/api/project/append_asset.py b/src/ifcopenshell-python/ifcopenshell/api/project/append_asset.py
index fc101347ee..60e0a134f9 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/project/append_asset.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/project/append_asset.py
@@ -19,9 +19,15 @@
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.api.owner.settings
+from typing import Optional
-def append_asset(file, library=None, element=None, reuse_identities=None) -> None:
+def append_asset(
+ file: ifcopenshell.file,
+ library: ifcopenshell.file,
+ element: ifcopenshell.entity_instance,
+ reuse_identities: Optional[dict[int, ifcopenshell.entity_instance]] = None,
+) -> ifcopenshell.entity_instance:
"""Appends an asset from a library into the active project
A BIM library asset may be a type product (e.g. wall type), product
diff --git a/src/ifcopenshell-python/ifcopenshell/api/pset/add_pset.py b/src/ifcopenshell-python/ifcopenshell/api/pset/add_pset.py
index edc1bf5ac6..835bd83d75 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/pset/add_pset.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/pset/add_pset.py
@@ -17,10 +17,11 @@
# along with IfcOpenShell. If not, see .
import ifcopenshell
+import ifcopenshell.api
import ifcopenshell.guid
-def add_pset(file, product=None, name=None) -> None:
+def add_pset(file: ifcopenshell.file, product: ifcopenshell.entity_instance, name: str) -> ifcopenshell.entity_instance:
"""Adds a new property set to a product
Products, such as physical objects or types in IFC may have properties
diff --git a/src/ifcopenshell-python/ifcopenshell/api/pset/add_qto.py b/src/ifcopenshell-python/ifcopenshell/api/pset/add_qto.py
index b105179385..f7bcd66d2f 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/pset/add_qto.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/pset/add_qto.py
@@ -21,7 +21,7 @@ import ifcopenshell.api
import ifcopenshell.guid
-def add_qto(file, product=None, name=None) -> None:
+def add_qto(file: ifcopenshell.file, product: ifcopenshell.entity_instance, name: str) -> ifcopenshell.entity_instance:
"""Adds a new quantity set to a product
Products, such as physical objects or types in IFC may have quantities
diff --git a/src/ifcopenshell-python/ifcopenshell/api/pset/edit_qto.py b/src/ifcopenshell-python/ifcopenshell/api/pset/edit_qto.py
index ba5b7c93e0..e1bd928101 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/pset/edit_qto.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/pset/edit_qto.py
@@ -18,9 +18,16 @@
import ifcopenshell
import ifcopenshell.util.pset
+from typing import Optional, Any
-def edit_qto(file, qto=None, name=None, properties=None, pset_template=None) -> None:
+def edit_qto(
+ file: ifcopenshell.file,
+ qto: ifcopenshell.entity_instance,
+ name: Optional[str] = None,
+ properties: Optional[dict[str, Any]] = None,
+ pset_template: Optional[ifcopenshell.entity_instance] = None,
+) -> None:
"""Edits a quantity set and its quantities
At its simplest usage, this may be used to edit the name of a quantity
@@ -50,7 +57,7 @@ def edit_qto(file, qto=None, name=None, properties=None, pset_template=None) ->
:param pset_template: If a quantity set template is provided, this will
be used to determine data types. If no user-defined template is
provided, the built-in buildingSMART templates will be loaded.
- :type pset_template: ifcopenshell.entity_instance
+ :type pset_template: ifcopenshell.entity_instance, optional
:return: None
:rtype: None
diff --git a/src/ifcopenshell-python/ifcopenshell/api/pset/remove_pset.py b/src/ifcopenshell-python/ifcopenshell/api/pset/remove_pset.py
index 50ef427bb4..b6302bb4b1 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/pset/remove_pset.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/pset/remove_pset.py
@@ -20,7 +20,9 @@ import ifcopenshell
import ifcopenshell.util.element
-def remove_pset(file, product=None, pset=None) -> None:
+def remove_pset(
+ file: ifcopenshell.file, product: ifcopenshell.entity_instance, pset: ifcopenshell.entity_instance
+) -> None:
"""Removes a property set from a product
All properties that are part of this property set are also removed.
diff --git a/src/ifcopenshell-python/ifcopenshell/api/pset_template/add_prop_template.py b/src/ifcopenshell-python/ifcopenshell/api/pset_template/add_prop_template.py
index 2fbfb4a5c6..360b086cab 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/pset_template/add_prop_template.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/pset_template/add_prop_template.py
@@ -18,16 +18,17 @@
import ifcopenshell
import ifcopenshell.guid
+from typing import Optional
def add_prop_template(
- file,
- pset_template=None,
- name="NewProperty",
- description=None,
- template_type="P_SINGLEVALUE",
- primary_measure_type="IfcLabel",
-) -> None:
+ file: ifcopenshell.file,
+ pset_template: ifcopenshell.entity_instance,
+ name: str = "NewProperty",
+ description: Optional[str] = None,
+ template_type: str = "P_SINGLEVALUE",
+ primary_measure_type: str = "IfcLabel",
+) -> ifcopenshell.entity_instance:
"""Adds new property templates to a property set template
Assuming you first have a property set template, this allows you to add
diff --git a/src/ifcopenshell-python/ifcopenshell/api/pset_template/add_pset_template.py b/src/ifcopenshell-python/ifcopenshell/api/pset_template/add_pset_template.py
index 05dee01a45..e382a3a34d 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/pset_template/add_pset_template.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/pset_template/add_pset_template.py
@@ -21,11 +21,11 @@ import ifcopenshell.guid
def add_pset_template(
- file,
- name="New_Pset",
- template_type="PSET_TYPEDRIVENOVERRIDE",
- applicable_entity="IfcObject,IfcTypeObject",
-) -> None:
+ file: ifcopenshell.file,
+ name: str = "New_Pset",
+ template_type: str = "PSET_TYPEDRIVENOVERRIDE",
+ applicable_entity: str = "IfcObject,IfcTypeObject",
+) -> ifcopenshell.entity_instance:
"""Adds a new property set template
This creates a new template for property sets. A template defines what
diff --git a/src/ifcopenshell-python/ifcopenshell/api/pset_template/edit_prop_template.py b/src/ifcopenshell-python/ifcopenshell/api/pset_template/edit_prop_template.py
index dcc6c9b3ae..7a6d33990b 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/pset_template/edit_prop_template.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/pset_template/edit_prop_template.py
@@ -15,9 +15,13 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
+from typing import Any
-def edit_prop_template(file, prop_template=None, attributes=None) -> None:
+def edit_prop_template(
+ file: ifcopenshell.file, prop_template: ifcopenshell.entity_instance, attributes: dict[str, Any]
+) -> None:
"""Edits the attributes of an IfcSimplePropertyTemplate
For more information about the attributes and data types of an
@@ -26,7 +30,7 @@ def edit_prop_template(file, prop_template=None, attributes=None) -> None:
:param prop_template: The IfcSimplePropertyTemplate entity you want to edit
:type prop_template: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
- :type attributes: dict, optional
+ :type attributes: dict
:return: None
:rtype: None
@@ -43,7 +47,7 @@ def edit_prop_template(file, prop_template=None, attributes=None) -> None:
ifcopenshell.api.run("pset_template.edit_prop_template", model,
prop_template=prop, attributes={"Name": "DemoA", "PrimaryMeasureType": "IfcLengthMeasure"})
"""
- settings = {"prop_template": prop_template, "attributes": attributes or {}}
+ settings = {"prop_template": prop_template, "attributes": attributes}
for name, value in settings["attributes"].items():
setattr(settings["prop_template"], name, value)
diff --git a/src/ifcopenshell-python/ifcopenshell/api/pset_template/edit_pset_template.py b/src/ifcopenshell-python/ifcopenshell/api/pset_template/edit_pset_template.py
index 8a0581efdc..6e71d182a5 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/pset_template/edit_pset_template.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/pset_template/edit_pset_template.py
@@ -15,9 +15,13 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
+from typing import Any
-def edit_pset_template(file, pset_template=None, attributes=None) -> None:
+def edit_pset_template(
+ file: ifcopenshell.file, pset_template: ifcopenshell.entity_instance, attributes: dict[str, Any]
+) -> None:
"""Edits the attributes of an IfcPropertySetTemplate
For more information about the attributes and data types of an
@@ -26,7 +30,7 @@ def edit_pset_template(file, pset_template=None, attributes=None) -> None:
:param pset_template: The IfcPropertySetTemplate entity you want to edit
:type pset_template: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
- :type attributes: dict, optional
+ :type attributes: dict
:return: None
:rtype: None
@@ -41,7 +45,7 @@ def edit_pset_template(file, pset_template=None, attributes=None) -> None:
ifcopenshell.api.run("pset_template.edit_pset_template", model,
pset_template=template, attributes={"Name": "ABC_RiskFactors"})
"""
- settings = {"pset_template": pset_template, "attributes": attributes or {}}
+ settings = {"pset_template": pset_template, "attributes": attributes}
for name, value in settings["attributes"].items():
setattr(settings["pset_template"], name, value)
diff --git a/src/ifcopenshell-python/ifcopenshell/api/pset_template/remove_prop_template.py b/src/ifcopenshell-python/ifcopenshell/api/pset_template/remove_prop_template.py
index 7a247ac383..d5986af02c 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/pset_template/remove_prop_template.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/pset_template/remove_prop_template.py
@@ -19,7 +19,7 @@
import ifcopenshell.util.element
-def remove_prop_template(file, prop_template=None) -> None:
+def remove_prop_template(file: ifcopenshell.file, prop_template: ifcopenshell.entity_instance) -> None:
"""Removes a property template
Note that a property set template should always have at least one
diff --git a/src/ifcopenshell-python/ifcopenshell/api/pset_template/remove_pset_template.py b/src/ifcopenshell-python/ifcopenshell/api/pset_template/remove_pset_template.py
index c567a55033..a1731ac5e1 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/pset_template/remove_pset_template.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/pset_template/remove_pset_template.py
@@ -19,7 +19,7 @@
import ifcopenshell.util.element
-def remove_pset_template(file, pset_template=None) -> None:
+def remove_pset_template(file: ifcopenshell.file, pset_template: ifcopenshell.entity_instance) -> None:
"""Removes a property set template
All property templates within the property set template are also removed
diff --git a/src/ifcopenshell-python/ifcopenshell/api/resource/add_resource.py b/src/ifcopenshell-python/ifcopenshell/api/resource/add_resource.py
index e2a1dab308..8131bed326 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/resource/add_resource.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/resource/add_resource.py
@@ -17,15 +17,16 @@
# along with IfcOpenShell. If not, see .
import ifcopenshell.api
+from typing import Optional
def add_resource(
- file,
- parent_resource=None,
- ifc_class="IfcCrewResource",
- name=None,
- predefined_type="NOTDEFINED",
-) -> None:
+ file: ifcopenshell.file,
+ parent_resource: Optional[ifcopenshell.entity_instance] = None,
+ ifc_class: str = "IfcCrewResource",
+ name: Optional[str] = None,
+ predefined_type: str = "NOTDEFINED",
+) -> ifcopenshell.entity_instance:
"""Add a new construction resource
Construction resources may be managed and connected to cost schedules
@@ -48,7 +49,7 @@ def add_resource(
:param parent_resource: If this is a child resource (typically to a crew
resource), then nominate the parent IfcConstructionResource here.
- :type parent_resource: ifcopenshell.entity_instance
+ :type parent_resource: ifcopenshell.entity_instance, optional
:param ifc_class: The class of resource chosen from
IfcConstructionEquipmentResource, IfcConstructionMaterialResource,
IfcConstructionProductResource, IfcCrewResource, IfcLaborResource,
diff --git a/src/ifcopenshell-python/ifcopenshell/api/resource/add_resource_quantity.py b/src/ifcopenshell-python/ifcopenshell/api/resource/add_resource_quantity.py
index 6600a06ae2..5bba6b3ae1 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/resource/add_resource_quantity.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/resource/add_resource_quantity.py
@@ -19,7 +19,9 @@
import ifcopenshell.util.element
-def add_resource_quantity(file, resource=None, ifc_class="IfcQuantityCount") -> None:
+def add_resource_quantity(
+ file: ifcopenshell.file, resource: ifcopenshell.entity_instance, ifc_class: str = "IfcQuantityCount"
+) -> ifcopenshell.entity_instance:
"""Adds a quantity to a resource
The quantity of a resource represents the "unit quantity" of that
@@ -65,6 +67,7 @@ def add_resource_quantity(file, resource=None, ifc_class="IfcQuantityCount") ->
settings = {"resource": resource, "ifc_class": ifc_class}
quantity = file.create_entity(settings["ifc_class"], Name="Unnamed")
+ # 3 IfcPhysicalSimpleQuantity Value
quantity[3] = 0.0
old_quantity = settings["resource"].BaseQuantity
settings["resource"].BaseQuantity = quantity
diff --git a/src/ifcopenshell-python/ifcopenshell/api/resource/add_resource_time.py b/src/ifcopenshell-python/ifcopenshell/api/resource/add_resource_time.py
index 3066441330..10c9ad27fa 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/resource/add_resource_time.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/resource/add_resource_time.py
@@ -19,7 +19,7 @@
import ifcopenshell.util.date
-def add_resource_time(file, resource=None) -> None:
+def add_resource_time(file: ifcopenshell.file, resource: ifcopenshell.entity_instance) -> ifcopenshell.entity_instance:
"""Adds the time that a resource is used for
For labour and equipment resources, the total duration that the resource
diff --git a/src/ifcopenshell-python/ifcopenshell/api/resource/assign_resource.py b/src/ifcopenshell-python/ifcopenshell/api/resource/assign_resource.py
index eaf49505c0..e86d02cc4f 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/resource/assign_resource.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/resource/assign_resource.py
@@ -21,7 +21,11 @@ import ifcopenshell.api
import ifcopenshell.guid
-def assign_resource(file, relating_resource=None, related_object=None) -> None:
+def assign_resource(
+ file: ifcopenshell.file,
+ relating_resource: ifcopenshell.entity_instance,
+ related_object: ifcopenshell.entity_instance,
+) -> ifcopenshell.entity_instance:
"""Assigns a resource to an object
Two types of objects are typically assigned to resources: products and
@@ -89,7 +93,7 @@ def assign_resource(file, relating_resource=None, related_object=None) -> None:
assignment.is_a("IfclRelAssignsToResource")
and assignment.RelatingResource == settings["relating_resource"]
):
- return
+ return assignment
resource_of = None
if settings["relating_resource"].ResourceOf:
diff --git a/src/ifcopenshell-python/ifcopenshell/api/resource/calculate_resource_usage.py b/src/ifcopenshell-python/ifcopenshell/api/resource/calculate_resource_usage.py
index fc63b2d9d4..0a68a83df4 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/resource/calculate_resource_usage.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/resource/calculate_resource_usage.py
@@ -18,12 +18,13 @@
import math
import ifcopenshell.api
+import ifcopenshell.util.constraint
import ifcopenshell.util.date
import ifcopenshell.util.element
import ifcopenshell.util.resource
-def calculate_resource_usage(file, resource=None) -> None:
+def calculate_resource_usage(file: ifcopenshell.file, resource: ifcopenshell.entity_instance) -> None:
"""Calculates the number of resources required to perform scheduled work on a task."""
settings = {"resource": resource}
diff --git a/src/ifcopenshell-python/ifcopenshell/api/resource/calculate_resource_work.py b/src/ifcopenshell-python/ifcopenshell/api/resource/calculate_resource_work.py
index dd5621d386..3bb6fe4cd4 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/resource/calculate_resource_work.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/resource/calculate_resource_work.py
@@ -18,12 +18,13 @@
import math
import ifcopenshell.api
+import ifcopenshell.util.constraint
import ifcopenshell.util.date
import ifcopenshell.util.element
import ifcopenshell.util.resource
-def calculate_resource_work(file, resource=None) -> None:
+def calculate_resource_work(file: ifcopenshell.file, resource: ifcopenshell.entity_instance) -> None:
"""Calculates the work that a resource is used for
This is an unofficial parametric calculation that may be done on a
diff --git a/src/ifcopenshell-python/ifcopenshell/api/resource/edit_resource.py b/src/ifcopenshell-python/ifcopenshell/api/resource/edit_resource.py
index 2ab8ac669a..6ec4ed0b1a 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/resource/edit_resource.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/resource/edit_resource.py
@@ -15,9 +15,11 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
+from typing import Any
-def edit_resource(file, resource=None, attributes=None) -> None:
+def edit_resource(file: ifcopenshell.file, resource: ifcopenshell.entity_instance, attributes: dict[str, Any]) -> None:
"""Edits the attributes of an IfcResource
For more information about the attributes and data types of an
@@ -26,7 +28,7 @@ def edit_resource(file, resource=None, attributes=None) -> None:
:param resource: The IfcResource entity you want to edit
:type resource: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
- :type attributes: dict, optional
+ :type attributes: dict
:return: None
:rtype: None
@@ -40,7 +42,7 @@ def edit_resource(file, resource=None, attributes=None) -> None:
# Change the name of the resource to "Zone A Crew"
ifcopenshell.api.run("resource.edit_resource", model, resource=resource, attributes={"Name": "Foo"})
"""
- settings = {"resource": resource, "attributes": attributes or {}}
+ settings = {"resource": resource, "attributes": attributes}
for name, value in settings["attributes"].items():
setattr(settings["resource"], name, value)
diff --git a/src/ifcopenshell-python/ifcopenshell/api/resource/edit_resource_quantity.py b/src/ifcopenshell-python/ifcopenshell/api/resource/edit_resource_quantity.py
index b4d016c7ad..3a4e754c6b 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/resource/edit_resource_quantity.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/resource/edit_resource_quantity.py
@@ -15,9 +15,13 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
+from typing import Any
-def edit_resource_quantity(file, physical_quantity=None, attributes=None) -> None:
+def edit_resource_quantity(
+ file: ifcopenshell.file, physical_quantity: ifcopenshell.entity_instance, attributes: dict[str, Any]
+) -> None:
"""Edits the attributes of an IFC quantity
For more information about the attributes and data types of an
@@ -26,7 +30,7 @@ def edit_resource_quantity(file, physical_quantity=None, attributes=None) -> Non
:param physical_quantity: The IfC quantity entity you want to edit
:type physical_quantity: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
- :type attributes: dict, optional
+ :type attributes: dict
:return: None
:rtype: None
@@ -51,7 +55,7 @@ def edit_resource_quantity(file, physical_quantity=None, attributes=None) -> Non
"""
settings = {
"physical_quantity": physical_quantity,
- "attributes": attributes or {},
+ "attributes": attributes,
}
for name, value in settings["attributes"].items():
diff --git a/src/ifcopenshell-python/ifcopenshell/api/resource/edit_resource_time.py b/src/ifcopenshell-python/ifcopenshell/api/resource/edit_resource_time.py
index 9ec41a60c5..ad03df0908 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/resource/edit_resource_time.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/resource/edit_resource_time.py
@@ -18,9 +18,12 @@
import datetime
import ifcopenshell
+from typing import Any
-def edit_resource_time(file, resource_time=None, attributes=None) -> None:
+def edit_resource_time(
+ file: ifcopenshell.file, resource_time: ifcopenshell.entity_instance, attributes: dict[str, Any]
+) -> None:
"""Edits the attributes of an IfcResourceTime
For more information about the attributes and data types of an
@@ -29,7 +32,7 @@ def edit_resource_time(file, resource_time=None, attributes=None) -> None:
:param resource_time: The IfcResourceTime entity you want to edit
:type resource_time: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
- :type attributes: dict, optional
+ :type attributes: dict
:return: None
:rtype: None
@@ -59,7 +62,7 @@ def edit_resource_time(file, resource_time=None, attributes=None) -> None:
"""
usecase = Usecase()
usecase.file = file
- usecase.settings = {"resource_time": resource_time, "attributes": attributes or {}}
+ usecase.settings = {"resource_time": resource_time, "attributes": attributes}
return usecase.execute()
diff --git a/src/ifcopenshell-python/ifcopenshell/api/resource/remove_resource.py b/src/ifcopenshell-python/ifcopenshell/api/resource/remove_resource.py
index cfbdd25fd9..e5356a9dd9 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/resource/remove_resource.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/resource/remove_resource.py
@@ -21,7 +21,7 @@ import ifcopenshell.api
import ifcopenshell.util.element
-def remove_resource(file, resource=None) -> None:
+def remove_resource(file: ifcopenshell.file, resource: ifcopenshell.entity_instance) -> None:
"""Removes a resource and all relationships
Example:
diff --git a/src/ifcopenshell-python/ifcopenshell/api/resource/remove_resource_quantity.py b/src/ifcopenshell-python/ifcopenshell/api/resource/remove_resource_quantity.py
index 221d94c5a6..9b173f689f 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/resource/remove_resource_quantity.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/resource/remove_resource_quantity.py
@@ -19,7 +19,7 @@
import ifcopenshell.util.element
-def remove_resource_quantity(file, resource=None) -> None:
+def remove_resource_quantity(file: ifcopenshell.file, resource: ifcopenshell.entity_instance) -> None:
"""Removes the base quantity of a resource
Example:
diff --git a/src/ifcopenshell-python/ifcopenshell/api/resource/unassign_resource.py b/src/ifcopenshell-python/ifcopenshell/api/resource/unassign_resource.py
index 7b1a59f519..93a8caff93 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/resource/unassign_resource.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/resource/unassign_resource.py
@@ -21,7 +21,11 @@ import ifcopenshell.api
import ifcopenshell.util.element
-def unassign_resource(file, relating_resource=None, related_object=None) -> None:
+def unassign_resource(
+ file: ifcopenshell.file,
+ relating_resource: ifcopenshell.entity_instance,
+ related_object: ifcopenshell.entity_instance,
+) -> None:
"""Removes the relationship between a resource and object
:param relating_resource: The IfcResource to assign the object to.
@@ -29,8 +33,8 @@ def unassign_resource(file, relating_resource=None, related_object=None) -> None
:param related_object: The IfcProduct or IfcActor to assign to the
object.
:type related_object: ifcopenshell.entity_instance
- :return: The newly created IfcRelAssignsToResource
- :rtype: ifcopenshell.entity_instance
+ :return: None
+ :rtype: None
Example:
@@ -74,4 +78,3 @@ def unassign_resource(file, relating_resource=None, related_object=None) -> None
related_objects.remove(settings["related_object"])
rel.RelatedObjects = related_objects
ifcopenshell.api.run("owner.update_owner_history", file, **{"element": rel})
- return rel
diff --git a/src/ifcopenshell-python/ifcopenshell/api/root/copy_class.py b/src/ifcopenshell-python/ifcopenshell/api/root/copy_class.py
index 976010c3c3..1c49f178fd 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/root/copy_class.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/root/copy_class.py
@@ -17,11 +17,13 @@
# along with IfcOpenShell. If not, see .
import ifcopenshell
+import ifcopenshell.api
import ifcopenshell.util.system
import ifcopenshell.util.element
+import ifcopenshell.util.placement
-def copy_class(file, product=None) -> None:
+def copy_class(file: ifcopenshell.file, product: ifcopenshell.entity_instance) -> ifcopenshell.entity_instance:
"""Copies a product
The following relationships are also duplicated:
diff --git a/src/ifcopenshell-python/ifcopenshell/api/root/reassign_class.py b/src/ifcopenshell-python/ifcopenshell/api/root/reassign_class.py
index c124786a83..9bf29a0306 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/root/reassign_class.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/root/reassign_class.py
@@ -20,14 +20,15 @@ import ifcopenshell
import ifcopenshell.util.type
import ifcopenshell.util.schema
import ifcopenshell.util.element
+from typing import Optional
def reassign_class(
- file,
- product=None,
- ifc_class="IfcBuildingElementProxy",
- predefined_type=None,
-) -> None:
+ file: ifcopenshell.file,
+ product: ifcopenshell.entity_instance,
+ ifc_class: str = "IfcBuildingElementProxy",
+ predefined_type: Optional[str] = None,
+) -> ifcopenshell.entity_instance:
"""Changes the class of a product
If you ever created a wall then realised it's meant to be something
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/add_task.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/add_task.py
index 50ab4f58dc..6fd08d4b1d 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/add_task.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/add_task.py
@@ -19,17 +19,18 @@
import ifcopenshell.api
import ifcopenshell
import ifcopenshell.guid
+from typing import Optional
def add_task(
- file,
- work_schedule=None,
- parent_task=None,
- name=None,
- description=None,
- identification=None,
- predefined_type="NOTDEFINED",
-) -> None:
+ file: ifcopenshell.file,
+ work_schedule: Optional[ifcopenshell.entity_instance] = None,
+ parent_task: Optional[ifcopenshell.entity_instance] = None,
+ name: Optional[str] = None,
+ description: Optional[str] = None,
+ identification: Optional[str] = None,
+ predefined_type: str = "NOTDEFINED",
+) -> ifcopenshell.entity_instance:
"""Adds a new task
Tasks are typically used for two purposes: construction scheduling and
@@ -66,11 +67,11 @@ def add_task(
:param work_schedule: The work schedule to group the task in, if the
task is to be a top-level or root task. This is mutually exclusive
with the parent_task parameter.
- :type work_schedule: ifcopenshell.entity_instance
+ :type work_schedule: ifcopenshell.entity_instance, optional
:param parent_task: The parent task, if the task is to be a subtask or
child task. This is mutually exclusive with the work_schedule
parameter.
- :type parent_task: ifcopenshell.entity_instance
+ :type parent_task: ifcopenshell.entity_instance, optioanl
:param name: The name of the task.
:type name: str,optional
:param description: The description of the task.
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/add_task_time.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/add_task_time.py
index bbd51c2e68..1e755ed6cf 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/add_task_time.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/add_task_time.py
@@ -15,9 +15,12 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
-def add_task_time(file, task=None, is_recurring=False) -> None:
+def add_task_time(
+ file: ifcopenshell.file, task: ifcopenshell.entity_instance, is_recurring: bool = False
+) -> ifcopenshell.entity_instance:
"""Adds a task time to a task
Some tasks, such as activities within a work breakdown structure or
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/add_time_period.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/add_time_period.py
index 479524a4b1..26db76c70c 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/add_time_period.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/add_time_period.py
@@ -19,11 +19,17 @@
import ifcopenshell.api
import ifcopenshell.util.date
import ifcopenshell.util.sequence
-from datetime import datetime
+from datetime import datetime, time
from datetime import timedelta
+from typing import Optional, Union
-def add_time_period(file, recurrence_pattern=None, start_time=None, end_time=None) -> None:
+def add_time_period(
+ file: ifcopenshell.file,
+ recurrence_pattern: ifcopenshell.entity_instance,
+ start_time: Optional[Union[str, time]] = None,
+ end_time: Optional[Union[str, time]] = None,
+) -> ifcopenshell.entity_instance:
"""Adds a time period to a recurrence pattern
A recurring time may be an all-day event, or only during certain time
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/add_work_calendar.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/add_work_calendar.py
index 250a1b2fe0..97d06983eb 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/add_work_calendar.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/add_work_calendar.py
@@ -19,7 +19,9 @@
import ifcopenshell.api
-def add_work_calendar(file, name="Unnamed", predefined_type="NOTDEFINED") -> None:
+def add_work_calendar(
+ file: ifcopenshell.file, name: str = "Unnamed", predefined_type: str = "NOTDEFINED"
+) -> ifcopenshell.entity_instance:
"""Add a work calendar
A work calendar defines when work is allowed to occur and when the
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/add_work_plan.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/add_work_plan.py
index 858d944d66..87d01a7dfb 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/add_work_plan.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/add_work_plan.py
@@ -17,11 +17,18 @@
# along with IfcOpenShell. If not, see .
import ifcopenshell.api
+import ifcopenshell.api.owner.settings
import ifcopenshell.util.date
-from datetime import datetime
+from datetime import datetime, time
+from typing import Optional, Union
-def add_work_plan(file, name=None, predefined_type="NOTDEFINED", start_time=None) -> None:
+def add_work_plan(
+ file: ifcopenshell.file,
+ name: Optional[str] = None,
+ predefined_type: str = "NOTDEFINED",
+ start_time: Optional[Union[str, time]] = None,
+) -> ifcopenshell.entity_instance:
"""Add a new work plan
A work plan is a group of work schedules. Since work schedules may have
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/add_work_schedule.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/add_work_schedule.py
index 21f508999c..3fe8e1a003 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/add_work_schedule.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/add_work_schedule.py
@@ -17,18 +17,21 @@
# along with IfcOpenShell. If not, see .
import ifcopenshell.api
+import ifcopenshell.api.owner.settings
import ifcopenshell.util.date
+from datetime import time
from datetime import datetime
+from typing import Union, Optional
def add_work_schedule(
- file,
- name="Unnamed",
- predefined_type="NOTDEFINED",
+ file: ifcopenshell.file,
+ name: str = "Unnamed",
+ predefined_type: str = "NOTDEFINED",
object_type=None,
- start_time=None,
- work_plan=None,
-) -> None:
+ start_time: Optional[Union[str, time]] = None,
+ work_plan: Optional[ifcopenshell.entity_instance] = None,
+) -> ifcopenshell.entity_instance:
"""Add a new work schedule
A work schedule is a group of tasks, where the tasks are typically
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/add_work_time.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/add_work_time.py
index 86d4666ad9..282f402e0c 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/add_work_time.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/add_work_time.py
@@ -15,9 +15,12 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
-def add_work_time(file, work_calendar=None, time_type="WorkingTimes") -> None:
+def add_work_time(
+ file: ifcopenshell.file, work_calendar: ifcopenshell.entity_instance, time_type: str = "WorkingTimes"
+) -> ifcopenshell.entity_instance:
"""Add either working times or holiday times to a calendar
A calendar defines when work occurs by defining working times and
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_lag_time.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_lag_time.py
index 0ba89d0346..c3986834d6 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_lag_time.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_lag_time.py
@@ -19,7 +19,9 @@
import ifcopenshell.util.date
-def assign_lag_time(file, rel_sequence=None, lag_value=None, duration_type="WORKTIME") -> None:
+def assign_lag_time(
+ file: ifcopenshell.file, rel_sequence: ifcopenshell.entity_instance, lag_value: str, duration_type: str = "WORKTIME"
+) -> ifcopenshell.entity_instance:
"""Assign a lag time to a sequence relationship between tasks
A task sequence (e.g. finish to start) may optionally have a lag time
@@ -94,3 +96,4 @@ def assign_lag_time(file, rel_sequence=None, lag_value=None, duration_type="WORK
if settings["rel_sequence"].TimeLag and len(file.get_inverse(settings["rel_sequence"].TimeLag)) == 1:
file.remove(settings["rel_sequence"].TimeLag)
settings["rel_sequence"].TimeLag = lag_time
+ return lag_time
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_process.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_process.py
index a5241b530a..9203d4b4fa 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_process.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_process.py
@@ -21,7 +21,11 @@ import ifcopenshell.api
import ifcopenshell.guid
-def assign_process(file, relating_process=None, related_object=None) -> None:
+def assign_process(
+ file: ifcopenshell.file,
+ relating_process: ifcopenshell.entity_instance,
+ related_object: ifcopenshell.entity_instance,
+) -> ifcopenshell.entity_instance:
"""Assigns an object to be related to a process, typically a construction task
Processes work using the ICOM (Input, Controls, Outputs, Mechanisms)
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_product.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_product.py
index f20c5d5e32..e492707c44 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_product.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_product.py
@@ -21,7 +21,11 @@ import ifcopenshell.api
import ifcopenshell.guid
-def assign_product(file, relating_product=None, related_object=None) -> None:
+def assign_product(
+ file: ifcopenshell.entity_instance,
+ relating_product: ifcopenshell.entity_instance,
+ related_object: ifcopenshell.entity_instance,
+) -> ifcopenshell.entity_instance:
"""Assigns a product to be produced as a result of a process
A construction task may result in products (e.g. a wall) being
@@ -71,7 +75,7 @@ def assign_product(file, relating_product=None, related_object=None) -> None:
if settings["related_object"].HasAssignments:
for assignment in settings["related_object"].HasAssignments:
if assignment.is_a("IfcRelAssignsToProduct") and assignment.RelatingProduct == settings["relating_product"]:
- return
+ return assignment
referenced_by = None
if settings["relating_product"].ReferencedBy:
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_recurrence_pattern.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_recurrence_pattern.py
index 177d90fb8d..0ae92e66aa 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_recurrence_pattern.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_recurrence_pattern.py
@@ -15,9 +15,12 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
-def assign_recurrence_pattern(file, parent=None, recurrence_type="WEEKLY") -> None:
+def assign_recurrence_pattern(
+ file: ifcopenshell.file, parent: ifcopenshell.entity_instance, recurrence_type: str = "WEEKLY"
+) -> ifcopenshell.entity_instance:
"""Define a time to recur at a particular interval
There are two scenarios where you might want to define a recurring time
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_sequence.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_sequence.py
index 257a1e16d8..338a03ceed 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_sequence.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_sequence.py
@@ -22,11 +22,11 @@ import ifcopenshell.guid
def assign_sequence(
- file,
- relating_process=None,
- related_process=None,
- sequence_type="FINISH_START",
-) -> None:
+ file: ifcopenshell.file,
+ relating_process: ifcopenshell.entity_instance,
+ related_process: ifcopenshell.entity_instance,
+ sequence_type: str = "FINISH_START",
+) -> ifcopenshell.entity_instance:
"""Assign a sequential relationship between tasks
Tasks in construction sequencing typically have sequence relationships
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_workplan.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_workplan.py
index 634f2af494..e2ed6b7c00 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_workplan.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/assign_workplan.py
@@ -20,7 +20,9 @@ import ifcopenshell
import ifcopenshell.api
-def assign_workplan(file, work_schedule=None, work_plan=None) -> None:
+def assign_workplan(
+ file: ifcopenshell.file, work_schedule: ifcopenshell.entity_instance, work_plan: ifcopenshell.entity_instance
+) -> ifcopenshell.entity_instance:
"""Assigns a work schedule to a work plan
Typically, work schedules would be assigned to a work plan at creation.
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/calculate_task_duration.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/calculate_task_duration.py
index 22c9ec7dda..95dd1a652b 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/calculate_task_duration.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/calculate_task_duration.py
@@ -22,7 +22,7 @@ import ifcopenshell.util.date
import ifcopenshell.util.element
-def calculate_task_duration(file, task=None) -> None:
+def calculate_task_duration(file: ifcopenshell.file, task: ifcopenshell.entity_instance) -> None:
"""Calculates the task duration based on resource usage
If a task has labour or equipment resources assigned to it, its duration
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/cascade_schedule.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/cascade_schedule.py
index 0a2aea7190..22207d4622 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/cascade_schedule.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/cascade_schedule.py
@@ -21,7 +21,7 @@ import ifcopenshell.util.date
import ifcopenshell.util.sequence
-def cascade_schedule(file, task=None) -> None:
+def cascade_schedule(file: ifcopenshell.file, task: ifcopenshell.entity_instance) -> None:
"""Cascades start and end dates of tasks based on durations
Given a start task with a start date and duration, the end date, and the
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/create_baseline.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/create_baseline.py
index f45d303500..8a7439de89 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/create_baseline.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/create_baseline.py
@@ -17,12 +17,17 @@
# along with IfcOpenShell. If not, see .
import ifcopenshell
+import ifcopenshell.api
import ifcopenshell.guid
-import ifcopenshell.util.system
import ifcopenshell.util.element
+import ifcopenshell.util.sequence
+import ifcopenshell.util.system
+from typing import Optional
-def create_baseline(file, work_schedule=None, name=None) -> None:
+def create_baseline(
+ file: ifcopenshell.file, work_schedule: ifcopenshell.entity_instance, name: Optional[str] = None
+) -> None:
"""Creates a baseline for your Work Schedule
Using a IfcWorkSchdule having PredefinedType=PLANNED,
@@ -38,6 +43,8 @@ def create_baseline(file, work_schedule=None, name=None) -> None:
:param work_schedule: The planned work_schedule to baseline
:type work_schedule: ifcopenshell.entity_instance
+ :param name: baseline work schedule name
+ :type name: str, optional
:return: The baseline work_schedule
:rtype: ifcopenshell.entity_instance
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/duplicate_task.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/duplicate_task.py
index 5578cf57f7..0861c1bd19 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/duplicate_task.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/duplicate_task.py
@@ -23,7 +23,7 @@ import ifcopenshell.util.element
import ifcopenshell.util.sequence
-def duplicate_task(file, task=None) -> None:
+def duplicate_task(file: ifcopenshell.file, task: ifcopenshell.entity_instance) -> ifcopenshell.entity_instance:
"""Duplicates a task in the project
The following relationships are also duplicated:
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_lag_time.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_lag_time.py
index 4b77daf9e8..89d042ed40 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_lag_time.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_lag_time.py
@@ -18,9 +18,10 @@
import ifcopenshell.api
import ifcopenshell.util.date
+from typing import Any
-def edit_lag_time(file, lag_time=None, attributes=None) -> None:
+def edit_lag_time(file: ifcopenshell.file, lag_time: ifcopenshell.entity_instance, attributes: dict[str, Any]) -> None:
"""Edits the attributes of an IfcLagTime
For more information about the attributes and data types of an
@@ -29,7 +30,7 @@ def edit_lag_time(file, lag_time=None, attributes=None) -> None:
:param lag_time: The IfcLagTime entity you want to edit
:type lag_time: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
- :type attributes: dict, optional
+ :type attributes: dict
:return: None
:rtype: None
@@ -74,7 +75,7 @@ def edit_lag_time(file, lag_time=None, attributes=None) -> None:
# Or, let's make it 2 days instead.
ifcopenshell.api.run("sequence.edit_lag_time", model, lag_time=lag, attributes={"LagValue": "P2D"})
"""
- settings = {"lag_time": lag_time, "attributes": attributes or {}}
+ settings = {"lag_time": lag_time, "attributes": attributes}
for name, value in settings["attributes"].items():
if name == "LagValue" and value is not None:
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_recurrence_pattern.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_recurrence_pattern.py
index 2863102b3d..489aa66d6f 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_recurrence_pattern.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_recurrence_pattern.py
@@ -18,9 +18,12 @@
import ifcopenshell
import ifcopenshell.util.sequence
+from typing import Any
-def edit_recurrence_pattern(file, recurrence_pattern=None, attributes=None) -> None:
+def edit_recurrence_pattern(
+ file: ifcopenshell.file, recurrence_pattern: ifcopenshell.entity_instance, attributes: dict[str, Any]
+) -> None:
"""Edits the attributes of an IfcRecurrencePattern
For more information about the attributes and data types of an
@@ -29,7 +32,7 @@ def edit_recurrence_pattern(file, recurrence_pattern=None, attributes=None) -> N
:param recurrence_pattern: The IfcRecurrencePattern entity you want to edit
:type recurrence_pattern: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
- :type attributes: dict, optional
+ :type attributes: dict
:return: None
:rtype: None
@@ -54,7 +57,7 @@ def edit_recurrence_pattern(file, recurrence_pattern=None, attributes=None) -> N
"""
settings = {
"recurrence_pattern": recurrence_pattern,
- "attributes": attributes or {},
+ "attributes": attributes,
}
for name, value in settings["attributes"].items():
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_sequence.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_sequence.py
index bcbc521ef3..b83baa9cb2 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_sequence.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_sequence.py
@@ -18,9 +18,12 @@
import ifcopenshell
import ifcopenshell.api
+from typing import Any
-def edit_sequence(file, rel_sequence=None, attributes=None) -> None:
+def edit_sequence(
+ file: ifcopenshell.file, rel_sequence: ifcopenshell.entity_instance, attributes: dict[str, Any]
+) -> None:
"""Edits the attributes of an IfcRelSequence
For more information about the attributes and data types of an
@@ -29,7 +32,7 @@ def edit_sequence(file, rel_sequence=None, attributes=None) -> None:
:param rel_sequence: The IfcRelSequence entity you want to edit
:type rel_sequence: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
- :type attributes: dict, optional
+ :type attributes: dict
:return: None
:rtype: None
@@ -59,7 +62,7 @@ def edit_sequence(file, rel_sequence=None, attributes=None) -> None:
ifcopenshell.api.run("sequence.edit_sequence", model,
rel_sequence=sequence, attributes={"SequenceType": "START_START"})
"""
- settings = {"rel_sequence": rel_sequence, "attributes": attributes or {}}
+ settings = {"rel_sequence": rel_sequence, "attributes": attributes}
for name, value in settings["attributes"].items():
setattr(settings["rel_sequence"], name, value)
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_task.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_task.py
index d151926a69..325c6bdce1 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_task.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_task.py
@@ -15,9 +15,11 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
+from typing import Any
-def edit_task(file, task=None, attributes=None) -> None:
+def edit_task(file: ifcopenshell.file, task: ifcopenshell.entity_instance, attributes: dict[str, Any]) -> None:
"""Edits the attributes of an IfcTask
For more information about the attributes and data types of an
@@ -26,7 +28,7 @@ def edit_task(file, task=None, attributes=None) -> None:
:param task: The IfcTask entity you want to edit
:type task: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
- :type attributes: dict, optional
+ :type attributes: dict
:return: None
:rtype: None
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_task_time.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_task_time.py
index f81b2b1f90..d0ecfa29d8 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_task_time.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_task_time.py
@@ -20,13 +20,13 @@ import datetime
import ifcopenshell.util.constraint
import ifcopenshell.util.date
import ifcopenshell.util.sequence
-from typing import Any, Optional
+from typing import Any
def edit_task_time(
file: ifcopenshell.file,
task_time: ifcopenshell.entity_instance,
- attributes: Optional[dict[str, Any]] = None,
+ attributes: dict[str, Any],
) -> None:
"""Edits the attributes of an IfcTaskTime
@@ -36,7 +36,7 @@ def edit_task_time(
:param task_time: The IfcTaskTime entity you want to edit
:type task_time: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
- :type attributes: dict, optional
+ :type attributes: dict
:return: None
:rtype: None
@@ -59,7 +59,7 @@ def edit_task_time(
"""
usecase = Usecase()
usecase.file = file
- usecase.settings = {"task_time": task_time, "attributes": attributes or {}}
+ usecase.settings = {"task_time": task_time, "attributes": attributes}
return usecase.execute()
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_work_calendar.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_work_calendar.py
index 4efb35da84..6bcfcb3fd3 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_work_calendar.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_work_calendar.py
@@ -15,9 +15,13 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
+from typing import Any
-def edit_work_calendar(file, work_calendar=None, attributes=None) -> None:
+def edit_work_calendar(
+ file: ifcopenshell.file, work_calendar: ifcopenshell.entity_instance, attributes: dict[str, Any]
+) -> None:
"""Edits the attributes of an IfcWorkCalendar
For more information about the attributes and data types of an
@@ -26,7 +30,7 @@ def edit_work_calendar(file, work_calendar=None, attributes=None) -> None:
:param work_calendar: The IfcWorkCalendar entity you want to edit
:type work_calendar: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
- :type attributes: dict, optional
+ :type attributes: dict
:return: None
:rtype: None
@@ -41,7 +45,7 @@ def edit_work_calendar(file, work_calendar=None, attributes=None) -> None:
ifcopenshell.api.run("sequence.edit_work_calendar", model,
work_calendar=calendar, attributes={"Description": "Monday to Friday 8 hour days"})
"""
- settings = {"work_calendar": work_calendar, "attributes": attributes or {}}
+ settings = {"work_calendar": work_calendar, "attributes": attributes}
for name, value in settings["attributes"].items():
setattr(settings["work_calendar"], name, value)
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_work_plan.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_work_plan.py
index e2bbcae33f..a5e96c16bb 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_work_plan.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_work_plan.py
@@ -17,9 +17,12 @@
# along with IfcOpenShell. If not, see .
import ifcopenshell.util.date
+from typing import Any
-def edit_work_plan(file, work_plan=None, attributes=None) -> None:
+def edit_work_plan(
+ file: ifcopenshell.file, work_plan: ifcopenshell.entity_instance, attributes: dict[str, Any]
+) -> None:
"""Edits the attributes of an IfcWorkPlan
For more information about the attributes and data types of an
@@ -28,7 +31,7 @@ def edit_work_plan(file, work_plan=None, attributes=None) -> None:
:param work_plan: The IfcWorkPlan entity you want to edit
:type work_plan: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
- :type attributes: dict, optional
+ :type attributes: dict
:return: None
:rtype: None
@@ -43,7 +46,7 @@ def edit_work_plan(file, work_plan=None, attributes=None) -> None:
ifcopenshell.api.run("sequence.edit_work_plan", model,
work_plan=work_plan, attributes={"Description": "Construction of phase 1"})
"""
- settings = {"work_plan": work_plan, "attributes": attributes or {}}
+ settings = {"work_plan": work_plan, "attributes": attributes}
for name, value in settings["attributes"].items():
if value:
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_work_schedule.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_work_schedule.py
index 49e6b053ac..79ef8b90de 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_work_schedule.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_work_schedule.py
@@ -17,9 +17,12 @@
# along with IfcOpenShell. If not, see .
import ifcopenshell.util.date
+from typing import Any
-def edit_work_schedule(file, work_schedule=None, attributes=None) -> None:
+def edit_work_schedule(
+ file: ifcopenshell.entity_instance, work_schedule: ifcopenshell.entity_instance, attributes: dict[str, Any]
+) -> None:
"""Edits the attributes of an IfcWorkSchedule
For more information about the attributes and data types of an
@@ -28,7 +31,7 @@ def edit_work_schedule(file, work_schedule=None, attributes=None) -> None:
:param work_schedule: The IfcWorkSchedule entity you want to edit
:type work_schedule: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
- :type attributes: dict, optional
+ :type attributes: dict
:return: None
:rtype: None
@@ -47,7 +50,7 @@ def edit_work_schedule(file, work_schedule=None, attributes=None) -> None:
ifcopenshell.api.run("sequence.edit_work_schedule", model,
work_schedule=work_schedule, attributes={"Description": "3 crane design option"})
"""
- settings = {"work_schedule": work_schedule, "attributes": attributes or {}}
+ settings = {"work_schedule": work_schedule, "attributes": attributes}
for name, value in settings["attributes"].items():
if value:
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_work_time.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_work_time.py
index ac0a05dad0..5f16eba16a 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_work_time.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/edit_work_time.py
@@ -17,13 +17,13 @@
# along with IfcOpenShell. If not, see .
import ifcopenshell.util.date
-from typing import Any, Optional
+from typing import Any
def edit_work_time(
file: ifcopenshell.file,
work_time: ifcopenshell.entity_instance,
- attributes: Optional[dict[str, Any]] = None,
+ attributes: dict[str, Any],
) -> None:
"""Edits the attributes of an IfcWorkTime
@@ -33,7 +33,7 @@ def edit_work_time(
:param work_time: The IfcWorkTime entity you want to edit
:type work_time: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
- :type attributes: dict, optional
+ :type attributes: dict
:return: None
:rtype: None
@@ -54,7 +54,7 @@ def edit_work_time(
ifcopenshell.api.run("sequence.edit_work_time", model,
work_time=work_time, attributes={"StartDate": "2000-01-01", "FinishDate": "2000-01-02"})
"""
- settings = {"work_time": work_time, "attributes": attributes or {}}
+ settings = {"work_time": work_time, "attributes": attributes}
for name, value in settings["attributes"].items():
if name in ("Start", "StartDate"):
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/recalculate_schedule.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/recalculate_schedule.py
index d54bf01579..ab80999339 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/recalculate_schedule.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/recalculate_schedule.py
@@ -23,7 +23,7 @@ import ifcopenshell.util.date
import ifcopenshell.util.sequence
-def recalculate_schedule(file, work_schedule=None) -> None:
+def recalculate_schedule(file: ifcopenshell.file, work_schedule: ifcopenshell.entity_instance) -> None:
"""Calculate the critical path and floats for a work schedule
This implements critical path analysis, using the forward pass and
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_task.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_task.py
index d49da8324e..6f388c7921 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_task.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_task.py
@@ -21,7 +21,7 @@ import ifcopenshell.api
import ifcopenshell.util.element
-def remove_task(file, task=None) -> None:
+def remove_task(file: ifcopenshell.file, task: ifcopenshell.entity_instance) -> None:
"""Removes a task
All subtasks are also removed recursively. Any relationships such as
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_time_period.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_time_period.py
index 672606c421..0102c552dc 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_time_period.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_time_period.py
@@ -19,7 +19,7 @@
import ifcopenshell.api
-def remove_time_period(file, time_period=None) -> None:
+def remove_time_period(file: ifcopenshell.file, time_period: ifcopenshell.entity_instance) -> None:
"""Removes a time period
:param time_period: The IfcTimePeriod to remove.
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_work_calendar.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_work_calendar.py
index 22a362c42d..10ad55e5dd 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_work_calendar.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_work_calendar.py
@@ -17,10 +17,11 @@
# along with IfcOpenShell. If not, see .
import ifcopenshell
+import ifcopenshell.api
import ifcopenshell.util.element
-def remove_work_calendar(file, work_calendar=None) -> None:
+def remove_work_calendar(file: ifcopenshell.file, work_calendar: ifcopenshell.entity_instance) -> None:
"""Removes a work calendar
All relationships are also removed, such as if a task is set to use that
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_work_plan.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_work_plan.py
index 28675fe6a5..22a19e5051 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_work_plan.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_work_plan.py
@@ -20,7 +20,7 @@ import ifcopenshell
import ifcopenshell.util.element
-def remove_work_plan(file, work_plan=None) -> None:
+def remove_work_plan(file: ifcopenshell.entity_instance, work_plan: ifcopenshell.entity_instance) -> None:
"""Removes a work plan
Note that schedules that are grouped under the work plan are not
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_work_schedule.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_work_schedule.py
index ec06a9146b..c648cfc576 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_work_schedule.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_work_schedule.py
@@ -21,7 +21,7 @@ import ifcopenshell.api
import ifcopenshell.util.element
-def remove_work_schedule(file, work_schedule=None) -> None:
+def remove_work_schedule(file: ifcopenshell.file, work_schedule: ifcopenshell.entity_instance) -> None:
"""Removes a work schedule
All tasks in the work schedule are also removed recursively.
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_work_time.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_work_time.py
index ab4587ce6a..f6914fefbd 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_work_time.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/remove_work_time.py
@@ -15,9 +15,10 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
-def remove_work_time(file, work_time=None) -> None:
+def remove_work_time(file: ifcopenshell.file, work_time: ifcopenshell.entity_instance) -> None:
"""Removes a work time
:param work_time: The IfcWorkTime to remove.
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_lag_time.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_lag_time.py
index cac8f95372..716bb64b8b 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_lag_time.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_lag_time.py
@@ -19,7 +19,7 @@
import ifcopenshell.api
-def unassign_lag_time(file, rel_sequence=None) -> None:
+def unassign_lag_time(file: ifcopenshell.file, rel_sequence: ifcopenshell.entity_instance) -> None:
"""Removes any lag time in a sequence
The schedule is cascaded afterwards.
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_process.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_process.py
index f7e141afc1..08d9b8ab4f 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_process.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_process.py
@@ -21,7 +21,11 @@ import ifcopenshell.api
import ifcopenshell.util.element
-def unassign_process(file, relating_process=None, related_object=None) -> None:
+def unassign_process(
+ file: ifcopenshell.file,
+ relating_process: ifcopenshell.entity_instance,
+ related_object: ifcopenshell.entity_instance,
+) -> None:
"""Unassigns a process and object relationship
See ifcopenshell.api.sequence.assign_process for details.
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_product.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_product.py
index 23f9281c95..4dc4ee4845 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_product.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_product.py
@@ -21,7 +21,11 @@ import ifcopenshell.api
import ifcopenshell.util.element
-def unassign_product(file, relating_product=None, related_object=None) -> None:
+def unassign_product(
+ file: ifcopenshell.file,
+ relating_product: ifcopenshell.entity_instance,
+ related_object: ifcopenshell.entity_instance,
+) -> None:
"""Unassigns a product and object relationship
See ifcopenshell.api.sequence.assign_product for details.
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_recurrence_pattern.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_recurrence_pattern.py
index 46c99207f5..0ce5fae546 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_recurrence_pattern.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_recurrence_pattern.py
@@ -15,9 +15,10 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
-def unassign_recurrence_pattern(file, recurrence_pattern=None) -> None:
+def unassign_recurrence_pattern(file: ifcopenshell.file, recurrence_pattern: ifcopenshell.entity_instance) -> None:
"""Unassigns a recurrence pattern
Note that a recurring task time must have a recurrence pattern, so if
diff --git a/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_sequence.py b/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_sequence.py
index f10b11f893..277dfc67ee 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_sequence.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/sequence/unassign_sequence.py
@@ -21,7 +21,11 @@ import ifcopenshell.api
import ifcopenshell.util.element
-def unassign_sequence(file, relating_process=None, related_process=None) -> None:
+def unassign_sequence(
+ file: ifcopenshell.file,
+ relating_process: ifcopenshell.entity_instance,
+ related_process: ifcopenshell.entity_instance,
+) -> None:
"""Removes a sequence relationship between tasks
:param relating_process: The previous / predecessor task.
diff --git a/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_activity.py b/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_activity.py
index 4be210fcf1..7680dfd90d 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_activity.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_activity.py
@@ -17,15 +17,16 @@
# along with IfcOpenShell. If not, see .
import ifcopenshell.api
+from typing import Literal
def add_structural_activity(
- file,
- ifc_class="IfcStructuralPlanarAction",
- predefined_type="CONST",
- global_or_local="GLOBAL_COORDS",
- applied_load=None,
- structural_member=None,
+ file: ifcopenshell.file,
+ applied_load: ifcopenshell.entity_instance,
+ structural_member: ifcopenshell.entity_instance,
+ ifc_class: str = "IfcStructuralPlanarAction",
+ predefined_type: str = "CONST",
+ global_or_local: Literal["GLOBAL_COORDS", "LOCAL_COORDS"] = "GLOBAL_COORDS",
) -> None:
"""Adds a new structural activity
diff --git a/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_analysis_model.py b/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_analysis_model.py
index 837fd29cce..ca6f3e2b52 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_analysis_model.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_analysis_model.py
@@ -20,7 +20,7 @@ import ifcopenshell
import ifcopenshell.api
-def add_structural_analysis_model(file) -> None:
+def add_structural_analysis_model(file: ifcopenshell.file) -> ifcopenshell.entity_instance:
"""Add a new structural analysis model
A structural analysis model is a group of all the loads, reactions,
@@ -39,8 +39,6 @@ def add_structural_analysis_model(file) -> None:
# Create a fresh blank structural analysis
analysis = ifcopenshell.api.run("structural.add_structural_analysis_model", model)
"""
- settings = {}
-
return ifcopenshell.api.run(
"root.create_entity", file, ifc_class="IfcStructuralAnalysisModel", predefined_type="LOADING_3D"
)
diff --git a/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_boundary_condition.py b/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_boundary_condition.py
index 5aef16efed..fa88d76b57 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_boundary_condition.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_boundary_condition.py
@@ -15,9 +15,16 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
+from typing import Optional
-def add_structural_boundary_condition(file, name=None, connection=None, ifc_class="IfcBoundaryNodeCondition") -> None:
+def add_structural_boundary_condition(
+ file: ifcopenshell.file,
+ name: Optional[str] = None,
+ connection: Optional[ifcopenshell.entity_instance] = None,
+ ifc_class: str = "IfcBoundaryNodeCondition",
+) -> ifcopenshell.entity_instance:
"""Adds a new structural boundary condition to a structural connection
The type of boundary condition depends on the connection. Point
@@ -60,7 +67,9 @@ def add_structural_boundary_condition(file, name=None, connection=None, ifc_clas
elif related_connection.is_a("IfcStructuralSurfaceConnection"):
boundary_class = "IfcBoundaryFaceCondition"
- settings["connection"].AppliedCondition = file.create_entity(boundary_class, Name=settings["name"])
+ condition = file.create_entity(boundary_class, Name=settings["name"])
+ settings["connection"].AppliedCondition = condition
+ return condition
else:
# add an orphan boundary condition
return file.create_entity(settings["ifc_class"], Name=settings["name"])
diff --git a/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_load.py b/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_load.py
index 3cb06cd513..d996a84c86 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_load.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_load.py
@@ -17,9 +17,12 @@
# along with IfcOpenShell. If not, see .
import ifcopenshell.api
+from typing import Optional
-def add_structural_load(file, name=None, ifc_class="IfcStructuralLoadLinearForce") -> None:
+def add_structural_load(
+ file: ifcopenshell.file, name: Optional[str] = None, ifc_class: str = "IfcStructuralLoadLinearForce"
+) -> ifcopenshell.entity_instance:
"""Adds a new structural load
Structural loads may be actions or reactions. A simple load might be a
@@ -42,9 +45,4 @@ def add_structural_load(file, name=None, ifc_class="IfcStructuralLoadLinearForce
# Create a simple linear load
ifcopenshell.api.run("structural.add_structural_load", model)
"""
- settings = {
- "name": name,
- "ifc_class": ifc_class,
- }
-
- return file.create_entity(settings["ifc_class"], Name=settings["name"])
+ return file.create_entity(ifc_class, Name=name)
diff --git a/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_load_case.py b/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_load_case.py
index e3d2c4f6c2..32f9906c90 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_load_case.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_load_case.py
@@ -19,7 +19,9 @@
import ifcopenshell.api
-def add_structural_load_case(file, name="Unnamed", action_type="NOTDEFINED", action_source="NOTDEFINED") -> None:
+def add_structural_load_case(
+ file: ifcopenshell.file, name: str = "Unnamed", action_type: str = "NOTDEFINED", action_source: str = "NOTDEFINED"
+) -> ifcopenshell.entity_instance:
"""Adds a new load case, which is a collection of related load groups
:param name: The name of the load case
@@ -34,19 +36,14 @@ def add_structural_load_case(file, name="Unnamed", action_type="NOTDEFINED", act
:return: The new IfcStructuralLoadCase
:rtype: ifcopenshell.entity_instance
"""
- settings = {
- "name": name,
- "action_type": action_type,
- "action_source": action_source,
- }
load_case = ifcopenshell.api.run(
"root.create_entity",
file,
ifc_class="IfcStructuralLoadCase",
predefined_type="LOAD_CASE",
- name=settings["name"],
+ name=name
)
- load_case.ActionType = settings["action_type"]
- load_case.ActionSource = settings["action_source"]
+ load_case.ActionType = action_type
+ load_case.ActionSource = action_source
return load_case
diff --git a/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_load_group.py b/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_load_group.py
index 3f450df5c8..36aa6bdd80 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_load_group.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_load_group.py
@@ -19,7 +19,9 @@
import ifcopenshell.api
-def add_structural_load_group(file, name="Unnamed", action_type="NOTDEFINED", action_source="NOTDEFINED") -> None:
+def add_structural_load_group(
+ file: ifcopenshell.file, name: str = "Unnamed", action_type: str = "NOTDEFINED", action_source: str = "NOTDEFINED"
+) -> ifcopenshell.entity_instance:
"""Adds a new load group, which is a collection of related loads
:param name: The name of the load group
@@ -34,19 +36,14 @@ def add_structural_load_group(file, name="Unnamed", action_type="NOTDEFINED", ac
:return: The new IfcStructuralLoadCase
:rtype: ifcopenshell.entity_instance
"""
- settings = {
- "name": name,
- "action_type": action_type,
- "action_source": action_source,
- }
load_group = ifcopenshell.api.run(
"root.create_entity",
file,
ifc_class="IfcStructuralLoadGroup",
predefined_type="LOAD_GROUP",
- name=settings["name"],
+ name=name,
)
- load_group.ActionType = settings["action_type"]
- load_group.ActionSource = settings["action_source"]
+ load_group.ActionType = action_type
+ load_group.ActionSource = action_source
return load_group
diff --git a/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_member_connection.py b/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_member_connection.py
index 792c03b66a..df6d98ef3e 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_member_connection.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/structural/add_structural_member_connection.py
@@ -20,7 +20,11 @@ import ifcopenshell
import ifcopenshell.api
-def add_structural_member_connection(file, relating_structural_member=None, related_structural_connection=None) -> None:
+def add_structural_member_connection(
+ file: ifcopenshell.file,
+ relating_structural_member: ifcopenshell.entity_instance,
+ related_structural_connection: ifcopenshell.entity_instance,
+) -> ifcopenshell.entity_instance:
"""Relates a structural member and a structural connection
:param relating_structural_member: The IfcStructuralMember to have a
@@ -39,7 +43,7 @@ def add_structural_member_connection(file, relating_structural_member=None, rela
for connection in settings["related_structural_connection"].ConnectsStructuralMembers or []:
if connection.RelatingStructuralMember == settings["relating_structural_member"]:
- return
+ return connection
rel = ifcopenshell.api.run("root.create_entity", file, ifc_class="IfcRelConnectsStructuralMember")
rel.RelatingStructuralMember = settings["relating_structural_member"]
rel.RelatedStructuralConnection = settings["related_structural_connection"]
diff --git a/src/ifcopenshell-python/ifcopenshell/api/structural/assign_structural_analysis_model.py b/src/ifcopenshell-python/ifcopenshell/api/structural/assign_structural_analysis_model.py
index e6aba2d807..39d4d652bf 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/structural/assign_structural_analysis_model.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/structural/assign_structural_analysis_model.py
@@ -21,7 +21,11 @@ import ifcopenshell.api
import ifcopenshell.guid
-def assign_structural_analysis_model(file, product=None, structural_analysis_model=None) -> None:
+def assign_structural_analysis_model(
+ file: ifcopenshell.file,
+ product: ifcopenshell.entity_instance,
+ structural_analysis_model: ifcopenshell.entity_instance,
+) -> ifcopenshell.entity_instance:
"""Assigns a load or structural member to an analysis model
:param product: The structural element that is part of the analysis.
@@ -52,3 +56,4 @@ def assign_structural_analysis_model(file, product=None, structural_analysis_mod
related_objects.add(settings["product"])
rel.RelatedObjects = list(related_objects)
ifcopenshell.api.run("owner.update_owner_history", file, **{"element": rel})
+ return rel
diff --git a/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_analysis_model.py b/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_analysis_model.py
index 7c41c59478..4b7d94a4a2 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_analysis_model.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_analysis_model.py
@@ -15,9 +15,13 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
+from typing import Any
-def edit_structural_analysis_model(file, structural_analysis_model=None, attributes=None) -> None:
+def edit_structural_analysis_model(
+ file: ifcopenshell.file, structural_analysis_model: ifcopenshell.entity_instance, attributes: dict[str, Any]
+) -> None:
"""Edits the attributes of an IfcStructuralAnalysisModel
For more information about the attributes and data types of an
@@ -26,7 +30,7 @@ def edit_structural_analysis_model(file, structural_analysis_model=None, attribu
:param structural_analysis_model: The IfcStructuralAnalysisModel entity you want to edit
:type structural_analysis_model: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
- :type attributes: dict, optional
+ :type attributes: dict
:return: None
:rtype: None
"""
diff --git a/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_boundary_condition.py b/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_boundary_condition.py
index 2674a4869e..54963415df 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_boundary_condition.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_boundary_condition.py
@@ -15,9 +15,13 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
+from typing import Any
-def edit_structural_boundary_condition(file, condition=None, attributes=None) -> None:
+def edit_structural_boundary_condition(
+ file: ifcopenshell.file, condition: ifcopenshell.entity_instance, attributes: dict[str, Any]
+) -> None:
"""Edits the attributes of an IfcBoundaryCondition
For more information about the attributes and data types of an
@@ -26,11 +30,11 @@ def edit_structural_boundary_condition(file, condition=None, attributes=None) ->
:param condition: The IfcBoundaryCondition entity you want to edit
:type condition: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
- :type attributes: dict, optional
+ :type attributes: dict
:return: None
:rtype: None
"""
- settings = {"condition": condition, "attributes": attributes or {}}
+ settings = {"condition": condition, "attributes": attributes}
for name, data in settings["attributes"].items():
if data["type"] == "string" or data["type"] == "null":
diff --git a/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_connection_cs.py b/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_connection_cs.py
index 89faa62ecd..0d569c5f56 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_connection_cs.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_connection_cs.py
@@ -15,26 +15,32 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
-def edit_structural_connection_cs(file, structural_item=None, axis=None, ref_direction=None) -> None:
+def edit_structural_connection_cs(
+ file: ifcopenshell.file,
+ structural_item: ifcopenshell.entity_instance,
+ axis: tuple[float, float, float] = (0.0, 0.0, 1.0),
+ ref_direction: tuple[float, float, float] = (1.0, 0.0, 0.0),
+) -> None:
"""Edits the coordinate system of a structural connection
:param structural_item: The IfcStructuralItem you want to modify.
:type structural_item: ifcopenshell.entity_instance
:param axis: The unit Z axis vector defined as a list of 3 floats.
- Defaults to [0., 0., 1.].
- :type axis: list[float]
+ Defaults to (0., 0., 1.).
+ :type axis: tuple[float, float, float]
:param ref_direction: The unit X axis vector defined as a list of 3
- floats. Defaults to [1., 0., 0.].
- :type ref_direction: list[float]
+ floats. Defaults to (1., 0., 0.).
+ :type ref_direction: tuple[float, float, float]
:return: None
:rtype: None
"""
settings = {
"structural_item": structural_item,
- "axis": axis or [0.0, 0.0, 1.0],
- "ref_direction": ref_direction or [1.0, 0.0, 0.0],
+ "axis": axis,
+ "ref_direction": ref_direction,
}
if settings["structural_item"].ConditionCoordinateSystem is None:
diff --git a/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_item_axis.py b/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_item_axis.py
index dbb2541371..8b90457a47 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_item_axis.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_item_axis.py
@@ -15,20 +15,25 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
-def edit_structural_item_axis(file, structural_item=None, axis=None) -> None:
+def edit_structural_item_axis(
+ file: ifcopenshell.file,
+ structural_item: ifcopenshell.entity_instance,
+ axis: tuple[float, float, float] = (0.0, 0.0, 1.0),
+) -> None:
"""Edits the coordinate system of a structural connection
:param structural_item: The IfcStructuralItem you want to modify.
:type structural_item: ifcopenshell.entity_instance
:param axis: The unit Z axis vector defined as a list of 3 floats.
- Defaults to [0., 0., 1.].
- :type axis: list[float]
+ Defaults to (0., 0., 1.).
+ :type axis: tuple[float, float, float]
:return: None
:rtype: None
"""
- settings = {"structural_item": structural_item, "axis": axis or [0.0, 0.0, 1.0]}
+ settings = {"structural_item": structural_item, "axis": axis}
if len(file.get_inverse(settings["structural_item"].Axis)) == 1:
file.remove(settings["structural_item"].Axis)
diff --git a/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_load.py b/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_load.py
index 2c577deb83..20298d1c0f 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_load.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_load.py
@@ -15,9 +15,13 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
+from typing import Any
-def edit_structural_load(file, structural_load=None, attributes=None) -> None:
+def edit_structural_load(
+ file: ifcopenshell.file, structural_load: ifcopenshell.entity_instance, attributes: dict[str, Any]
+) -> None:
"""Edits the attributes of an IfcStructuralLoad
For more information about the attributes and data types of an
@@ -26,7 +30,7 @@ def edit_structural_load(file, structural_load=None, attributes=None) -> None:
:param structural_load: The IfcStructuralLoad entity you want to edit
:type structural_load: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
- :type attributes: dict, optional
+ :type attributes: dict
:return: None
:rtype: None
"""
diff --git a/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_load_case.py b/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_load_case.py
index 4c84573795..59231fb9e4 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_load_case.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/structural/edit_structural_load_case.py
@@ -15,9 +15,13 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
+from typing import Any
-def edit_structural_load_case(file, load_case=None, attributes=None) -> None:
+def edit_structural_load_case(
+ file: ifcopenshell.file, load_case: ifcopenshell.entity_instance, attributes: dict[str, Any]
+) -> None:
"""Edits the attributes of an IfcStructuralLoadCase
For more information about the attributes and data types of an
@@ -26,7 +30,7 @@ def edit_structural_load_case(file, load_case=None, attributes=None) -> None:
:param load_case: The IfcStructuralLoadCase entity you want to edit
:type load_case: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
- :type attributes: dict, optional
+ :type attributes: dict
:return: None
:rtype: None
"""
diff --git a/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_analysis_model.py b/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_analysis_model.py
index b238562b18..8135bc0255 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_analysis_model.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_analysis_model.py
@@ -20,7 +20,9 @@ import ifcopenshell
import ifcopenshell.util.element
-def remove_structural_analysis_model(file, structural_analysis_model=None) -> None:
+def remove_structural_analysis_model(
+ file: ifcopenshell.file, structural_analysis_model: ifcopenshell.entity_instance
+) -> None:
"""Removes an analysis model
Note that the contents of an analysis model are currently preserved.
diff --git a/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_boundary_condition.py b/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_boundary_condition.py
index 7aa4f6bd74..bd9018c1e2 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_boundary_condition.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_boundary_condition.py
@@ -15,16 +15,22 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
+from typing import Optional
-def remove_structural_boundary_condition(file, connection=None, boundary_condition=None) -> None:
+def remove_structural_boundary_condition(
+ file: ifcopenshell.file,
+ connection: Optional[ifcopenshell.entity_instance] = None,
+ boundary_condition: Optional[ifcopenshell.entity_instance] = None,
+) -> None:
"""Removes a condition from a connection, or an orphased boundary condition
:param connection: The IfcStructuralConnection to remove the condition
from. If omitted, it is assumed to be an orphaned condition.
:type connection: ifcopenshell.entity_instance,optional
:param boundary_condition: The IfcBoundaryCondition to remove.
- :type boundary_condition: ifcopenshell.entity_instance
+ :type boundary_condition: ifcopenshell.entity_instance, optional.
:return: None
:rtype: None
"""
diff --git a/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_connection_condition.py b/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_connection_condition.py
index 21ed51f712..91eb517640 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_connection_condition.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_connection_condition.py
@@ -21,7 +21,7 @@ import ifcopenshell.api
import ifcopenshell.util.element
-def remove_structural_connection_condition(file, relation=None) -> None:
+def remove_structural_connection_condition(file: ifcopenshell.file, relation: ifcopenshell.entity_instance) -> None:
"""Removes a relationship between a connection and a condition
The condition and the member itself is preserved.
diff --git a/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_load.py b/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_load.py
index afe97029ab..1d406a16e8 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_load.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_load.py
@@ -15,9 +15,10 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
-def remove_structural_load(file, structural_load=None) -> None:
+def remove_structural_load(file: ifcopenshell.file, structural_load: ifcopenshell.entity_instance) -> None:
"""Removes a structural load
:param structural_load: The IfcStructuralLoad to remove.
diff --git a/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_load_case.py b/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_load_case.py
index de317ed354..1d9473515a 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_load_case.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_load_case.py
@@ -21,7 +21,7 @@ import ifcopenshell.api
import ifcopenshell.util.element
-def remove_structural_load_case(file, load_case=None) -> None:
+def remove_structural_load_case(file: ifcopenshell.file, load_case: ifcopenshell.entity_instance) -> None:
"""Removes a structural load case
:param load_case: The IfcStructuralLoadCase to remove.
diff --git a/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_load_group.py b/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_load_group.py
index 541dd87811..281630fd7a 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_load_group.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/structural/remove_structural_load_group.py
@@ -21,7 +21,7 @@ import ifcopenshell.api
import ifcopenshell.util.element
-def remove_structural_load_group(file, load_group=None) -> None:
+def remove_structural_load_group(file: ifcopenshell.file, load_group: ifcopenshell.entity_instance) -> None:
"""Removes a structural load group
:param load_group: The IfcStructuralLoadGroup to remove.
diff --git a/src/ifcopenshell-python/ifcopenshell/api/structural/unassign_structural_analysis_model.py b/src/ifcopenshell-python/ifcopenshell/api/structural/unassign_structural_analysis_model.py
index b4dedc2832..28e6531bfa 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/structural/unassign_structural_analysis_model.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/structural/unassign_structural_analysis_model.py
@@ -21,7 +21,11 @@ import ifcopenshell.api
import ifcopenshell.util.element
-def unassign_structural_analysis_model(file, product=None, structural_analysis_model=None) -> None:
+def unassign_structural_analysis_model(
+ file: ifcopenshell.file,
+ product: ifcopenshell.entity_instance,
+ structural_analysis_model: ifcopenshell.entity_instance,
+) -> None:
"""Removes a relationship between a structural element and the analysis model
:param product: The structural element that is part of the analysis.
diff --git a/src/ifcopenshell-python/ifcopenshell/api/style/add_style.py b/src/ifcopenshell-python/ifcopenshell/api/style/add_style.py
index 599feaef3d..2660cc6335 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/style/add_style.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/style/add_style.py
@@ -15,9 +15,13 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
+from typing import Optional
-def add_style(file, name=None, ifc_class="IfcSurfaceStyle") -> None:
+def add_style(
+ file: ifcopenshell.file, name: Optional[str] = None, ifc_class="IfcSurfaceStyle"
+) -> ifcopenshell.entity_instance:
"""Add a new presentation style
A presentation style is a container of visual settings (called
@@ -54,8 +58,10 @@ def add_style(file, name=None, ifc_class="IfcSurfaceStyle") -> None:
# Create a new surface style
style = ifcopenshell.api.run("style.add_style", model)
"""
- settings = {"name": name, "ifc_class": ifc_class}
- if settings["ifc_class"] == "IfcSurfaceStyle":
+ kwargs = {"Name": name}
+ if ifc_class == "IfcSurfaceStyle":
# Name is filled out because Revit treats this incorrectly as the material name
- return file.createIfcSurfaceStyle(settings["name"], "BOTH")
+ kwargs["Side"] = "BOTH"
+
+ return file.create_entity(ifc_class, **kwargs)
diff --git a/src/ifcopenshell-python/ifcopenshell/api/style/add_surface_style.py b/src/ifcopenshell-python/ifcopenshell/api/style/add_surface_style.py
index c8f9c415d1..25101ae5ad 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/style/add_surface_style.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/style/add_surface_style.py
@@ -18,9 +18,15 @@
import ifcopenshell
import ifcopenshell.api
+from typing import Any, Optional
-def add_surface_style(file, style=None, ifc_class="IfcSurfaceStyleShading", attributes=None) -> None:
+def add_surface_style(
+ file: ifcopenshell.file,
+ style: ifcopenshell.entity_instance,
+ ifc_class: str = "IfcSurfaceStyleShading",
+ attributes: Optional[dict[str, Any]] = None,
+) -> None:
"""Adds a new presentation item to a surface style
A surface style can have multiple different types of presentation items
diff --git a/src/ifcopenshell-python/ifcopenshell/api/style/add_surface_textures.py b/src/ifcopenshell-python/ifcopenshell/api/style/add_surface_textures.py
index 9b6fbda053..f6c8c3b0c3 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/style/add_surface_textures.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/style/add_surface_textures.py
@@ -15,18 +15,29 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
-
+from __future__ import annotations
import ifcopenshell
import ifcopenshell.api
+from typing import TYPE_CHECKING, Optional
+
+if TYPE_CHECKING:
+ import bpy
-def add_surface_textures(file, material=None, uv_maps=None, textures=None) -> None:
+def add_surface_textures(
+ file: ifcopenshell.entity_instance,
+ material: Optional[bpy.types.Material] = None,
+ textures: Optional[list[dict]] = None,
+ uv_maps: Optional[list[ifcopenshell.entity_instance]] = None,
+) -> list[ifcopenshell.entity_instance]:
"""Add surface texture based on a Blender material definition or texture data.
+ Either `material` or `textures` should be provided.
+
:param material: The Blender material definition with a node tree that
is compatible with glTF. See one of the valid combinations here:
https://docs.blender.org/manual/en/dev/addons/import_export/scene_gltf2.html
- :type material: bpy.types.Material
+ :type material: bpy.types.Material, optional
:param uv_maps: A list of IfcIndexedTextureMap for any
IfcTessellatedFaceSets that the representation has, obtained from
the HasTextures attribute.
@@ -44,7 +55,7 @@ def add_surface_textures(file, material=None, uv_maps=None, textures=None) -> No
based on geometry);
* `Camera` - IfcTextureCoordinateGenerator with mode COORD_EYE (autogenerated UV
based on camera position)
- :type textures: list[dict]
+ :type textures: list[dict], optional
:return: A list of IfcImageTexture
:rtype: list[ifcopenshell.entity_instance]
"""
diff --git a/src/ifcopenshell-python/ifcopenshell/api/style/assign_material_style.py b/src/ifcopenshell-python/ifcopenshell/api/style/assign_material_style.py
index 630a842bf6..45bbb3a059 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/style/assign_material_style.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/style/assign_material_style.py
@@ -22,7 +22,11 @@ import ifcopenshell.util.element
def assign_material_style(
- file, material=None, style=None, context=None, should_use_presentation_style_assignment=False
+ file: ifcopenshell.file,
+ material: ifcopenshell.entity_instance,
+ style: ifcopenshell.entity_instance,
+ context: ifcopenshell.entity_instance,
+ should_use_presentation_style_assignment: bool = False,
) -> None:
"""Assigns a style to a material
diff --git a/src/ifcopenshell-python/ifcopenshell/api/style/assign_representation_styles.py b/src/ifcopenshell-python/ifcopenshell/api/style/assign_representation_styles.py
index e2f5daf766..2aa95e6d94 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/style/assign_representation_styles.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/style/assign_representation_styles.py
@@ -15,15 +15,16 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
def assign_representation_styles(
- file,
- shape_representation=None,
- styles=None,
- replace_previous_same_type_style=True,
- should_use_presentation_style_assignment=False,
-) -> None:
+ file: ifcopenshell.file,
+ shape_representation: ifcopenshell.entity_instance,
+ styles: list[ifcopenshell.entity_instance],
+ replace_previous_same_type_style: bool = True,
+ should_use_presentation_style_assignment: bool = False,
+) -> list[ifcopenshell.entity_instance]:
"""Assigns a style directly to an object representation
A style may either be assigned directly to an object's representation,
@@ -56,7 +57,7 @@ def assign_representation_styles(
that this is no longer a valid IFC. Blame Autodesk.
:type should_use_presentation_style_assignment: bool
:return: List of created IfcStyledItems
- :rtype: ifcopenshell.entity_instance
+ :rtype: list[ifcopenshell.entity_instance]
Example:
diff --git a/src/ifcopenshell-python/ifcopenshell/api/style/edit_presentation_style.py b/src/ifcopenshell-python/ifcopenshell/api/style/edit_presentation_style.py
index 268acfdc2e..e8934d4de5 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/style/edit_presentation_style.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/style/edit_presentation_style.py
@@ -15,9 +15,13 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
+from typing import Any
-def edit_presentation_style(file, style=None, attributes=None) -> None:
+def edit_presentation_style(
+ file: ifcopenshell.file, style: ifcopenshell.entity_instance, attributes: dict[str, Any]
+) -> None:
"""Edits the attributes of an IfcPresentationStyle
For more information about the attributes and data types of an
@@ -26,7 +30,7 @@ def edit_presentation_style(file, style=None, attributes=None) -> None:
:param style: The IfcPresentationStyle entity you want to edit
:type style: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
- :type attributes: dict, optional
+ :type attributes: dict
:return: None
:rtype: None
diff --git a/src/ifcopenshell-python/ifcopenshell/api/style/edit_surface_style.py b/src/ifcopenshell-python/ifcopenshell/api/style/edit_surface_style.py
index b8c7a30be8..9dbb9245f6 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/style/edit_surface_style.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/style/edit_surface_style.py
@@ -15,9 +15,13 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
+from typing import Any
-def edit_surface_style(file, style=None, attributes=None) -> None:
+def edit_surface_style(
+ file: ifcopenshell.file, style: ifcopenshell.entity_instance, attributes: dict[str, Any]
+) -> None:
"""Edits the attributes of an IfcPresentationItem
For more information about the attributes and data types of an
@@ -34,7 +38,7 @@ def edit_surface_style(file, style=None, attributes=None) -> None:
:param style: The IfcPresentationStyle entity you want to edit
:type style: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
- :type attributes: dict, optional
+ :type attributes: dict
:return: None
:rtype: None
diff --git a/src/ifcopenshell-python/ifcopenshell/api/style/remove_style.py b/src/ifcopenshell-python/ifcopenshell/api/style/remove_style.py
index 453f511f2a..1868847ba4 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/style/remove_style.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/style/remove_style.py
@@ -15,11 +15,11 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
-
+import ifcopenshell.api
import ifcopenshell.util.element
-def remove_style(file, style=None) -> None:
+def remove_style(file: ifcopenshell.file, style: ifcopenshell.entity_instance) -> None:
"""Removes a presentation style
All of the presentation items of the style will also be removed.
diff --git a/src/ifcopenshell-python/ifcopenshell/api/style/remove_styled_representation.py b/src/ifcopenshell-python/ifcopenshell/api/style/remove_styled_representation.py
index 62ab7e4973..8b4323f0de 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/style/remove_styled_representation.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/style/remove_styled_representation.py
@@ -15,9 +15,10 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
-def remove_styled_representation(file, representation=None) -> None:
+def remove_styled_representation(file: ifcopenshell.file, representation: ifcopenshell.entity_instance) -> None:
"""Removes a styled representation
Styled representations are typically associated with materials. This
diff --git a/src/ifcopenshell-python/ifcopenshell/api/style/remove_surface_style.py b/src/ifcopenshell-python/ifcopenshell/api/style/remove_surface_style.py
index 9621d5b51a..4ec3b9a3f3 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/style/remove_surface_style.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/style/remove_surface_style.py
@@ -20,7 +20,7 @@ import ifcopenshell
import ifcopenshell.util.element
-def remove_surface_style(file, style=None) -> None:
+def remove_surface_style(file: ifcopenshell.file, style: ifcopenshell.entity_instance) -> None:
"""Removes a presentation item from a presentation style
:param style: The IfcPresentationItem to remove.
diff --git a/src/ifcopenshell-python/ifcopenshell/api/style/unassign_material_style.py b/src/ifcopenshell-python/ifcopenshell/api/style/unassign_material_style.py
index 59b37a1935..71189f8a88 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/style/unassign_material_style.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/style/unassign_material_style.py
@@ -18,9 +18,16 @@
import ifcopenshell
+import ifcopenshell.api
+import ifcopenshell.util.element
-def unassign_material_style(file, material=None, style=None, context=None) -> None:
+def unassign_material_style(
+ file: ifcopenshell.file,
+ material: ifcopenshell.entity_instance,
+ style: ifcopenshell.entity_instance,
+ context: ifcopenshell.entity_instance,
+) -> None:
"""Unassigns a style to a material
This does the inverse of assign_material_style.
diff --git a/src/ifcopenshell-python/ifcopenshell/api/style/unassign_representation_styles.py b/src/ifcopenshell-python/ifcopenshell/api/style/unassign_representation_styles.py
index 14f52e9c6e..4f5685b150 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/style/unassign_representation_styles.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/style/unassign_representation_styles.py
@@ -15,10 +15,14 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
def unassign_representation_styles(
- file, shape_representation=None, styles=None, should_use_presentation_style_assignment=False
+ file: ifcopenshell.file,
+ shape_representation: ifcopenshell.entity_instance,
+ styles: list[ifcopenshell.entity_instance],
+ should_use_presentation_style_assignment: bool = False,
) -> None:
"""Unassigns styles directly assigned to an object representation
diff --git a/src/ifcopenshell-python/ifcopenshell/api/system/add_port.py b/src/ifcopenshell-python/ifcopenshell/api/system/add_port.py
index a3664cffbb..e6311a72e9 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/system/add_port.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/system/add_port.py
@@ -18,9 +18,10 @@
import ifcopenshell
import ifcopenshell.api
+from typing import Optional
-def add_port(file, element=None) -> None:
+def add_port(file: ifcopenshell.file, element: Optional[ifcopenshell.entity_instance] = None) -> None:
"""Adds a new distribution port to an element
A distribution port represents a connection point on an element, where
@@ -34,7 +35,7 @@ def add_port(file, element=None) -> None:
:param element: The IfcDistributionElement you want to add a
distribution port to.
- :type element: ifcopenshell.entity_instance
+ :type element: ifcopenshell.entity_instance, optional
:return: The newly created IfcDistributionPort
:rtype: ifcopenshell.entity_instance
diff --git a/src/ifcopenshell-python/ifcopenshell/api/system/assign_flow_control.py b/src/ifcopenshell-python/ifcopenshell/api/system/assign_flow_control.py
index 0f92e006eb..6b6dcd9be2 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/system/assign_flow_control.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/system/assign_flow_control.py
@@ -19,9 +19,14 @@
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.guid
+from typing import Union
-def assign_flow_control(file, relating_flow_element=None, related_flow_control=None) -> None:
+def assign_flow_control(
+ file: ifcopenshell.file,
+ relating_flow_element: ifcopenshell.entity_instance,
+ related_flow_control: ifcopenshell.entity_instance,
+) -> Union[ifcopenshell.entity_instance, None]:
"""Assigns to the flow element control element that either sense or control
some aspect of the flow element.
diff --git a/src/ifcopenshell-python/ifcopenshell/api/system/assign_port.py b/src/ifcopenshell-python/ifcopenshell/api/system/assign_port.py
index 72afc13db3..7f801fc919 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/system/assign_port.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/system/assign_port.py
@@ -22,7 +22,9 @@ import ifcopenshell.guid
import ifcopenshell.util.placement
-def assign_port(file, element=None, port=None) -> None:
+def assign_port(
+ file: ifcopenshell.file, element: ifcopenshell.entity_instance, port: ifcopenshell.entity_instance
+) -> ifcopenshell.entity_instance:
"""Assigns a port to an element
If you have an orphaned port, you may assign it to a distribution
@@ -73,7 +75,7 @@ class Usecase:
for rel in rels:
if self.settings["port"] in rel.RelatedObjects:
- return
+ return rel
if rels:
rel = rels[0]
@@ -97,7 +99,7 @@ class Usecase:
def execute_ifc2x3(self):
for rel in self.settings["element"].HasPorts or []:
if rel.RelatingPort == self.settings["port"]:
- return
+ return rel
rel = self.file.create_entity(
"IfcRelConnectsPortToElement",
GlobalId=ifcopenshell.guid.new(),
diff --git a/src/ifcopenshell-python/ifcopenshell/api/system/connect_port.py b/src/ifcopenshell-python/ifcopenshell/api/system/connect_port.py
index c567d75eba..aea8575dce 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/system/connect_port.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/system/connect_port.py
@@ -20,9 +20,16 @@ import ifcopenshell
import ifcopenshell.api
import ifcopenshell.guid
import ifcopenshell.util.element
+from typing import Optional
-def connect_port(file, port1=None, port2=None, direction="NOTDEFINED", element=None) -> None:
+def connect_port(
+ file: ifcopenshell.file,
+ port1: ifcopenshell.entity_instance,
+ port2: ifcopenshell.entity_instance,
+ direction: str = "NOTDEFINED",
+ element: Optional[ifcopenshell.entity_instance] = None,
+) -> None:
"""Connects two ports together
A distribution element (e.g. a duct) may be connected to another
@@ -61,7 +68,7 @@ def connect_port(file, port1=None, port2=None, direction="NOTDEFINED", element=N
connectivity is made, such as a segment or fitting. This is only to
be used for implicit port connectivity where the segments and
fittings are less important.
- :type element: ifcopenshell.entity_instance
+ :type element: ifcopenshell.entity_instance, optional
Example:
diff --git a/src/ifcopenshell-python/ifcopenshell/api/system/disconnect_port.py b/src/ifcopenshell-python/ifcopenshell/api/system/disconnect_port.py
index 15d5890493..bb2cd9364f 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/system/disconnect_port.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/system/disconnect_port.py
@@ -21,7 +21,7 @@ import ifcopenshell.api
import ifcopenshell.util.element
-def disconnect_port(file, port=None) -> None:
+def disconnect_port(file: ifcopenshell.file, port: ifcopenshell.entity_instance) -> None:
"""Disconnects a port from any other port
A port may only be connected to one other port, so the other port is not
diff --git a/src/ifcopenshell-python/ifcopenshell/api/system/edit_system.py b/src/ifcopenshell-python/ifcopenshell/api/system/edit_system.py
index 83fd250ddd..d8c45f495e 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/system/edit_system.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/system/edit_system.py
@@ -15,9 +15,11 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see .
+import ifcopenshell
+from typing import Any
-def edit_system(file, system=None, attributes=None) -> None:
+def edit_system(file: ifcopenshell.file, system: ifcopenshell.entity_instance, attributes: dict[str, Any]) -> None:
"""Edits the attributes of an IfcSystem
For more information about the attributes and data types of an
@@ -26,7 +28,7 @@ def edit_system(file, system=None, attributes=None) -> None:
:param system: The IfcSystem entity you want to edit
:type system: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
- :type attributes: dict, optional
+ :type attributes: dict
:return: None
:rtype: None
diff --git a/src/ifcopenshell-python/ifcopenshell/api/system/remove_system.py b/src/ifcopenshell-python/ifcopenshell/api/system/remove_system.py
index a81a06127f..0d1fcf3853 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/system/remove_system.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/system/remove_system.py
@@ -21,7 +21,7 @@ import ifcopenshell.api
import ifcopenshell.util.element
-def remove_system(file, system=None) -> None:
+def remove_system(file: ifcopenshell.file, system: ifcopenshell.entity_instance) -> None:
"""Removes a distribution system
All the distribution elements within the system are retained.
diff --git a/src/ifcopenshell-python/ifcopenshell/api/system/unassign_flow_control.py b/src/ifcopenshell-python/ifcopenshell/api/system/unassign_flow_control.py
index feba961f1b..40a4efdadd 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/system/unassign_flow_control.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/system/unassign_flow_control.py
@@ -21,7 +21,11 @@ import ifcopenshell.api
import ifcopenshell.util.element
-def unassign_flow_control(file, relating_flow_element=None, related_flow_control=None) -> None:
+def unassign_flow_control(
+ file: ifcopenshell.file,
+ relating_flow_element: ifcopenshell.entity_instance,
+ related_flow_control: ifcopenshell.entity_instance,
+) -> None:
"""Unassigns flow control element from the flow element.
:param related_flow_control: IfcDistributionControlElement controling the
@@ -29,9 +33,8 @@ def unassign_flow_control(file, relating_flow_element=None, related_flow_control
:type related_flow_control: ifcopenshell.entity_instance
:param relating_flow_element: The IfcDistributionFlowElement that is being controlled
:type relating_flow_element: ifcopenshell.entity_instance
- :return: If the control still is related to other objects, the
- IfcRelFlowControlElements is returned, otherwise None.
- :rtype: ifcopenshell.entity_instance, None
+ :return: None
+ :rtype: None
Example:
@@ -71,4 +74,3 @@ def unassign_flow_control(file, relating_flow_element=None, related_flow_control
related_flow_controls.remove(settings["related_flow_control"])
assignment.RelatedControlElements = related_flow_controls
ifcopenshell.api.run("owner.update_owner_history", file, **{"element": assignment})
- return assignment
diff --git a/src/ifcopenshell-python/ifcopenshell/api/system/unassign_port.py b/src/ifcopenshell-python/ifcopenshell/api/system/unassign_port.py
index 678c086140..c7e079fbf0 100644
--- a/src/ifcopenshell-python/ifcopenshell/api/system/unassign_port.py
+++ b/src/ifcopenshell-python/ifcopenshell/api/system/unassign_port.py
@@ -18,9 +18,12 @@
import ifcopenshell
import ifcopenshell.api
+import ifcopenshell.util.element
-def unassign_port(file, element=None, port=None) -> None:
+def unassign_port(
+ file: ifcopenshell.file, element: ifcopenshell.entity_instance, port: ifcopenshell.entity_instance
+) -> None:
"""Unassigns a port to an element
Ports are typically always assigned to a distribution element, but in