mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
typing
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user