mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 22:11:36 +00:00
add export bcf to ifctester (2023_07_18)
This commit is contained in:
@@ -25,6 +25,7 @@ classes = (
|
|||||||
operator.SelectIfcTesterIfcFile,
|
operator.SelectIfcTesterIfcFile,
|
||||||
operator.SelectRequirement,
|
operator.SelectRequirement,
|
||||||
operator.SelectEntity,
|
operator.SelectEntity,
|
||||||
|
operator.ExportBcf,
|
||||||
prop.FailedEntities,
|
prop.FailedEntities,
|
||||||
prop.Specification,
|
prop.Specification,
|
||||||
prop.IfcTesterProperties,
|
prop.IfcTesterProperties,
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ class ExecuteIfcTester(bpy.types.Operator):
|
|||||||
print("Finished loading:", time.time() - start)
|
print("Finished loading:", time.time() - start)
|
||||||
start = time.time()
|
start = time.time()
|
||||||
specs.validate(ifc)
|
specs.validate(ifc)
|
||||||
print(specs)
|
|
||||||
|
|
||||||
print("Finished validating:", time.time() - start)
|
print("Finished validating:", time.time() - start)
|
||||||
start = time.time()
|
start = time.time()
|
||||||
@@ -63,7 +62,7 @@ class ExecuteIfcTester(bpy.types.Operator):
|
|||||||
engine.report()
|
engine.report()
|
||||||
engine.to_file(output)
|
engine.to_file(output)
|
||||||
webbrowser.open("file://" + output)
|
webbrowser.open("file://" + output)
|
||||||
|
|
||||||
report = None
|
report = None
|
||||||
report = ifctester.reporter.Json(specs).report()['specifications']
|
report = ifctester.reporter.Json(specs).report()['specifications']
|
||||||
if report:
|
if report:
|
||||||
@@ -148,4 +147,26 @@ class SelectEntity(bpy.types.Operator):
|
|||||||
obj.select_set(True)
|
obj.select_set(True)
|
||||||
bpy.context.view_layer.objects.active = obj
|
bpy.context.view_layer.objects.active = obj
|
||||||
return {"FINISHED"}
|
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)
|
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):
|
def draw_editable_ui(self, context):
|
||||||
props = context.scene.IfcTesterProperties
|
props = context.scene.IfcTesterProperties
|
||||||
|
|||||||
Reference in New Issue
Block a user