mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 20:30:00 +00:00
Add_spatial_element node updated
This commit is contained in:
@@ -62,10 +62,13 @@ class SvIfcAddSpatialElement(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.h
|
|||||||
result = ifcopenshell.api.run("root.create_entity", self.file, name=self.names[i], ifc_class=self.ifc_class)
|
result = ifcopenshell.api.run("root.create_entity", self.file, name=self.names[i], ifc_class=self.ifc_class)
|
||||||
for items in element:
|
for items in element:
|
||||||
print("items: ", items)
|
print("items: ", items)
|
||||||
ifcopenshell.api.run("spatial.assign_container", self.file, product=items, relating_structure=result)
|
if items.is_a("IfcSpatialElement") or items.is_a("IfcSpatialStructureElement"):
|
||||||
|
ifcopenshell.api.run("aggregate.assign_object", self.file, product=items, relating_object=result)
|
||||||
|
else:
|
||||||
|
ifcopenshell.api.run("spatial.assign_container", self.file, product=items, relating_structure=result)
|
||||||
SvIfcStore.id_map[result.id()] = self.node_id
|
SvIfcStore.id_map[result.id()] = self.node_id
|
||||||
SvIfcStore.id_map.setdefault(self.node_id, []).append(result.id())
|
SvIfcStore.id_map.setdefault(self.node_id, []).append(result.id())
|
||||||
results.append(result)
|
results.append(result.id())
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def edit(self):
|
def edit(self):
|
||||||
@@ -73,7 +76,6 @@ class SvIfcAddSpatialElement(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.h
|
|||||||
results_ids = SvIfcStore.id_map[self.node_id]
|
results_ids = SvIfcStore.id_map[self.node_id]
|
||||||
for result_id in results_ids:
|
for result_id in results_ids:
|
||||||
result = self.file.by_id(result_id)
|
result = self.file.by_id(result_id)
|
||||||
print("\n\nresult: ", result)
|
|
||||||
subelements = set(ifcopenshell.util.element.get_decomposition(result))
|
subelements = set(ifcopenshell.util.element.get_decomposition(result))
|
||||||
for element in self.elements:
|
for element in self.elements:
|
||||||
print("\nElement: ", element)
|
print("\nElement: ", element)
|
||||||
@@ -85,9 +87,12 @@ class SvIfcAddSpatialElement(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.h
|
|||||||
# Just realised I don't have a spatial.unassign_container, but if so we'd do it here
|
# Just realised I don't have a spatial.unassign_container, but if so we'd do it here
|
||||||
pass
|
pass
|
||||||
for added_element in element_set - subelements:
|
for added_element in element_set - subelements:
|
||||||
ifcopenshell.api.run("spatial.assign_container", self.file, product=added_element, relating_structure=result)
|
if added_element.is_a("IfcSpatialElement") or added_element.is_a("IfcSpatialStructureElement"):
|
||||||
|
ifcopenshell.api.run("aggregate.assign_object", self.file, product=added_element, relating_object=result)
|
||||||
|
else:
|
||||||
|
ifcopenshell.api.run("spatial.assign_container", self.file, product=added_element, relating_structure=result)
|
||||||
print("assigned container")
|
print("assigned container")
|
||||||
results.append(result)
|
results.append(result.id())
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def repeat_input_unique(self, input, count):
|
def repeat_input_unique(self, input, count):
|
||||||
|
|||||||
@@ -79,6 +79,10 @@ class SvIfcCreateShape(bpy.types.Node, SverchCustomTreeNode, ifcsverchok.helper.
|
|||||||
|
|
||||||
if self.refresh_local or hash(self) not in self.node_dict:
|
if self.refresh_local or hash(self) not in self.node_dict:
|
||||||
self.file = SvIfcStore.get_file()
|
self.file = SvIfcStore.get_file()
|
||||||
|
try:
|
||||||
|
self.entities = [self.file.by_id(step_id) for step_id in self.entities]
|
||||||
|
except Exception as e:
|
||||||
|
raise
|
||||||
blender_objects = self.create()
|
blender_objects = self.create()
|
||||||
self.node_dict[hash(self)] = blender_objects
|
self.node_dict[hash(self)] = blender_objects
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user