mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-18 19:30:25 +00:00
write_file added logic that ensures proper model hierarchy
This commit is contained in:
@@ -118,16 +118,13 @@ class IFC_Sv_UpdateCurrent(bpy.types.Operator):
|
||||
self.file.write("/Users/martina/Documents/GSoC/CodeTests/IfcFileTest_7_11_purged.ifc")
|
||||
node_tree = context.space_data.node_tree
|
||||
if node_tree:
|
||||
print("### \tupdate tree", node_tree)
|
||||
if self.force_mode or node_tree.sv_process:
|
||||
print("### \tforce update")
|
||||
try:
|
||||
bpy.context.window.cursor_set("WAIT")
|
||||
node_tree.force_update()
|
||||
finally:
|
||||
bpy.context.window.cursor_set("DEFAULT")
|
||||
print("### \tupdate tree done")
|
||||
self.report({"INFO"}, "Node tree updated")
|
||||
self.report({"INFO"}, "Node tree updated.")
|
||||
return {'FINISHED'}
|
||||
|
||||
class IFC_Sv_write_file(bpy.types.Operator):
|
||||
@@ -193,13 +190,6 @@ class IFC_Sv_write_file(bpy.types.Operator):
|
||||
raise Exception("Bad path. Provide a path to a file.")
|
||||
else:
|
||||
self.ensure_hirarchy(self.file)
|
||||
print("### \thirarchy ensured")
|
||||
# if not (self.file.by_type("IfcSpatialElement") or self.file.by_type("IfcSpatialStructureElement")):
|
||||
# self.report({"INFO"},"No Ifc Spatial Element found. Adding all elements to IfcBuilding.")
|
||||
# elements = self.file.by_type("IfcElement")
|
||||
# building = ifcopenshell.api.run("root.create_entity", self.file, name="DefaultBuilding", ifc_class="IfcBuilding")
|
||||
# for element in elements:
|
||||
# ifcopenshell.api.run("spatial.assign_container", self.file, product=element, relating_structure=building)
|
||||
self.file.write(self.filepath)
|
||||
self.report({"INFO"}, f"File written to: {self.filepath}")
|
||||
return {"FINISHED"}
|
||||
@@ -226,8 +216,9 @@ class IFC_PT_write_file_panel(bpy.types.Panel):
|
||||
layout = self.layout
|
||||
row = layout.split(factor=0.2, align=True)
|
||||
row = layout.row()
|
||||
row2 = layout.row()
|
||||
row.operator('ifc.sverchok_update_current', text='IFC Re-run all nodes')
|
||||
row.operator("ifc.write_file_panel")
|
||||
row2.operator("ifc.write_file_panel")
|
||||
|
||||
CLASSES = [IFC_Sv_UpdateCurrent,IFC_Sv_write_file, IFC_PT_write_file_panel]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user