mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 21:50:01 +00:00
Add filepath popup when saving IDS reports to BCF
This commit is contained in:
@@ -68,6 +68,7 @@ class ExecuteIfcTester(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
report = None
|
report = None
|
||||||
report = ifctester.reporter.Json(specs).report()["specifications"]
|
report = ifctester.reporter.Json(specs).report()["specifications"]
|
||||||
if report:
|
if report:
|
||||||
|
tool.Tester.specs = specs
|
||||||
tool.Tester.report = report
|
tool.Tester.report = report
|
||||||
props.specifications.clear()
|
props.specifications.clear()
|
||||||
for spec in report:
|
for spec in report:
|
||||||
@@ -155,21 +156,16 @@ class ExportBcf(bpy.types.Operator):
|
|||||||
bl_idname = "bim.export_bcf"
|
bl_idname = "bim.export_bcf"
|
||||||
bl_label = "Export BCF"
|
bl_label = "Export BCF"
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
filter_glob: bpy.props.StringProperty(default="*.bcf", options={"HIDDEN"})
|
||||||
|
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
props = context.scene.IfcTesterProperties
|
bcf_reporter = ifctester.reporter.Bcf(tool.Tester.specs)
|
||||||
if tool.Ifc.get():
|
bcf_reporter.report()
|
||||||
ifc = tool.Ifc.get()
|
bcf_reporter.to_file(self.filepath)
|
||||||
else:
|
self.report({"INFO"}, "Finished exporting!")
|
||||||
ifc = ifcopenshell.open(props.ifc_file)
|
|
||||||
with tempfile.TemporaryDirectory() as dirpath:
|
|
||||||
output = os.path.join(dirpath, "{}.bcf".format(props.specs))
|
|
||||||
specs = ifctester.ids.open(props.specs)
|
|
||||||
specs.validate(ifc)
|
|
||||||
bcf_reporter = ifctester.reporter.Bcf(specs)
|
|
||||||
bcf_reporter.report()
|
|
||||||
bcf_reporter.to_file(output)
|
|
||||||
print("Finished exporting!")
|
|
||||||
self.report({"INFO"}, "Finished exporting!")
|
|
||||||
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
def invoke(self, context, event):
|
||||||
|
context.window_manager.fileselect_add(self)
|
||||||
|
return {"RUNNING_MODAL"}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
# BlenderBIM Add-on - OpenBIM Blender Add-on
|
||||||
|
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
|
||||||
|
#
|
||||||
|
# This file is part of BlenderBIM Add-on.
|
||||||
|
#
|
||||||
|
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# BlenderBIM Add-on is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
class Tester:
|
||||||
|
specs = None
|
||||||
|
report = {}
|
||||||
Reference in New Issue
Block a user