This commit is contained in:
Andrej730
2025-09-01 20:22:02 +05:00
parent eba3ced5fe
commit d7ddbd2b99
6 changed files with 13 additions and 12 deletions
+2 -2
View File
@@ -29,7 +29,7 @@ from ifcopenshell.util.doc import get_attribute_doc, get_predefined_type_doc, ge
import bonsai.tool as tool
from types import EllipsisType
from typing import Optional, Any, Union, TYPE_CHECKING
from collections.abc import Callable, Iterable
from collections.abc import Callable, Iterable, Sequence
if TYPE_CHECKING:
import bonsai.bim.prop
@@ -51,7 +51,7 @@ if TYPE_CHECKING:
def draw_attributes(
props: bpy.types.bpy_prop_collection_idprop[Attribute],
props: Union[bpy.types.bpy_prop_collection_idprop[Attribute], Sequence[Attribute]],
layout: bpy.types.UILayout,
copy_operator: Optional[str] = None,
popup_active_attribute: Optional[bonsai.bim.prop.Attribute] = None,
+1 -1
View File
@@ -729,7 +729,7 @@ class LiteralProps(PropertyGroup):
if TYPE_CHECKING:
attributes: bpy.types.bpy_prop_collection_idprop[Attribute]
value: str
box_alignment: str
box_alignment: tuple[bool, bool, bool, bool, bool, bool, bool, bool, bool]
ifc_definition_id: int
+1 -1
View File
@@ -173,7 +173,7 @@ def assign_cost_item_quantity(
ifc: type[tool.Ifc],
cost: type[tool.Cost],
cost_item: ifcopenshell.entity_instance,
related_object_type: type[tool.Cost].RELATED_OBJECT_TYPE,
related_object_type: tool.Cost.RELATED_OBJECT_TYPE,
prop_name: str,
) -> bool:
products = cost.get_products(related_object_type)
+2 -2
View File
@@ -200,7 +200,7 @@ def disable_editing_references(drawing: type[tool.Drawing]) -> None:
def add_document(
ifc: type[tool.Ifc], drawing: type[tool.Drawing], document_type: type[tool.Drawing].DOCUMENT_TYPE, uri: str
ifc: type[tool.Ifc], drawing: type[tool.Drawing], document_type: tool.Drawing.DOCUMENT_TYPE, uri: str
) -> None:
document = ifc.run("document.add_information")
reference = ifc.run("document.add_reference", information=document)
@@ -217,7 +217,7 @@ def add_document(
def remove_document(
ifc: type[tool.Ifc],
drawing: type[tool.Drawing],
document_type: type[tool.Drawing].DOCUMENT_TYPE,
document_type: tool.Drawing.DOCUMENT_TYPE,
document: ifcopenshell.entity_instance,
) -> None:
ifc.run("document.remove_information", information=document)
+5 -5
View File
@@ -52,7 +52,7 @@ def add_pset(
pset: type[tool.Pset],
blender: type[tool.Blender],
obj_name: str,
obj_type: type[tool.Ifc].OBJECT_TYPE,
obj_type: tool.Ifc.OBJECT_TYPE,
) -> None:
pset_name = pset.get_pset_name(obj_name, obj_type, pset_type="PSET")
if obj_type == "Object":
@@ -71,9 +71,9 @@ def enable_pset_editing(
pset_tool: type[tool.Pset],
pset: Union[ifcopenshell.entity_instance, None],
pset_name: str,
pset_type: type[tool.Pset].PSET_TYPE,
pset_type: tool.Pset.PSET_TYPE,
obj_name: str,
obj_type: type[tool.Ifc].OBJECT_TYPE,
obj_type: tool.Ifc.OBJECT_TYPE,
) -> None:
props = pset_tool.get_pset_props(obj_name, obj_type)
pset_tool.clear_blender_pset_properties(props)
@@ -94,7 +94,7 @@ def enable_pset_editing(
def add_proposed_prop(
pset: type[tool.Pset], obj_name: str, obj_type: type[tool.Ifc].OBJECT_TYPE, name: str, value: Any
pset: type[tool.Pset], obj_name: str, obj_type: tool.Ifc.OBJECT_TYPE, name: str, value: Any
) -> Union[None, str]:
props = pset.get_pset_props(obj_name, obj_type)
res = pset.add_proposed_property(name, pset.cast_string_to_primitive(value), props)
@@ -103,7 +103,7 @@ def add_proposed_prop(
def unshare_pset(
ifc: type[tool.Ifc], pset_tool: type[tool.Pset], obj_type: type[tool.Ifc].OBJECT_TYPE, obj_name: str, pset_id: int
ifc: type[tool.Ifc], pset_tool: type[tool.Pset], obj_type: tool.Ifc.OBJECT_TYPE, obj_name: str, pset_id: int
) -> None:
elements: list[ifcopenshell.entity_instance]
pset = ifc.get_entity_by_id(pset_id)
+2 -1
View File
@@ -505,7 +505,7 @@ class Drawing(bonsai.core.tool.Drawing):
@classmethod
def export_text_literal_attributes(cls, obj: bpy.types.Object) -> list[dict[str, Any]]:
literals = []
literals: list[dict[str, Any]] = []
props = tool.Drawing.get_text_props(obj)
for literal_props in props.literals:
literal_data = bonsai.bim.helper.export_attributes(literal_props.attributes)
@@ -755,6 +755,7 @@ class Drawing(bonsai.core.tool.Drawing):
@classmethod
def synchronise_ifc_and_text_attributes(cls, obj: bpy.types.Object) -> None:
literals = cls.get_text_literal(obj, return_list=True)
assert isinstance(literals, list)
literals_attributes = cls.export_text_literal_attributes(obj)
props = cls.get_text_props(obj)
defined_ifc_ids = [l.ifc_definition_id for l in props.literals]