mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-08 08:51:35 +00:00
typing
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -17,10 +17,11 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -15,9 +15,13 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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)
|
||||
|
||||
@@ -15,9 +15,13 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -17,15 +17,16 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -15,9 +15,11 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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)
|
||||
|
||||
@@ -15,9 +15,13 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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():
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -17,11 +17,13 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -15,9 +15,12 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -17,11 +17,18 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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
|
||||
|
||||
@@ -17,18 +17,21 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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
|
||||
|
||||
@@ -15,9 +15,12 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -15,9 +15,12 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -17,12 +17,17 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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():
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -15,9 +15,11 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
|
||||
@@ -15,9 +15,13 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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)
|
||||
|
||||
@@ -17,9 +17,12 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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:
|
||||
|
||||
@@ -17,9 +17,12 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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:
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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"):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -17,10 +17,11 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -17,15 +17,16 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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
|
||||
|
||||
|
||||
+1
-3
@@ -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"
|
||||
)
|
||||
|
||||
+11
-2
@@ -15,9 +15,16 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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"])
|
||||
|
||||
@@ -17,9 +17,12 @@
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+6
-2
@@ -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"]
|
||||
|
||||
+6
-1
@@ -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
|
||||
|
||||
+6
-2
@@ -15,9 +15,13 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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
|
||||
"""
|
||||
|
||||
+7
-3
@@ -15,9 +15,13 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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":
|
||||
|
||||
+13
-7
@@ -15,26 +15,32 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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:
|
||||
|
||||
@@ -15,20 +15,25 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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)
|
||||
|
||||
@@ -15,9 +15,13 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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
|
||||
"""
|
||||
|
||||
@@ -15,9 +15,13 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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
|
||||
"""
|
||||
|
||||
+3
-1
@@ -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.
|
||||
|
||||
+8
-2
@@ -15,16 +15,22 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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
|
||||
"""
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
+5
-1
@@ -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.
|
||||
|
||||
@@ -15,9 +15,13 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -15,18 +15,29 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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]
|
||||
"""
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -15,15 +15,16 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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:
|
||||
|
||||
|
||||
@@ -15,9 +15,13 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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
|
||||
|
||||
|
||||
@@ -15,9 +15,13 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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
|
||||
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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.
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -15,10 +15,14 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
|
||||
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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user