New experimental option to export file from memory in preparation for incremental editing

This commit is contained in:
Dion Moult
2020-12-30 13:50:10 +11:00
parent ee222628f3
commit c844076efb
4 changed files with 10 additions and 1 deletions
@@ -1345,6 +1345,9 @@ class IfcExporter:
self.roundtrip_id_new_to_old = {}
def export(self, selected_objects):
self.file = ifc.IfcStore.get_file()
if self.file and self.ifc_export_settings.should_export_from_memory:
return self.write_ifc_file()
self.schema_version = self.ifc_export_settings.schema
self.schema = ifcopenshell.ifcopenshell_wrapper.schema_by_name(self.schema_version)
self.file = ifcopenshell.file(schema=self.schema_version)
@@ -3526,6 +3529,7 @@ class IfcExportSettings:
]
self.should_use_presentation_style_assignment = False
self.should_guess_quantities = False
self.should_export_from_memory = False
self.context_tree = []
@staticmethod
@@ -3545,6 +3549,7 @@ class IfcExportSettings:
settings.should_force_faceted_brep = scene_bim.export_should_force_faceted_brep
settings.should_force_triangulation = scene_bim.export_should_force_triangulation
settings.should_roundtrip_native = scene_bim.import_export_should_roundtrip_native
settings.should_export_from_memory = scene_bim.export_should_export_from_memory
settings.context_tree = []
for ifc_context in ["model", "plan"]:
if getattr(scene_bim, "has_{}_context".format(ifc_context)):
+2 -1
View File
@@ -12,5 +12,6 @@ class IfcStore:
def get_file():
if IfcStore.file is None:
IfcStore.path = bpy.context.scene.BIMProperties.ifc_file
IfcStore.file = ifcopenshell.open(IfcStore.path)
if IfcStore.path:
IfcStore.file = ifcopenshell.open(IfcStore.path)
return IfcStore.file
@@ -1263,6 +1263,7 @@ class BIMProperties(PropertyGroup):
)
export_should_force_faceted_brep: BoolProperty(name="Export with Faceted Breps", default=False)
export_should_force_triangulation: BoolProperty(name="Export with Triangulation", default=False)
export_should_export_from_memory: BoolProperty(name="Export from Memory", default=False)
import_should_ignore_site_coordinates: BoolProperty(name="Import Ignoring Site Coordinates", default=False)
import_should_ignore_building_coordinates: BoolProperty(name="Import Ignoring Building Coordinates", default=False)
import_should_reset_absolute_coordinates: BoolProperty(name="Import Resetting Absolute Coordinates", default=False)
@@ -1888,6 +1888,8 @@ class BIM_PT_mvd(Panel):
row = layout.row()
row.prop(bim_properties, "import_export_should_roundtrip_native")
row = layout.row()
row.prop(bim_properties, "export_should_export_from_memory")
row = layout.row()
row.prop(bim_properties, "import_should_use_cpu_multiprocessing")
row = layout.row()
row.prop(bim_properties, "import_should_import_with_profiling")