diff --git a/src/ifcblenderexport/blenderbim/bim/export_ifc.py b/src/ifcblenderexport/blenderbim/bim/export_ifc.py index 0bbae0e5c2..935ce350e7 100644 --- a/src/ifcblenderexport/blenderbim/bim/export_ifc.py +++ b/src/ifcblenderexport/blenderbim/bim/export_ifc.py @@ -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)): diff --git a/src/ifcblenderexport/blenderbim/bim/ifc.py b/src/ifcblenderexport/blenderbim/bim/ifc.py index 147a205c15..d2efa09c71 100644 --- a/src/ifcblenderexport/blenderbim/bim/ifc.py +++ b/src/ifcblenderexport/blenderbim/bim/ifc.py @@ -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 diff --git a/src/ifcblenderexport/blenderbim/bim/prop.py b/src/ifcblenderexport/blenderbim/bim/prop.py index aceb19ce5b..9c662d01b4 100644 --- a/src/ifcblenderexport/blenderbim/bim/prop.py +++ b/src/ifcblenderexport/blenderbim/bim/prop.py @@ -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) diff --git a/src/ifcblenderexport/blenderbim/bim/ui.py b/src/ifcblenderexport/blenderbim/bim/ui.py index 032542d7f6..5eb1473460 100644 --- a/src/ifcblenderexport/blenderbim/bim/ui.py +++ b/src/ifcblenderexport/blenderbim/bim/ui.py @@ -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")