mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Three new nodes for IfcSverchok. By ID, By Guid, and By Type
This commit is contained in:
@@ -26,6 +26,9 @@ def nodes_index():
|
||||
("ifc.read_file", "SvIfcReadFile"),
|
||||
("ifc.write_file", "SvIfcWriteFile"),
|
||||
("ifc.create_entity", "SvIfcCreateEntity"),
|
||||
("ifc.by_id", "SvIfcById"),
|
||||
("ifc.by_guid", "SvIfcByGuid"),
|
||||
("ifc.by_type", "SvIfcByType"),
|
||||
])]
|
||||
|
||||
def make_node_list():
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import bpy
|
||||
import ifcopenshell
|
||||
import ifcsverchok.helper
|
||||
from bpy.props import StringProperty
|
||||
from sverchok.node_tree import SverchCustomTreeNode
|
||||
from sverchok.data_structure import updateNode
|
||||
|
||||
|
||||
class SvIfcByGuid(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper.SvIfcCore):
|
||||
bl_idname = 'SvIfcByGuid'
|
||||
bl_label = 'IFC By Guid'
|
||||
file: StringProperty(name='file', update=updateNode)
|
||||
guid: StringProperty(name='guid', update=updateNode)
|
||||
|
||||
def sv_init(self, context):
|
||||
self.inputs.new('SvStringsSocket', 'file').prop_name = 'file'
|
||||
self.inputs.new('SvStringsSocket', 'guid').prop_name = 'guid'
|
||||
self.outputs.new('SvStringsSocket', 'entity')
|
||||
|
||||
def process(self):
|
||||
self.sv_input_names = ['file', 'guid']
|
||||
super().process()
|
||||
|
||||
def process_ifc(self, file, guid):
|
||||
self.outputs['entity'].sv_set([[file.by_guid(guid)]])
|
||||
|
||||
def register():
|
||||
bpy.utils.register_class(SvIfcByGuid)
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_class(SvIfcByGuid)
|
||||
@@ -0,0 +1,31 @@
|
||||
import bpy
|
||||
import ifcopenshell
|
||||
import ifcsverchok.helper
|
||||
from bpy.props import StringProperty
|
||||
from sverchok.node_tree import SverchCustomTreeNode
|
||||
from sverchok.data_structure import updateNode
|
||||
|
||||
|
||||
class SvIfcById(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper.SvIfcCore):
|
||||
bl_idname = 'SvIfcById'
|
||||
bl_label = 'IFC By Id'
|
||||
file: StringProperty(name='file', update=updateNode)
|
||||
id: StringProperty(name='id', update=updateNode)
|
||||
|
||||
def sv_init(self, context):
|
||||
self.inputs.new('SvStringsSocket', 'file').prop_name = 'file'
|
||||
self.inputs.new('SvStringsSocket', 'id').prop_name = 'id'
|
||||
self.outputs.new('SvStringsSocket', 'entity')
|
||||
|
||||
def process(self):
|
||||
self.sv_input_names = ['file', 'id']
|
||||
super().process()
|
||||
|
||||
def process_ifc(self, file, id):
|
||||
self.outputs['entity'].sv_set([[file.by_id(int(id))]])
|
||||
|
||||
def register():
|
||||
bpy.utils.register_class(SvIfcById)
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_class(SvIfcById)
|
||||
@@ -0,0 +1,31 @@
|
||||
import bpy
|
||||
import ifcopenshell
|
||||
import ifcsverchok.helper
|
||||
from bpy.props import StringProperty
|
||||
from sverchok.node_tree import SverchCustomTreeNode
|
||||
from sverchok.data_structure import updateNode
|
||||
|
||||
|
||||
class SvIfcByType(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper.SvIfcCore):
|
||||
bl_idname = 'SvIfcByType'
|
||||
bl_label = 'IFC By Type'
|
||||
file: StringProperty(name='file', update=updateNode)
|
||||
type: StringProperty(name='type', update=updateNode)
|
||||
|
||||
def sv_init(self, context):
|
||||
self.inputs.new('SvStringsSocket', 'file').prop_name = 'file'
|
||||
self.inputs.new('SvStringsSocket', 'type').prop_name = 'type'
|
||||
self.outputs.new('SvStringsSocket', 'entity')
|
||||
|
||||
def process(self):
|
||||
self.sv_input_names = ['file', 'type']
|
||||
super().process()
|
||||
|
||||
def process_ifc(self, file, type):
|
||||
self.outputs['entity'].sv_set([file.by_type(type)])
|
||||
|
||||
def register():
|
||||
bpy.utils.register_class(SvIfcByType)
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_class(SvIfcByType)
|
||||
Reference in New Issue
Block a user