Three new nodes for IfcSverchok. By ID, By Guid, and By Type

This commit is contained in:
Dion Moult
2020-10-08 20:22:18 +11:00
parent 38e5b17b0f
commit 1fa7791b8b
4 changed files with 96 additions and 0 deletions
+3
View File
@@ -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():
+31
View File
@@ -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)
+31
View File
@@ -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)
+31
View File
@@ -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)