This commit is contained in:
Andrej730
2024-04-12 10:42:15 +05:00
parent e56aa45a82
commit 59b496d4b5
10 changed files with 31 additions and 16 deletions
@@ -20,10 +20,11 @@ import ifcopenshell
import ifcopenshell.api
import ifcopenshell.util.selector
from typing import Union
from logging import Logger
class Patcher:
def __init__(self, src, file, logger, query: str = "IfcWall"):
def __init__(self, src: str, file: ifcopenshell.file, logger: Logger, query: str = "IfcWall"):
"""Extract certain elements into a new model
Extract a subset of elements from an existing IFC data set and save it
@@ -19,10 +19,11 @@
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.util.element
from logging import Logger
class Patcher:
def __init__(self, src, file, logger, attribute="Tag"):
def __init__(self, src: str, file: ifcopenshell.file, logger: Logger, attribute: str = "Tag"):
"""Merge duplicate element types via the Tag or another attribute
Revit is notorious for creating many duplicate element types. Element
@@ -78,7 +79,9 @@ class Patcher:
else:
keys[getattr(element_type, key)] = element_type
def assign_type(self, related_object, relating_type):
def assign_type(
self, related_object: ifcopenshell.entity_instance, relating_type: ifcopenshell.entity_instance
) -> None:
# This is basically a portion of the type.assign_type API which only
# affects the IfcRelDefinesByType relationship. To be conservative, we
# don't use the API directly since that would do other things like