This commit is contained in:
Andrej730
2024-09-23 19:33:16 +05:00
parent a51ed6e6b3
commit 65f9a745a3
4 changed files with 14 additions and 7 deletions
+3 -1
View File
@@ -121,7 +121,9 @@ class BIMRootProperties(PropertyGroup):
ifc_class: EnumProperty(items=get_ifc_classes, name="Class", update=refresh_predefined_types) ifc_class: EnumProperty(items=get_ifc_classes, name="Class", update=refresh_predefined_types)
ifc_predefined_type: EnumProperty(items=get_ifc_predefined_types, name="Predefined Type", default=None) ifc_predefined_type: EnumProperty(items=get_ifc_predefined_types, name="Predefined Type", default=None)
ifc_userdefined_type: StringProperty(name="Userdefined Type") ifc_userdefined_type: StringProperty(name="Userdefined Type")
representation_template: bpy.props.EnumProperty(items=get_representation_template, name="Representation Template", default=0) representation_template: bpy.props.EnumProperty(
items=get_representation_template, name="Representation Template", default=0
)
relating_class_object: PointerProperty( relating_class_object: PointerProperty(
type=bpy.types.Object, type=bpy.types.Object,
name="Copy Class", name="Copy Class",
+1
View File
@@ -8,6 +8,7 @@ from ifcopenshell.util.classification import get_references
CostItem = dict[str, Any] CostItem = dict[str, Any]
class ifc5D2json: class ifc5D2json:
def __init__(self): def __init__(self):
self.json: str = None self.json: str = None
@@ -66,6 +66,7 @@ def get_inherited_references(reference: Optional[ifcopenshell.entity_instance])
reference = reference.ReferencedSource reference = reference.ReferencedSource
return results return results
def get_classification_data(file: ifcopenshell.file) -> Optional[tuple[list[dict], str]]: def get_classification_data(file: ifcopenshell.file) -> Optional[tuple[list[dict], str]]:
if not file or not file.by_type("IfcClassification"): if not file or not file.by_type("IfcClassification"):
return [], "" return [], ""
@@ -77,7 +78,9 @@ def get_classification_data(file: ifcopenshell.file) -> Optional[tuple[list[dict
del data["ReferencedSource"] del data["ReferencedSource"]
data["referenced_source"] = reference.ReferencedSource.id() if reference.ReferencedSource else None data["referenced_source"] = reference.ReferencedSource.id() if reference.ReferencedSource else None
data["has_references"] = bool(reference.HasReferences) data["has_references"] = bool(reference.HasReferences)
data["references"] = [process_references(ref) for ref in reference.HasReferences] if reference.HasReferences else [] data["references"] = (
[process_references(ref) for ref in reference.HasReferences] if reference.HasReferences else []
)
return data return data
classification_data = [process_references(reference) for reference in classification.HasReferences] classification_data = [process_references(reference) for reference in classification.HasReferences]
@@ -1631,6 +1631,7 @@ def copy_deep(
new[i] = attribute new[i] = attribute
return new return new
def has_property(product: ifcopenshell.entity_instance, property_name: str) -> bool: def has_property(product: ifcopenshell.entity_instance, property_name: str) -> bool:
""" """
Check if a product has a property with a given name. Check if a product has a property with a given name.