mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 11:22:44 +00:00
black ifcsverchok
This commit is contained in:
@@ -7,28 +7,28 @@ from sverchok.data_structure import updateNode
|
||||
|
||||
|
||||
class SvIfcReadEntity(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper.SvIfcCore):
|
||||
bl_idname = 'SvIfcReadEntity'
|
||||
bl_label = 'IFC Read Entity'
|
||||
file: StringProperty(name='file', update=updateNode)
|
||||
entity: StringProperty(name='entity', update=updateNode)
|
||||
current_ifc_class: StringProperty(name='current_ifc_class')
|
||||
bl_idname = "SvIfcReadEntity"
|
||||
bl_label = "IFC Read Entity"
|
||||
file: StringProperty(name="file", update=updateNode)
|
||||
entity: StringProperty(name="entity", update=updateNode)
|
||||
current_ifc_class: StringProperty(name="current_ifc_class")
|
||||
|
||||
def sv_init(self, context):
|
||||
self.inputs.new('SvStringsSocket', 'file').prop_name = 'file'
|
||||
self.inputs.new('SvStringsSocket', 'entity').prop_name = 'entity'
|
||||
self.outputs.new('SvStringsSocket', 'id')
|
||||
self.outputs.new('SvStringsSocket', 'is_a')
|
||||
self.inputs.new("SvStringsSocket", "file").prop_name = "file"
|
||||
self.inputs.new("SvStringsSocket", "entity").prop_name = "entity"
|
||||
self.outputs.new("SvStringsSocket", "id")
|
||||
self.outputs.new("SvStringsSocket", "is_a")
|
||||
|
||||
def process(self):
|
||||
self.sv_input_names = ['file', 'entity']
|
||||
ifc_class = self.inputs['entity'].sv_get()[0][0]
|
||||
self.sv_input_names = ["file", "entity"]
|
||||
ifc_class = self.inputs["entity"].sv_get()[0][0]
|
||||
if ifc_class:
|
||||
ifc_class = ifc_class.is_a()
|
||||
file = self.inputs['file'].sv_get()[0][0]
|
||||
file = self.inputs["file"].sv_get()[0][0]
|
||||
if file:
|
||||
schema_name = file.wrapped_data.schema
|
||||
else:
|
||||
schema_name = 'IFC4'
|
||||
schema_name = "IFC4"
|
||||
self.schema = ifcopenshell.ifcopenshell_wrapper.schema_by_name(schema_name)
|
||||
self.entity_schema = self.schema.declaration_by_name(ifc_class)
|
||||
|
||||
@@ -41,12 +41,12 @@ class SvIfcReadEntity(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper.S
|
||||
self.outputs.remove(self.outputs[-1])
|
||||
for i in range(0, self.entity_schema.attribute_count()):
|
||||
name = self.entity_schema.attribute_by_index(i).name()
|
||||
self.outputs.new('SvStringsSocket', name).prop_name = name
|
||||
self.outputs.new("SvStringsSocket", name).prop_name = name
|
||||
self.current_ifc_class = ifc_class
|
||||
|
||||
def process_ifc(self, file, entity):
|
||||
self.outputs['id'].sv_set([[entity.id()]])
|
||||
self.outputs['is_a'].sv_set([[entity.is_a()]])
|
||||
self.outputs["id"].sv_set([[entity.id()]])
|
||||
self.outputs["is_a"].sv_set([[entity.is_a()]])
|
||||
for i in range(0, self.entity_schema.attribute_count()):
|
||||
name = self.entity_schema.attribute_by_index(i).name()
|
||||
self.outputs[name].sv_set([[entity[i]]])
|
||||
@@ -55,5 +55,6 @@ class SvIfcReadEntity(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper.S
|
||||
def register():
|
||||
bpy.utils.register_class(SvIfcReadEntity)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_class(SvIfcReadEntity)
|
||||
|
||||
Reference in New Issue
Block a user