Unify doc-strings (remove type/rtype)

As this information is already provided in type hints and we don't need to maintain it in two places.
This commit is contained in:
Andrej730
2025-06-30 17:39:34 +05:00
parent fc10915d2b
commit 8cfd6b1754
56 changed files with 0 additions and 171 deletions
-2
View File
@@ -785,7 +785,6 @@ class Blender(bonsai.core.tool.Blender):
to False, which will make datablock deletion significantly faster to False, which will make datablock deletion significantly faster
by avoiding unnecessary Blender data checks. by avoiding unnecessary Blender data checks.
:return: None :return: None
:rtype: None
""" """
collection_name = repr(data_block).split(".", 2)[-1].split("[", 1)[0] collection_name = repr(data_block).split(".", 2)[-1].split("[", 1)[0]
getattr(bpy.data, collection_name).remove( getattr(bpy.data, collection_name).remove(
@@ -799,7 +798,6 @@ class Blender(bonsai.core.tool.Blender):
:param data_blocks: iterable of data blocks to remove :param data_blocks: iterable of data blocks to remove
:param remove_unused_data: set to True to purge data that would be orphaned by the operation :param remove_unused_data: set to True to purge data that would be orphaned by the operation
:return: None :return: None
:rtype: None
""" """
data_blocks = list(data_blocks) data_blocks = list(data_blocks)
if remove_unused_data: if remove_unused_data:
-2
View File
@@ -121,7 +121,6 @@ class Qto(bonsai.core.tool.Qto):
"""_summary_: Returns the related cost item and related quantities of the product """_summary_: Returns the related cost item and related quantities of the product
:param ifc-instance product: ifc instance :param ifc-instance product: ifc instance
:type product: ifcopenshell.entity_instance.entity_instance
:return list of dictionaries in the form [ :return list of dictionaries in the form [
{ {
@@ -132,7 +131,6 @@ class Qto(bonsai.core.tool.Qto):
"quantity_value" : XX, "quantity_value" : XX,
"quantity_type" : XX "quantity_type" : XX
}] }]
:rtype: list
Example: Example:
@@ -38,9 +38,7 @@ def unassign_object(file: ifcopenshell.file, products: list[ifcopenshell.entity_
:param products: The list of parts of the aggregate, typically of IfcElements or :param products: The list of parts of the aggregate, typically of IfcElements or
IfcSpatialStructureElement subclass IfcSpatialStructureElement subclass
:type product: list[ifcopenshell.entity_instance]
:return: None :return: None
:rtype: None
Example: Example:
@@ -63,7 +63,6 @@ def assign_connection_geometry(
:param unit_scale: The unit scale as calculated by :param unit_scale: The unit scale as calculated by
ifcopenshell.util.unit.calculate_unit_scale. If not provided, it ifcopenshell.util.unit.calculate_unit_scale. If not provided, it
will be automatically calculated for you. will be automatically calculated for you.
:type unit_scale: float, optional
:return: None :return: None
Example: Example:
@@ -33,25 +33,17 @@ def edit_attributes(
manual assignment of the space boundary attributes. manual assignment of the space boundary attributes.
:param entity: The IfcRelSpaceBoundary to modify :param entity: The IfcRelSpaceBoundary to modify
:type entity: ifcopenshell.entity_instance
:param relating_space: The IfcSpace or IfcExternalSpatialElement that :param relating_space: The IfcSpace or IfcExternalSpatialElement that
the space boundary is related to. the space boundary is related to.
:type relating_space: ifcopenshell.entity_instance
:param related_building_element: The IfcElement that defines the :param related_building_element: The IfcElement that defines the
boundary, typically an IfcWall. boundary, typically an IfcWall.
:type relating_space: ifcopenshell.entity_instance
:param parent_boundary: A parent IfcRelSpaceBoundary, only provided if :param parent_boundary: A parent IfcRelSpaceBoundary, only provided if
this is an inner boundary. This can apply to 1st and 2nd level this is an inner boundary. This can apply to 1st and 2nd level
boundaries. boundaries.
:type parent_boundary: ifcopenshell.entity_instance,
optional
:param corresponding_boundary: The other IfcRelSpaceBoundary on the :param corresponding_boundary: The other IfcRelSpaceBoundary on the
other side of the related element. The pair together represents a other side of the related element. The pair together represents a
thermal boundary. This only applies to 2nd level boundaries. thermal boundary. This only applies to 2nd level boundaries.
:type corresponding_boundary: ifcopenshell.entity_instance,
optional
:return: None :return: None
:rtype: None
""" """
entity = entity entity = entity
relating_space = relating_space relating_space = relating_space
@@ -29,9 +29,7 @@ def remove_constraint(file: ifcopenshell.file, constraint: ifcopenshell.entity_i
unclear. unclear.
:param constraint: The IfcObjective you want to remove. :param constraint: The IfcObjective you want to remove.
:type constraint: ifcopenshell.entity_instance
:return: None :return: None
:rtype: None
Example: Example:
@@ -26,9 +26,7 @@ def remove_metric(file: ifcopenshell.file, metric: ifcopenshell.entity_instance)
and objectives. and objectives.
:param metric: The IfcMetric you want to remove. :param metric: The IfcMetric you want to remove.
:type metric: ifcopenshell.entity_instance
:return: None :return: None
:rtype: None
Example: Example:
@@ -98,26 +98,21 @@ def add_context(
:param context_type: The type of the context, must be one of "Model" or :param context_type: The type of the context, must be one of "Model" or
"Plan" only. "Plan" only.
:type context_type: str, optional
:param context_identifier: The identifier of the context, chosen from :param context_identifier: The identifier of the context, chosen from
one of the common identifiers above or consult the IFC documentation one of the common identifiers above or consult the IFC documentation
(under the IfcShapeRepresentation page) for more details. Optional (under the IfcShapeRepresentation page) for more details. Optional
for contexts, but mandatory for subcontexts. for contexts, but mandatory for subcontexts.
:type context_identifier: str, optional
:param target_view: the target view of the context, chosen from one of :param target_view: the target view of the context, chosen from one of
the common target views above or consult the IFC documentation the common target views above or consult the IFC documentation
(under the IfcShapeRepresentation page) for more details. Optional (under the IfcShapeRepresentation page) for more details. Optional
for contexts, but mandatory for subcontexts. for contexts, but mandatory for subcontexts.
:param target_scale: It defines the intended scale at which the representation :param target_scale: It defines the intended scale at which the representation
is designed to be viewed or printed is designed to be viewed or printed
:type target_scale: float, optional
:param parent: the parent context. Must be left as None (the default) :param parent: the parent context. Must be left as None (the default)
for contexts, and only set for subcontexts. Note that there are only for contexts, and only set for subcontexts. Note that there are only
contexts and subcontexts, a subcontext cannot have any children. contexts and subcontexts, a subcontext cannot have any children.
:type parent: ifcopenshell.entity_instance, optional
:return: the newly created IfcGeometricRepresentationContext or :return: the newly created IfcGeometricRepresentationContext or
IfcGeometricRepresentationSubContext entity IfcGeometricRepresentationSubContext entity
:rtype: ifcopenshell.entity_instance
Example: Example:
@@ -38,13 +38,10 @@ def add_cost_item(
:param cost_schedule: If the cost item is to be added as a root or top :param cost_schedule: If the cost item is to be added as a root or top
level cost item to a cost schedule, the IfcCostSchedule may be level cost item to a cost schedule, the IfcCostSchedule may be
specified. This is mutually exlclusive to the cost_item parameter. specified. This is mutually exlclusive to the cost_item parameter.
:type cost_schedule: ifcopenshell.entity_instance, optional.
:param cost_item: If the cost item is to be added as a subitem to an :param cost_item: If the cost item is to be added as a subitem to an
existing cost item, the parent IfcCostItem may be specified. This is existing cost item, the parent IfcCostItem may be specified. This is
mutually exclusive to the cost_schedule parameter. mutually exclusive to the cost_schedule parameter.
:type cost_item: ifcopenshell.entity_instance, optional
:return: The newly created IfcCostItem :return: The newly created IfcCostItem
:rtype: ifcopenshell.entity_instance
Example: Example:
@@ -40,9 +40,7 @@ def calculate_cost_item_resource_value(file: ifcopenshell.file, cost_item: ifcop
previously existing values are removed. previously existing values are removed.
:param cost_item: The IfcCostItem to calculate :param cost_item: The IfcCostItem to calculate
:type cost_item: ifccopenshell.entity_instance.entity_instance
:return: None :return: None
:rtype: None
Example: Example:
@@ -34,11 +34,8 @@ def edit_cost_value_formula(file: ifcopenshell.file, cost_value: ifcopenshell.en
For more information, see ifcopenshell.util.cost For more information, see ifcopenshell.util.cost
:param cost_value: The IfcCostValue to set the values of :param cost_value: The IfcCostValue to set the values of
:type cost_value: ifcopenshell.entity_instance
:param formula: The formula following the language of ifcopenshell.util.cost :param formula: The formula following the language of ifcopenshell.util.cost
:type formula: str
:return: None :return: None
:rtype: None
Example: Example:
@@ -28,9 +28,7 @@ def remove_cost_schedule(file: ifcopenshell.file, cost_schedule: ifcopenshell.en
including all cost items. including all cost items.
:param cost_schedule: The IfcCostSchedule entity you want to remove :param cost_schedule: The IfcCostSchedule entity you want to remove
:type cost_schedule: ifcopenshell.entity_instance
:return: None :return: None
:rtype: None
Example: Example:
@@ -37,9 +37,7 @@ def add_information(
is considered the latest version and the children are older revisions. is considered the latest version and the children are older revisions.
:param parent: The parent document, if necessary. :param parent: The parent document, if necessary.
:type parent: ifcopenshell.entity_instance, optional
:return: The newly created IfcDocumentInformation entity :return: The newly created IfcDocumentInformation entity
:rtype: ifcopenshell.entity_instance
Example: Example:
@@ -28,9 +28,7 @@ def remove_information(file: ifcopenshell.file, information: ifcopenshell.entity
All references and associations are also removed. All references and associations are also removed.
:param information: The IfcDocumentInformation to remove :param information: The IfcDocumentInformation to remove
:type information: ifcopenshell.entity_instance
:return: None :return: None
:rtype: None
Example: Example:
@@ -26,9 +26,7 @@ def remove_reference(file: ifcopenshell.file, reference: ifcopenshell.entity_ins
All associations with objects are removed. All associations with objects are removed.
:param reference: The IfcDocumentReference to remove :param reference: The IfcDocumentReference to remove
:type reference: ifcopenshell.entity_instance
:return: None :return: None
:rtype: None
Example: Example:
@@ -57,11 +57,8 @@ def add_feature(
booleaned or be part of the shape of the object). booleaned or be part of the shape of the object).
:param feature: The IfcFeatureElement to affect the element. :param feature: The IfcFeatureElement to affect the element.
:type feature: ifcopenshell.entity_instance
:param element: The IfcElement to add the feature to. :param element: The IfcElement to add the feature to.
:type element: ifcopenshell.entity_instance
:return: The new IfcRelVoidsElement relationship :return: The new IfcRelVoidsElement relationship
:rtype: ifcopenshell.entity_instance
Example: Example:
@@ -28,9 +28,7 @@ def remove_group(file: ifcopenshell.file, group: ifcopenshell.entity_instance) -
the group will be removed. the group will be removed.
:param group: The IfcGroup entity you want to remove :param group: The IfcGroup entity you want to remove
:type group: ifcopenshell.entity_instance
:return: None :return: None
:rtype: None
Example: Example:
@@ -29,11 +29,8 @@ def unassign_group(
If the product isn't assigned to the group, nothing will happen. If the product isn't assigned to the group, nothing will happen.
:param products: A list of IfcProduct elements to unassign from the group :param products: A list of IfcProduct elements to unassign from the group
:type products: list[ifcopenshell.entity_instance]
:param group: The IfcGroup to unassign from :param group: The IfcGroup to unassign from
:type group: ifcopenshell.entity_instance
:return: None :return: None
:rtype: None
Example: Example:
@@ -31,11 +31,8 @@ def update_group_products(
removed. removed.
:param products: A list of IfcProduct elements to assign to the group :param products: A list of IfcProduct elements to assign to the group
:type products: list[ifcopenshell.entity_instance]
:param group: The IfcGroup to assign the products to :param group: The IfcGroup to assign the products to
:type group: ifcopenshell.entity_instance
:return: The IfcRelAssignsToGroup relationship :return: The IfcRelAssignsToGroup relationship
:rtype: ifcopenshell.entity_instance
Example: Example:
@@ -50,9 +50,7 @@ def add_library(file: ifcopenshell.file, name: str) -> ifcopenshell.entity_insta
to a particular table and row within that database. to a particular table and row within that database.
:param name: The name of the library :param name: The name of the library
:type name: str
:return: The newly created IfcLibraryInformation :return: The newly created IfcLibraryInformation
:rtype: ifcopenshell.entity_instance
Example: Example:
@@ -35,9 +35,7 @@ def add_reference(file: ifcopenshell.file, library: ifcopenshell.entity_instance
library's references. library's references.
:param library: The IfcLibraryInformation element to add a reference to :param library: The IfcLibraryInformation element to add a reference to
:type library: ifcopenshell.entity_instance
:return: The newly created IfcLibraryReference element :return: The newly created IfcLibraryReference element
:rtype: ifcopenshell.entity_instance
Example: Example:
@@ -27,9 +27,7 @@ def remove_library(file: ifcopenshell.file, library: ifcopenshell.entity_instanc
products which have relationships to this library will not be removed. products which have relationships to this library will not be removed.
:param library: The IfcLibraryInformation entity you want to remove :param library: The IfcLibraryInformation entity you want to remove
:type library: ifcopenshell.entity_instance
:return: None :return: None
:rtype: None
Example: Example:
@@ -27,9 +27,7 @@ def remove_reference(file: ifcopenshell.file, reference: ifcopenshell.entity_ins
removed. removed.
:param reference: The IfcLibraryReference entity you want to remove :param reference: The IfcLibraryReference entity you want to remove
:type reference: ifcopenshell.entity_instance
:return: None :return: None
:rtype: None
Example: Example:
@@ -31,11 +31,8 @@ def assign_profile(
:param material_profile: The IfcMaterialProfile to change the profile :param material_profile: The IfcMaterialProfile to change the profile
curve of. See ifcopenshell.api.material.add_profile to see how to curve of. See ifcopenshell.api.material.add_profile to see how to
create profiles. create profiles.
:type material_profile: ifcopenshell.entity_instance
:param profile: The IfcProfileDef to set the profile item's curve to. :param profile: The IfcProfileDef to set the profile item's curve to.
:type profile: ifcopenshell.entity_instance
:return: None :return: None
:rtype: None
Example: Example:
@@ -29,12 +29,9 @@ def remove_list_item(
:param material_list: The IfcMaterialList entity you want to remove an :param material_list: The IfcMaterialList entity you want to remove an
item from. item from.
:type material_list: ifcopenshell.entity_instance
:param material_index: The index of the material you want to remove from :param material_index: The index of the material you want to remove from
the list. Starts counting at 0. Defaults to 0. the list. Starts counting at 0. Defaults to 0.
:type material_index: int, optional
:return: None :return: None
:rtype: None
Example: Example:
@@ -28,15 +28,11 @@ def reorder_set_item(
:param material_set: The IfcMaterialSet which you want to reorder an :param material_set: The IfcMaterialSet which you want to reorder an
item in. item in.
:type material_set: ifcopenshell.entity_instance
:param old_index: The index of the item you want to move. This starts :param old_index: The index of the item you want to move. This starts
counting from 0. counting from 0.
:type old_index: int
:param new_index: The index of the new position the item will move to. :param new_index: The index of the new position the item will move to.
This starts counting from 0. This starts counting from 0.
:type new_index: int
:return: None :return: None
:rtype: None
Example: Example:
@@ -79,13 +79,10 @@ def assign_object(
:param related_objects: The list of children of the nesting relationship, :param related_objects: The list of children of the nesting relationship,
typically IfcElements. typically IfcElements.
:type related_objects: list[ifcopenshell.entity_instance]
:param relating_object: The host parent of the nesting relationship, :param relating_object: The host parent of the nesting relationship,
typically an IfcElement. typically an IfcElement.
:type relating_object: ifcopenshell.entity_instance
:return: The IfcRelNests relationship instance :return: The IfcRelNests relationship instance
or `None` if `related_objects` was empty list. or `None` if `related_objects` was empty list.
:rtype: Union[ifcopenshell.entity_instance, None]
Example: Example:
@@ -31,9 +31,7 @@ def unassign_object(file: ifcopenshell.file, related_objects: list[ifcopenshell.
:param related_objects: The list of children of the nesting relationship, :param related_objects: The list of children of the nesting relationship,
typically IfcElements. typically IfcElements.
:type related_objects: list[ifcopenshell.entity_instance]
:return: None :return: None
:rtype: None
Example: Example:
@@ -33,12 +33,9 @@ def add_role(
:param assigned_object: The IfcPerson or IfcOrganization the role should :param assigned_object: The IfcPerson or IfcOrganization the role should
be assigned to. be assigned to.
:type assigned_object: ifcopenshell.entity_instance
:param role: The type of role, taken from the IFC documentation for :param role: The type of role, taken from the IFC documentation for
IfcActorRole, or a custom name. Defaults to "ARCHITECT". IfcActorRole, or a custom name. Defaults to "ARCHITECT".
:type role: str, optional
:return: The newly created IfcActorRole :return: The newly created IfcActorRole
:rtype: ifcopenshell.entity_instance
Example: Example:
@@ -61,7 +61,6 @@ def create_owner_history(file: ifcopenshell.file) -> Union[ifcopenshell.entity_i
:return: The newly created IfcOwnerHistory element or `None` if it's :return: The newly created IfcOwnerHistory element or `None` if it's
not IFC2X3 and user or application is not found in the current project. not IFC2X3 and user or application is not found in the current project.
:rtype: Union[ifcopenshell.entity_instance, None]
Example: Example:
@@ -35,9 +35,7 @@ def update_owner_history(
:param element: The IfcRoot element to update the ownership details on :param element: The IfcRoot element to update the ownership details on
when a change is made. when a change is made.
:type element: ifcopenshell.entity_instance
:return: The updated IfcOwnerHistory element. :return: The updated IfcOwnerHistory element.
:rtype: ifcopenshell.entity_instance
Example: Example:
@@ -42,13 +42,10 @@ def assign_declaration(
a declaration lets you say that an object belongs to a library. a declaration lets you say that an object belongs to a library.
:param definitions: The list of objects you want to declare. Typically a list of assets. :param definitions: The list of objects you want to declare. Typically a list of assets.
:type definitions: list[ifcopenshell.entity_instance]
:param relating_context: The IfcProject, or more commonly the :param relating_context: The IfcProject, or more commonly the
IfcProjectLibrary that you want the object to be part of. IfcProjectLibrary that you want the object to be part of.
:type relating_context: ifcopenshell.entity_instance
:return: The new IfcRelDeclares relationship or None if all definitions :return: The new IfcRelDeclares relationship or None if all definitions
were already declared / do not support declaration. were already declared / do not support declaration.
:rtype: Union[ifcopenshell.entity_instance, None]
Example: Example:
@@ -32,12 +32,9 @@ def unassign_declaration(
:param definitions: The list of objects you want to undeclare. :param definitions: The list of objects you want to undeclare.
Typically a list of assets. Typically a list of assets.
:type definitions: list[ifcopenshell.entity_instance]
:param relating_context: The IfcProject, or more commonly the :param relating_context: The IfcProject, or more commonly the
IfcProjectLibrary that you want the object to no longer be part of. IfcProjectLibrary that you want the object to no longer be part of.
:type relating_context: ifcopenshell.entity_instance
:return: None :return: None
:rtype: None
Example: Example:
@@ -50,15 +50,12 @@ def add_qto(file: ifcopenshell.file, product: ifcopenshell.entity_instance, name
metadata, rather than quantification data. metadata, rather than quantification data.
:param product: The IfcObject that you want to assign a quantity set to. :param product: The IfcObject that you want to assign a quantity set to.
:type product: ifcopenshell.entity_instance
:param name: The name of the quantity set. Quantity sets that are :param name: The name of the quantity set. Quantity sets that are
standardised by buildingSMART typically have a prefix of "Qto_", standardised by buildingSMART typically have a prefix of "Qto_",
like "Qto_WallBaseQuantities". If you create your own, you must not like "Qto_WallBaseQuantities". If you create your own, you must not
use that prefix. It is recommended to use your own prefix tailored use that prefix. It is recommended to use your own prefix tailored
to your project, company, or local government requirement. to your project, company, or local government requirement.
:type name: str
:return: The newly created IfcElementQuantity :return: The newly created IfcElementQuantity
:rtype: ifcopenshell.entity_instance
Example: Example:
@@ -60,10 +60,8 @@ def edit_pset(
to ensure that data types are always consistent and correct. to ensure that data types are always consistent and correct.
:param pset: The IfcPropertySet to edit. :param pset: The IfcPropertySet to edit.
:type pset: ifcopenshell.entity_instance
:param name: A new name for the property set. If no name is specified, :param name: A new name for the property set. If no name is specified,
the property set name is not changed. the property set name is not changed.
:type name: str, optional
:param properties: A dictionary of properties. The keys must be a string :param properties: A dictionary of properties. The keys must be a string
of the name of the property. The data type of the value will be of the name of the property. The data type of the value will be
determined by the property set template. If no property set determined by the property set template. If no property set
@@ -73,18 +71,14 @@ def edit_pset(
become IfcBoolean, and integers will become IfcInteger. If more become IfcBoolean, and integers will become IfcInteger. If more
control is desired, you may explicitly specify IFC data objects control is desired, you may explicitly specify IFC data objects
directly. Note that provided `properties` might be mutated in the process. directly. Note that provided `properties` might be mutated in the process.
:type properties: dict
:param pset_template: If a property set template is provided, this will :param pset_template: If a property set template is provided, this will
be used to determine data types. If no user-defined template is be used to determine data types. If no user-defined template is
provided, the built-in buildingSMART templates will be loaded. provided, the built-in buildingSMART templates will be loaded.
:type pset_template: ifcopenshell.entity_instance, optional
:param should_purge: If set as False, properties set to None will be :param should_purge: If set as False, properties set to None will be
left as None but not removed. If set to true, properties set to None left as None but not removed. If set to true, properties set to None
will actually be removed. The default of true is the same behaviour as will actually be removed. The default of true is the same behaviour as
:func:`ifcopenshell.api.pset.edit_qto`. :func:`ifcopenshell.api.pset.edit_qto`.
:type should_purge: bool, optional
:return: None :return: None
:rtype: None
Example: Example:
@@ -73,7 +73,6 @@ def edit_qto(
:param pset_template: If a quantity set template is provided, this will :param pset_template: If a quantity set template is provided, this will
be used to determine data types. If no user-defined template is be used to determine data types. If no user-defined template is
provided, the built-in buildingSMART templates will be loaded. provided, the built-in buildingSMART templates will be loaded.
:type pset_template: ifcopenshell.entity_instance, optional
:return: None :return: None
Example: Example:
@@ -28,9 +28,7 @@ def add_resource_time(file: ifcopenshell.file, resource: ifcopenshell.entity_ins
be used to calculate other parameters like resource utilisation. be used to calculate other parameters like resource utilisation.
:param resource: The IfcConstructionResource to record time for. :param resource: The IfcConstructionResource to record time for.
:type resource: ifcopenshell.entity_instance
:return: The newly created IfcResourceTime :return: The newly created IfcResourceTime
:rtype: ifcopenshell.entity_instance
Example: Example:
@@ -51,9 +51,7 @@ def calculate_resource_work(file: ifcopenshell.file, resource: ifcopenshell.enti
:param resource: The IfcConstructionResource that you want to calculate :param resource: The IfcConstructionResource that you want to calculate
the work performed. the work performed.
:type resource: ifcopenshell.entity_instance
:return None: :return None:
:rtype: None:
""" """
if ifcopenshell.util.constraint.is_attribute_locked(resource, "Usage.ScheduleWork"): if ifcopenshell.util.constraint.is_attribute_locked(resource, "Usage.ScheduleWork"):
return return
@@ -48,9 +48,7 @@ def remove_product(file: ifcopenshell.file, product: ifcopenshell.entity_instanc
naturally, the materials, types, containers, etc themselves remain). naturally, the materials, types, containers, etc themselves remain).
:param product: The element to remove. :param product: The element to remove.
:type product: ifcopenshell.entity_instance
:return: None :return: None
:rtype: None
Example: Example:
@@ -40,22 +40,17 @@ def add_work_schedule(
either for maintenance or for construction scheduling. either for maintenance or for construction scheduling.
:param name: The name of the work schedule. :param name: The name of the work schedule.
:type name: str
:param predefined_type: The type of schedule, chosen from ACTUAL, :param predefined_type: The type of schedule, chosen from ACTUAL,
BASELINE, and PLANNED. Typically you would start with PLANNED, then BASELINE, and PLANNED. Typically you would start with PLANNED, then
convert to a BASELINE when changes are made with separate schedules, convert to a BASELINE when changes are made with separate schedules,
then have a parallel ACTUAL schedule. then have a parallel ACTUAL schedule.
:type predefined_type: str
:param start_time: The earlier start time when the schedule is relevant. :param start_time: The earlier start time when the schedule is relevant.
May be represented with an ISO standard string. May be represented with an ISO standard string.
:type start_time: str,datetime.time,optional
:param work_plan: The IfcWorkPlan the schedule will be part of. If not :param work_plan: The IfcWorkPlan the schedule will be part of. If not
provided, the schedule will not be grouped in a work plan and would provided, the schedule will not be grouped in a work plan and would
exist as a top level schedule in the project. This is not exist as a top level schedule in the project. This is not
recommended. recommended.
:type work_plan: ifcopenshell.entity_instance,optional
:return: The newly created IfcWorkSchedule :return: The newly created IfcWorkSchedule
:rtype: ifcopenshell.entity_instance
Example: Example:
@@ -29,9 +29,7 @@ def remove_work_schedule(file: ifcopenshell.file, work_schedule: ifcopenshell.en
All tasks in the work schedule are also removed recursively. All tasks in the work schedule are also removed recursively.
:param work_schedule: The IfcWorkSchedule to remove. :param work_schedule: The IfcWorkSchedule to remove.
:type work_schedule: ifcopenshell.entity_instance
:return: None :return: None
:rtype: None
Example: Example:
@@ -23,9 +23,7 @@ def remove_work_time(file: ifcopenshell.file, work_time: ifcopenshell.entity_ins
"""Removes a work time """Removes a work time
:param work_time: The IfcWorkTime to remove. :param work_time: The IfcWorkTime to remove.
:type work_time: ifcopenshell.entity_instance
:return: None :return: None
:rtype: None
Example: Example:
@@ -30,7 +30,6 @@ def add_structural_analysis_model(file: ifcopenshell.file) -> ifcopenshell.entit
A 3D analytical model is assumed. A 3D analytical model is assumed.
:return: The newly created IfcStructuralAnalysisModel :return: The newly created IfcStructuralAnalysisModel
:rtype: ifcopenshell.entity_instance
Example: Example:
@@ -30,13 +30,10 @@ def add_structural_load(
may be defined as a configuration of multiple loads. may be defined as a configuration of multiple loads.
:param name: The name of the load :param name: The name of the load
:type name: str,optional
:param ifc_class: The subtype of IfcStructuralLoad to create. Consult :param ifc_class: The subtype of IfcStructuralLoad to create. Consult
the IFC documentation to see all the types of loads. the IFC documentation to see all the types of loads.
:type ifc_class: str
:return: The newly created load entity, depending on the ifc_class :return: The newly created load entity, depending on the ifc_class
specified. specified.
:rtype: ifcopenshell.entity_instance
Example: Example:
@@ -25,16 +25,12 @@ def add_structural_load_case(
"""Adds a new load case, which is a collection of related load groups """Adds a new load case, which is a collection of related load groups
:param name: The name of the load case :param name: The name of the load case
:type name: str
:param action_type: Choose from EXTRAORDINARY_A, PERMANENT_G, :param action_type: Choose from EXTRAORDINARY_A, PERMANENT_G,
or VARIABLE_Q, taken from the Eurocode standard. or VARIABLE_Q, taken from the Eurocode standard.
:type action_type: str
:param action_source: The source of the load case, such as DEAD_LOAD_G, :param action_source: The source of the load case, such as DEAD_LOAD_G,
LIVE_LOAD_Q, TRANSPORT, ICE, etc. For the full list consult LIVE_LOAD_Q, TRANSPORT, ICE, etc. For the full list consult
IfcActionSourceTypeEnum in the IFC documentation. IfcActionSourceTypeEnum in the IFC documentation.
:type action_source: str
:return: The new IfcStructuralLoadCase :return: The new IfcStructuralLoadCase
:rtype: ifcopenshell.entity_instance
""" """
load_case = ifcopenshell.api.root.create_entity( load_case = ifcopenshell.api.root.create_entity(
@@ -25,16 +25,12 @@ def add_structural_load_group(
"""Adds a new load group, which is a collection of related loads """Adds a new load group, which is a collection of related loads
:param name: The name of the load group :param name: The name of the load group
:type name: str
:param action_type: Choose from EXTRAORDINARY_A, PERMANENT_G, :param action_type: Choose from EXTRAORDINARY_A, PERMANENT_G,
or VARIABLE_Q, taken from the Eurocode standard. or VARIABLE_Q, taken from the Eurocode standard.
:type action_type: str
:param action_source: The source of the load case, such as DEAD_LOAD_G, :param action_source: The source of the load case, such as DEAD_LOAD_G,
LIVE_LOAD_Q, TRANSPORT, ICE, etc. For the full list consult LIVE_LOAD_Q, TRANSPORT, ICE, etc. For the full list consult
IfcActionSourceTypeEnum in the IFC documentation. IfcActionSourceTypeEnum in the IFC documentation.
:type action_source: str
:return: The new IfcStructuralLoadCase :return: The new IfcStructuralLoadCase
:rtype: ifcopenshell.entity_instance
""" """
load_group = ifcopenshell.api.root.create_entity( load_group = ifcopenshell.api.root.create_entity(
@@ -43,13 +43,10 @@ def add_style(
:param name: The name of the style. Used to easily identify it using a :param name: The name of the style. Used to easily identify it using a
style library. style library.
:type name: str,optional
:param ifc_class: Choose from IfcSurfaceStyle, IfcCurveStyle, :param ifc_class: Choose from IfcSurfaceStyle, IfcCurveStyle,
IfcFillAreaStyle, or IfcTextStyle. IfcFillAreaStyle, or IfcTextStyle.
:type ifc_class: str
:return: The newly created style element, based on the provided :return: The newly created style element, based on the provided
ifc_class. ifc_class.
:rtype: ifcopenshell.entity_instance
Example: Example:
@@ -37,11 +37,9 @@ def add_surface_textures(
:param material: The Blender material definition with a node tree that :param material: The Blender material definition with a node tree that
is compatible with glTF. See one of the valid combinations here: is compatible with glTF. See one of the valid combinations here:
https://docs.blender.org/manual/en/dev/addons/import_export/scene_gltf2.html https://docs.blender.org/manual/en/dev/addons/import_export/scene_gltf2.html
:type material: bpy.types.Material, optional
:param uv_maps: A list of IfcIndexedTextureMap for any :param uv_maps: A list of IfcIndexedTextureMap for any
IfcTessellatedFaceSets that the representation has, obtained from IfcTessellatedFaceSets that the representation has, obtained from
the HasTextures attribute. the HasTextures attribute.
:type uv_maps: list[ifcopenshell.entity_instance]
:param textures: A list of dictionaries containing: :param textures: A list of dictionaries containing:
1. Attributes to create IfcImageTexture. 1. Attributes to create IfcImageTexture.
@@ -55,9 +53,7 @@ def add_surface_textures(
based on geometry); based on geometry);
* `Camera` - IfcTextureCoordinateGenerator with mode COORD_EYE (autogenerated UV * `Camera` - IfcTextureCoordinateGenerator with mode COORD_EYE (autogenerated UV
based on camera position) based on camera position)
:type textures: list[dict], optional
:return: A list of IfcImageTexture :return: A list of IfcImageTexture
:rtype: list[ifcopenshell.entity_instance]
""" """
usecase = Usecase() usecase = Usecase()
# TODO: This usecase currently depends on Blender's data model # TODO: This usecase currently depends on Blender's data model
@@ -38,22 +38,17 @@ def assign_material_style(
to materials. This API function provides that capability. to materials. This API function provides that capability.
:param material: The IfcMaterial which you want to assign the style to. :param material: The IfcMaterial which you want to assign the style to.
:type material: ifcopenshell.entity_instance
:param style: The IfcPresentationStyle (typically IfcSurfaceStyle) that :param style: The IfcPresentationStyle (typically IfcSurfaceStyle) that
you want to assign to the material. This will then be applied to all you want to assign to the material. This will then be applied to all
objects that have that material. objects that have that material.
:type style: ifcopenshell.entity_instance
:param context: The IfcGeometricRepresentationSubContext at which this :param context: The IfcGeometricRepresentationSubContext at which this
style should be used. Typically this is the Model BODY context. style should be used. Typically this is the Model BODY context.
:type context: ifcopenshell.entity_instance
:param should_use_presentation_style_assignment: This is a technical :param should_use_presentation_style_assignment: This is a technical
detail to accomodate a bug in Revit. This should always be left as detail to accomodate a bug in Revit. This should always be left as
the default of False, unless you are finding that colours aren't the default of False, unless you are finding that colours aren't
showing up in Revit. In that case, set it to True, but keep in mind showing up in Revit. In that case, set it to True, but keep in mind
that this is no longer a valid IFC. Blame Autodesk. that this is no longer a valid IFC. Blame Autodesk.
:type should_use_presentation_style_assignment: bool
:return: None :return: None
:rtype: None
Example: Example:
@@ -47,23 +47,18 @@ def assign_representation_styles(
:param shape_representation: The IfcShapeRepresentation of the object :param shape_representation: The IfcShapeRepresentation of the object
that you want to assign styles to. This implicitly defines the that you want to assign styles to. This implicitly defines the
context at which the styles should be used. context at which the styles should be used.
:type shape_representation: ifcopenshell.entity_instance
:param styles: A list of presentation styles, typically IfcSurfaceStyle. :param styles: A list of presentation styles, typically IfcSurfaceStyle.
The number of items in the list should correlate with the number of The number of items in the list should correlate with the number of
items in the shape_representation's Items attribute. If you have items in the shape_representation's Items attribute. If you have
more items than styles, the last style is used. more items than styles, the last style is used.
:type styles: list[ifcopenshell.entity_instance]
:param replace_previous_same_type_style: Remove previously assigned styles :param replace_previous_same_type_style: Remove previously assigned styles
of the same type as currently assign style`. Defaults to `True`. of the same type as currently assign style`. Defaults to `True`.
:type replace_previous_same_type_style: bool
:param should_use_presentation_style_assignment: This is a technical :param should_use_presentation_style_assignment: This is a technical
detail to accomodate a bug in Revit. This should always be left as detail to accomodate a bug in Revit. This should always be left as
the default of False, unless you are finding that colours aren't the default of False, unless you are finding that colours aren't
showing up in Revit. In that case, set it to True, but keep in mind showing up in Revit. In that case, set it to True, but keep in mind
that this is no longer a valid IFC. Blame Autodesk. that this is no longer a valid IFC. Blame Autodesk.
:type should_use_presentation_style_assignment: bool
:return: List of created IfcStyledItems :return: List of created IfcStyledItems
:rtype: list[ifcopenshell.entity_instance]
Example: Example:
@@ -33,16 +33,12 @@ def unassign_material_style(
This does the inverse of assign_material_style. This does the inverse of assign_material_style.
:param material: The IfcMaterial which you want to unassign the style from. :param material: The IfcMaterial which you want to unassign the style from.
:type material: ifcopenshell.entity_instance
:param style: The IfcPresentationStyle (typically IfcSurfaceStyle) that :param style: The IfcPresentationStyle (typically IfcSurfaceStyle) that
you want to unassign from material. This will then be applied to all you want to unassign from material. This will then be applied to all
objects that have that material. objects that have that material.
:type style: ifcopenshell.entity_instance
:param context: The IfcGeometricRepresentationSubContext at which this :param context: The IfcGeometricRepresentationSubContext at which this
style should be unassigned. Typically this is the Model BODY context. style should be unassigned. Typically this is the Model BODY context.
:type context: ifcopenshell.entity_instance
:return: None :return: None
:rtype: None
Example: Example:
@@ -31,20 +31,16 @@ def unassign_representation_styles(
:param shape_representation: The IfcShapeRepresentation of the object :param shape_representation: The IfcShapeRepresentation of the object
that you want to unassign styles from. that you want to unassign styles from.
:type shape_representation: ifcopenshell.entity_instance
:param styles: A list of presentation styles, typically IfcSurfaceStyle. :param styles: A list of presentation styles, typically IfcSurfaceStyle.
The number of items in the list should correlate with the number of The number of items in the list should correlate with the number of
items in the shape_representation's Items attribute. If you have items in the shape_representation's Items attribute. If you have
more items than styles, the last style is used. more items than styles, the last style is used.
:type styles: list[ifcopenshell.entity_instance]
:param should_use_presentation_style_assignment: This is a technical :param should_use_presentation_style_assignment: This is a technical
detail to accomodate a bug in Revit. This should always be left as detail to accomodate a bug in Revit. This should always be left as
the default of False, unless you are finding that colours aren't the default of False, unless you are finding that colours aren't
showing up in Revit. In that case, set it to True, but keep in mind showing up in Revit. In that case, set it to True, but keep in mind
that this is no longer a valid IFC. Blame Autodesk. that this is no longer a valid IFC. Blame Autodesk.
:type should_use_presentation_style_assignment: bool
:return: None :return: None
:rtype: None
Example: Example:
@@ -52,9 +52,7 @@ def connect_port(
and implicit connectivity is preferred for early phase design. and implicit connectivity is preferred for early phase design.
:param port1: The port of the first distribution element to connect. :param port1: The port of the first distribution element to connect.
:type port1: ifcopenshell.entity_instance
:param port2: The port of the second distribution element to connect. :param port2: The port of the second distribution element to connect.
:type port2: ifcopenshell.entity_instance
:param direction: The directionality of distribution flow through the :param direction: The directionality of distribution flow through the
port connection. NOTDEFINED means that the direction has not yet port connection. NOTDEFINED means that the direction has not yet
been determined. This is useful during preliminary system design. been determined. This is useful during preliminary system design.
@@ -63,12 +61,10 @@ def connect_port(
first element. SOURCEANDSINK means that flow is bi-directional first element. SOURCEANDSINK means that flow is bi-directional
between the first and second element. SOURCEANDSINK is a relatively between the first and second element. SOURCEANDSINK is a relatively
rare scenario. rare scenario.
:type direction: str
:param element: Optionally set an element through which the port :param element: Optionally set an element through which the port
connectivity is made, such as a segment or fitting. This is only to connectivity is made, such as a segment or fitting. This is only to
be used for implicit port connectivity where the segments and be used for implicit port connectivity where the segments and
fittings are less important. fittings are less important.
:type element: ifcopenshell.entity_instance, optional
Example: Example:
@@ -28,9 +28,7 @@ def disconnect_port(file: ifcopenshell.file, port: ifcopenshell.entity_instance)
needed to be specified. needed to be specified.
:param port: The IfcDistributionPort to disconnect. :param port: The IfcDistributionPort to disconnect.
:type port: ifcopenshell.entity_instance
:return: None :return: None
:rtype: None
Example: Example:
@@ -43,7 +43,6 @@ def add_derived_unit(
:param unit_type: A type of unit chosen from the list above. For :param unit_type: A type of unit chosen from the list above. For
example, choosing THERMALCONDUCTANCEUNIT will give you a Thermal conductance. example, choosing THERMALCONDUCTANCEUNIT will give you a Thermal conductance.
:type unit_type: str
:param userdefinedtype: The user defined type in case of choosing USERDEFINED, or None for no :param userdefinedtype: The user defined type in case of choosing USERDEFINED, or None for no
user defined type. user defined type.
:param attributes: a dictionary of attribute names and values. :param attributes: a dictionary of attribute names and values.
@@ -33,13 +33,9 @@ def a2p(o: Iterable[float], z: Iterable[float], x: Iterable[float]) -> MatrixTyp
provide the Y axis. provide the Y axis.
:param o: The origin (i.e. location) of the matrix :param o: The origin (i.e. location) of the matrix
:type o: iterable[float]
:param z: The +Z vector / axis of the matrix :param z: The +Z vector / axis of the matrix
:type z: iterable[float]
:param x: The +X vector / axis of the matrix :param x: The +X vector / axis of the matrix
:type x: iterable[float]
:return: A 4x4 numpy matrix :return: A 4x4 numpy matrix
:rtype: MatrixType
""" """
x = x / np.linalg.norm(x) x = x / np.linalg.norm(x)
z = z / np.linalg.norm(z) z = z / np.linalg.norm(z)
@@ -60,9 +56,7 @@ def get_axis2placement(placement: ifcopenshell.entity_instance) -> MatrixType:
should use ``get_local_placement`` instead. should use ``get_local_placement`` instead.
:param placement: The IfcLocalPlacement enitity :param placement: The IfcLocalPlacement enitity
:type placement: ifcopenshell.entity_instance
:return: A 4x4 numpy matrix :return: A 4x4 numpy matrix
:rtype: MatrixType
""" """
ifc_class = placement.is_a() ifc_class = placement.is_a()
if ifc_class in ("IfcAxis2Placement3D", "IfcAxis2PlacementLinear"): if ifc_class in ("IfcAxis2Placement3D", "IfcAxis2PlacementLinear"):
@@ -117,9 +111,7 @@ def get_local_placement(placement: Optional[ifcopenshell.entity_instance] = None
matrix = ifcopenshell.util.placement.get_local_placement(placement) matrix = ifcopenshell.util.placement.get_local_placement(placement)
:param placement: The IfcLocalPlacement entity :param placement: The IfcLocalPlacement entity
:type placement: ifcopenshell.entity_instance, optional
:return: A 4x4 numpy matrix :return: A 4x4 numpy matrix
:rtype: MatrixType
""" """
if placement is None: if placement is None:
return np.eye(4) return np.eye(4)
@@ -183,9 +175,7 @@ def get_mappeditem_transformation(item: ifcopenshell.entity_instance) -> MatrixT
transformation matrix. transformation matrix.
:param item: The IfcMappedItem entity :param item: The IfcMappedItem entity
:type item: ifcopenshell.entity_instance
:return: A 4x4 numpy transformation matrix :return: A 4x4 numpy transformation matrix
:rtype: MatrixType
""" """
m4 = get_axis2placement(item.MappingSource.MappingOrigin) m4 = get_axis2placement(item.MappingSource.MappingOrigin)
# TODO 2d # TODO 2d
@@ -200,9 +190,7 @@ def get_storey_elevation(storey: ifcopenshell.entity_instance) -> float:
its placement, or as a fallback the ``Elevation`` attribute. its placement, or as a fallback the ``Elevation`` attribute.
:param storey: The IfcBuildingStorey entity :param storey: The IfcBuildingStorey entity
:type storey: ifcopenshell.entity_instance
:return: The elevation in project units :return: The elevation in project units
:rtype: float
""" """
if storey.ObjectPlacement: if storey.ObjectPlacement:
matrix = get_local_placement(storey.ObjectPlacement) matrix = get_local_placement(storey.ObjectPlacement)
@@ -214,14 +202,10 @@ def rotation(angle: float, axis: Literal["X", "Y", "Z"], is_degrees=True) -> Mat
"""Create a 4x4 numpy matrix representing an euler rotation """Create a 4x4 numpy matrix representing an euler rotation
:param angle: The angle of rotation :param angle: The angle of rotation
:type angle: float
:param axis: The axis to rotate around, either X, Y, or Z. :param axis: The axis to rotate around, either X, Y, or Z.
:type axis: str
:param is_degrees: Whether or not the angle is specified in degrees or :param is_degrees: Whether or not the angle is specified in degrees or
radians. Defaults to true (i.e. degrees). radians. Defaults to true (i.e. degrees).
:type is_degrees: bool
:return: A 4x4 numpy rotation matrix :return: A 4x4 numpy rotation matrix
:rtype: MatrixType
""" """
theta = np.radians(angle) if is_degrees else angle theta = np.radians(angle) if is_degrees else angle
cos, sin = np.cos(theta), np.sin(theta) cos, sin = np.cos(theta), np.sin(theta)