Added new nodes: api_WIP, bmesh_to_ifc, create_project and quick_project_setup

Modified nodes: api, create_entity
This commit is contained in:
martinaCodes
2022-08-25 22:01:35 +02:00
parent 0f85890c72
commit acee90fa89
9 changed files with 445 additions and 15 deletions
+9 -3
View File
@@ -54,16 +54,17 @@ class SvIfcCreateEntity(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper
self.generate_inputs(ifc_class)
try:
for i in range(0, len(self.inputs)):
self.inputs[i].sv_get()
input = self.inputs[i].sv_get()
except:
# This occurs when a blender save file is reloaded
self.generate_inputs(ifc_class)
for i in range(0, self.entity_schema.attribute_count()):
self.sv_input_names.append(self.entity_schema.attribute_by_index(i).name())
super().process()
self.process()
def generate_inputs(self, ifc_class):
# print("generate_inputs...")
while len(self.inputs) > 2:
self.inputs.remove(self.inputs[-1])
for i in range(0, self.entity_schema.attribute_count()):
@@ -77,12 +78,16 @@ class SvIfcCreateEntity(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper
for i in range(0, len(entity)):
try:
value = attributes[i]
# print("value (attribute[i]): ", value, "|value type: ", type(value))
if isinstance(value, str) and value == "":
value = None
except:
value = None
if value is None and entity.is_a("IfcRoot") and i == 0:
value = ifcopenshell.guid.new()
if value is not None and entity.attribute_name(i) == "Representation":
value = file.createIfcProductDefinitionShape(None, None, Representations = [value])
#product_shape = ifcopenshell.api.run("geometry.assign_representation", file, product = , representation = value)
if value is not None:
value = self.cast_value(self.entity_schema.attribute_by_index(i), value)
try:
@@ -93,6 +98,7 @@ class SvIfcCreateEntity(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper
ifc_class, entity.attribute_name(i), value
)
)
self.outputs["file"].sv_set([[file]])
self.outputs["entity"].sv_set([[entity]])