This commit is contained in:
Andrej730
2024-05-09 14:18:36 +05:00
parent 359dab573b
commit 2d35869c41
57 changed files with 221 additions and 109 deletions
@@ -15,9 +15,15 @@
#
# 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_context_dependent_unit(file, unit_type="USERDEFINED", name="THINGAMAJIG", dimensions=None) -> None:
def add_context_dependent_unit(
file: ifcopenshell.file,
unit_type: str = "USERDEFINED",
name: str = "THINGAMAJIG",
dimensions: tuple[int, int, int, int, int, int, int] = (0, 0, 0, 0, 0, 0, 0),
) -> ifcopenshell.entity_instance:
"""Add a new arbitrary unit that can only be interpreted in a project specific context
Occasionally the construction industry uses arbitrary units to quantify
@@ -51,7 +57,7 @@ def add_context_dependent_unit(file, unit_type="USERDEFINED", name="THINGAMAJIG"
# Boxes of things
ifcopenshell.api.run("unit.add_context_dependent_unit", model, name="BOXES")
"""
settings = {"unit_type": unit_type, "name": name, "dimensions": dimensions or (0, 0, 0, 0, 0, 0, 0)}
settings = {"unit_type": unit_type, "name": name, "dimensions": dimensions}
return file.create_entity(
"IfcContextDependentUnit",
@@ -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 add_monetary_unit(file, currency="DOLLARYDOO") -> None:
def add_monetary_unit(file: ifcopenshell.file, currency: str = "DOLLARYDOO") -> ifcopenshell.entity_instance:
"""Add a new currency
Currency units are useful in cost plans to know in what currency the
@@ -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_derived_unit(file, unit=None, attributes=None) -> None:
def edit_derived_unit(file: ifcopenshell.file, unit: ifcopenshell.entity_instance, attributes: dict[str, Any]) -> None:
"""Edits the attributes of an IfcDerivedUnit
For more information about the attributes and data types of an
@@ -26,7 +28,7 @@ def edit_derived_unit(file, unit=None, attributes=None) -> None:
:param unit: The IfcDerivedUnit entity you want to edit
:type unit: 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,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_monetary_unit(file, unit=None, attributes=None) -> None:
def edit_monetary_unit(file: ifcopenshell.file, unit: ifcopenshell.entity_instance, attributes: dict[str, Any]) -> None:
"""Edits the attributes of an IfcMonetaryUnit
For more information about the attributes and data types of an
@@ -26,7 +28,7 @@ def edit_monetary_unit(file, unit=None, attributes=None) -> None:
:param unit: The IfcMonetaryUnit entity you want to edit
:type unit: 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,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_named_unit(file, unit=None, attributes=None) -> None:
def edit_named_unit(file: ifcopenshell.file, unit: ifcopenshell.entity_instance, attributes: dict[str, Any]) -> None:
"""Edits the attributes of an IfcNamedUnit
Named units include SI units, conversion based units (imperial units),
@@ -29,7 +31,7 @@ def edit_named_unit(file, unit=None, attributes=None) -> None:
:param unit: The IfcNamedUnit entity you want to edit
:type unit: ifcopenshell.entity_instance
:param attributes: a dictionary of attribute names and values.
:type attributes: dict, optional
:type attributes: dict
:return: None
:rtype: None
@@ -20,7 +20,7 @@ import ifcopenshell.util.unit
import ifcopenshell.util.element
def remove_unit(file, unit=None) -> None:
def remove_unit(file: ifcopenshell.file, unit: ifcopenshell.entity_instance) -> None:
"""Remove a unit
Be very careful when a unit is removed, as it may mean that previously