This commit is contained in:
Andrej730
2024-05-22 11:05:42 +05:00
parent f460676e54
commit f2eb08a066
7 changed files with 61 additions and 18 deletions
+2 -2
View File
@@ -212,7 +212,7 @@ class Csv2Ifc:
self.create_cost_items(cost_item["children"], cost_item["ifc"])
def create_unit(self, symbol) -> ifcopenshell.entity_instance:
def create_unit(self, symbol: str) -> ifcopenshell.entity_instance:
unit = self.units.get(symbol, None)
if unit:
return unit
@@ -227,7 +227,7 @@ class Csv2Ifc:
ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject")
def has_property(self, product, property_name) -> bool:
def has_property(self, product: ifcopenshell.entity_instance, property_name: str) -> bool:
if not property_name:
return True
qtos = ifcopenshell.util.element.get_psets(product, qtos_only=True)
+19 -3
View File
@@ -26,13 +26,18 @@ import ifcopenshell
import ifcopenshell.util.element
import ifcopenshell.util.cost
import ifcopenshell.util.date
from typing import Union, Optional
class IfcDataGetter:
@staticmethod
def get_schedules(file, filter_by_schedule=None):
def get_schedules(
file: ifcopenshell.file, filter_by_schedule: Optional[ifcopenshell.entity_instance] = None
) -> list[ifcopenshell.entity_instance]:
return [
schedule for schedule in file.by_type("IfcCostSchedule") if not filter_by_schedule or schedule == filter_by_schedule
schedule
for schedule in file.by_type("IfcCostSchedule")
if not filter_by_schedule or schedule == filter_by_schedule
]
@staticmethod
@@ -195,7 +200,18 @@ class IfcDataGetter:
class Ifc5Dwriter:
def __init__(self, file=None, output=None, cost_schedule=None):
file: ifcopenshell.file
def __init__(
self,
file: Union[str, ifcopenshell.file],
output: str,
cost_schedule: Optional[ifcopenshell.entity_instance] = None,
):
"""
Args:
cost_schedule: exported cost schedule. If not provided, will export all available schedules.
"""
self.output = output
if isinstance(file, str):
self.file = ifcopenshell.open(file)