New select blender objects node - select objects in the Blender scene based off entities in an IFC file

This commit is contained in:
Dion Moult
2020-10-09 21:17:18 +11:00
parent cc778778ee
commit 688c799d1b
2 changed files with 38 additions and 0 deletions
+1
View File
@@ -30,6 +30,7 @@ def nodes_index():
("ifc.by_guid", "SvIfcByGuid"),
("ifc.by_type", "SvIfcByType"),
("ifc.by_query", "SvIfcByQuery"),
("ifc.select_blender_objects", "SvIfcSelectBlenderObjects"),
])]
def make_node_list():
@@ -0,0 +1,37 @@
import bpy
import ifcopenshell
import ifcopenshell.util.selector
import ifcsverchok.helper
from bpy.props import StringProperty
from sverchok.node_tree import SverchCustomTreeNode
from sverchok.data_structure import updateNode
class SvIfcSelectBlenderObjects(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper.SvIfcCore):
bl_idname = 'SvIfcSelectBlenderObjects'
bl_label = 'IFC Select Blender Objects'
file: StringProperty(name='file', update=updateNode)
query: StringProperty(name='query', update=updateNode)
def sv_init(self, context):
self.inputs.new('SvStringsSocket', 'entities').prop_name = 'entities'
def process(self):
self.sv_input_names = ['entities']
self.guids = []
super().process()
for obj in bpy.context.visible_objects:
index = obj.BIMObjectProperties.attributes.find('GlobalId')
if index != -1 \
and obj.BIMObjectProperties.attributes[index].string_value in self.guids:
obj.select_set(True)
def process_ifc(self, entities):
self.guids.append(entities.GlobalId)
def register():
bpy.utils.register_class(SvIfcSelectBlenderObjects)
def unregister():
bpy.utils.unregister_class(SvIfcSelectBlenderObjects)