mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
add IfcClass selector for Ifc By Type node
This commit is contained in:
@@ -5,26 +5,34 @@ from bpy.props import StringProperty, EnumProperty
|
||||
from sverchok.node_tree import SverchCustomTreeNode
|
||||
from sverchok.data_structure import updateNode
|
||||
from blenderbim.bim import schema
|
||||
from blenderbim.bim.prop import getIfcClasses, getIfcProducts, refreshClasses, refreshPredefinedTypes
|
||||
|
||||
|
||||
class SvIfcByType(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper.SvIfcCore):
|
||||
bl_idname = "SvIfcByType"
|
||||
bl_label = "IFC By Type"
|
||||
ifc_element_types = [(t, t, t) for t in schema.IfcSchema().IfcElementType.keys()]
|
||||
file: StringProperty(name="file", update=updateNode)
|
||||
type: EnumProperty(name="type", items=ifc_element_types)
|
||||
ifc_product: EnumProperty(items=getIfcProducts, name="Products", update=refreshClasses)
|
||||
ifc_class: EnumProperty(items=getIfcClasses, name="Class", update=refreshPredefinedTypes)
|
||||
ifc_element_types = [(t, t, t) for t in schema.IfcSchema().IfcElementType.keys()]
|
||||
custom_ifc_class: StringProperty(name="Custom Ifc Class", update=updateNode)
|
||||
|
||||
def sv_init(self, context):
|
||||
self.inputs.new("SvStringsSocket", "file").prop_name = "file"
|
||||
self.inputs.new("SvStringsSocket", "type").prop_name = "type"
|
||||
self.inputs.new("SvStringsSocket", "ifc_product").prop_name = "ifc_product"
|
||||
self.inputs.new("SvStringsSocket", "ifc_class").prop_name = "ifc_class"
|
||||
self.inputs.new("SvStringsSocket", "custom_ifc_class").prop_name = "custom_ifc_class"
|
||||
self.outputs.new("SvStringsSocket", "entity")
|
||||
|
||||
def process(self):
|
||||
self.sv_input_names = ["file", "type"]
|
||||
self.sv_input_names = ["file", "ifc_product", "ifc_class", "custom_ifc_class"]
|
||||
super().process()
|
||||
|
||||
def process_ifc(self, file, type):
|
||||
self.outputs["entity"].sv_set([file.by_type(type)])
|
||||
def process_ifc(self, file, ifc_product, ifc_class, custom_ifc_class):
|
||||
if not custom_ifc_class:
|
||||
self.outputs["entity"].sv_set([file.by_type(ifc_class)])
|
||||
else:
|
||||
self.outputs["entity"].sv_set([file.by_type(custom_ifc_class)])
|
||||
|
||||
|
||||
def register():
|
||||
|
||||
Reference in New Issue
Block a user