mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
add export bcf to ifctester (2023_07_18)
This commit is contained in:
@@ -25,6 +25,7 @@ classes = (
|
||||
operator.SelectIfcTesterIfcFile,
|
||||
operator.SelectRequirement,
|
||||
operator.SelectEntity,
|
||||
operator.ExportBcf,
|
||||
prop.FailedEntities,
|
||||
prop.Specification,
|
||||
prop.IfcTesterProperties,
|
||||
|
||||
@@ -54,7 +54,6 @@ class ExecuteIfcTester(bpy.types.Operator):
|
||||
print("Finished loading:", time.time() - start)
|
||||
start = time.time()
|
||||
specs.validate(ifc)
|
||||
print(specs)
|
||||
|
||||
print("Finished validating:", time.time() - start)
|
||||
start = time.time()
|
||||
@@ -63,7 +62,7 @@ class ExecuteIfcTester(bpy.types.Operator):
|
||||
engine.report()
|
||||
engine.to_file(output)
|
||||
webbrowser.open("file://" + output)
|
||||
|
||||
|
||||
report = None
|
||||
report = ifctester.reporter.Json(specs).report()['specifications']
|
||||
if report:
|
||||
@@ -148,4 +147,26 @@ class SelectEntity(bpy.types.Operator):
|
||||
obj.select_set(True)
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
return {"FINISHED"}
|
||||
|
||||
class ExportBcf(bpy.types.Operator):
|
||||
bl_idname = "bim.export_bcf"
|
||||
bl_label = "Export BCF"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
|
||||
def execute(self, context):
|
||||
props = context.scene.IfcTesterProperties
|
||||
with tempfile.TemporaryDirectory() as dirpath:
|
||||
output = os.path.join(dirpath, "{}.bcf".format(props.specs))
|
||||
if props.should_load_from_memory and tool.Ifc.get():
|
||||
ifc = tool.Ifc.get()
|
||||
else:
|
||||
ifc = ifcopenshell.open(props.ifc_file)
|
||||
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:")
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -62,6 +62,10 @@ class BIM_PT_tester(Panel):
|
||||
)
|
||||
|
||||
self.draw_editable_ui(context)
|
||||
|
||||
if self.props.has_report:
|
||||
row = self.layout.row()
|
||||
row.operator("bim.export_bcf", text="Export BCF", icon="EXPORT")
|
||||
|
||||
def draw_editable_ui(self, context):
|
||||
props = context.scene.IfcTesterProperties
|
||||
|
||||
Reference in New Issue
Block a user