mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 13:52:23 +00:00
typing
This commit is contained in:
@@ -19,11 +19,11 @@
|
||||
import bpy
|
||||
import ifcopenshell
|
||||
import ifcopenshell.util.selector
|
||||
import bonsai.tool as tool
|
||||
import ifcsverchok.helper
|
||||
from bpy.props import StringProperty
|
||||
from sverchok.node_tree import SverchCustomTreeNode
|
||||
from sverchok.data_structure import updateNode
|
||||
from bonsai.bim.ifc import IfcStore
|
||||
|
||||
|
||||
class SvIfcSelectBlenderObjectsRefresh(bpy.types.Operator):
|
||||
@@ -35,6 +35,7 @@ class SvIfcSelectBlenderObjectsRefresh(bpy.types.Operator):
|
||||
node_name: StringProperty(default="")
|
||||
|
||||
def execute(self, context):
|
||||
node: SvIfcSelectBlenderObjects
|
||||
node = bpy.data.node_groups[self.tree_name].nodes[self.node_name]
|
||||
node.process()
|
||||
return {"FINISHED"}
|
||||
@@ -43,7 +44,9 @@ class SvIfcSelectBlenderObjectsRefresh(bpy.types.Operator):
|
||||
class SvIfcSelectBlenderObjects(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper.SvIfcCore):
|
||||
bl_idname = "SvIfcSelectBlenderObjects"
|
||||
bl_label = "IFC Select Blender Objects"
|
||||
bl_description = "Select Blender objects based on IFC entities."
|
||||
file: StringProperty(name="file", update=updateNode)
|
||||
# TODO: never used.
|
||||
query: StringProperty(name="query", update=updateNode)
|
||||
|
||||
def sv_init(self, context):
|
||||
@@ -54,18 +57,18 @@ class SvIfcSelectBlenderObjects(bpy.types.Node, SverchCustomTreeNode, ifcsvercho
|
||||
layout, "node.sv_ifc_select_blender_objects_refresh", icon="FILE_REFRESH", text="Refresh"
|
||||
)
|
||||
|
||||
def process(self):
|
||||
self.file = IfcStore.get_file()
|
||||
def process(self) -> None:
|
||||
self.sv_input_names = ["entities"]
|
||||
self.guids = []
|
||||
self.guids: list[str] = []
|
||||
super().process()
|
||||
for obj in bpy.context.visible_objects:
|
||||
if not obj.BIMObjectProperties.ifc_definition_id:
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
if not element:
|
||||
continue
|
||||
if self.file.by_id(obj.BIMObjectProperties.ifc_definition_id).GlobalId in self.guids:
|
||||
if getattr(element, "GlobalId", None) in self.guids:
|
||||
obj.select_set(True)
|
||||
|
||||
def process_ifc(self, entities):
|
||||
def process_ifc(self, entities: ifcopenshell.entity_instance) -> None:
|
||||
self.guids.append(entities.GlobalId)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user