mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 22:47:53 +00:00
New UI to run BIMTester from BlenderBIM Add-on
This commit is contained in:
@@ -161,6 +161,8 @@ if bpy is not None:
|
||||
operator.PushRepresentation,
|
||||
operator.ConvertLocalToGlobal,
|
||||
operator.GuessQuantity,
|
||||
operator.ExecuteBIMTester,
|
||||
operator.BIMTesterPurge,
|
||||
prop.StrProperty,
|
||||
prop.Variable,
|
||||
prop.Role,
|
||||
|
||||
@@ -3161,3 +3161,39 @@ class GuessQuantity(bpy.types.Operator):
|
||||
prop.string_value = str(round(qto_calculator.guess_quantity(
|
||||
prop.name, [p.name for p in props], bpy.context.active_object), 3))
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class ExecuteBIMTester(bpy.types.Operator):
|
||||
bl_idname = 'bim.execute_bim_tester'
|
||||
bl_label = 'Execute BIMTester'
|
||||
|
||||
def execute(self, context):
|
||||
import bimtester
|
||||
filename = os.path.join(
|
||||
bpy.context.scene.BIMProperties.features_dir,
|
||||
bpy.context.scene.BIMProperties.features_file + '.feature')
|
||||
cwd = os.getcwd()
|
||||
os.chdir(bpy.context.scene.BIMProperties.features_dir)
|
||||
bimtester.run_tests({'feature': filename, 'advanced_arguments': None, 'console': False})
|
||||
bimtester.generate_report()
|
||||
webbrowser.open(os.path.join(
|
||||
bpy.context.scene.BIMProperties.features_dir,
|
||||
'report', bpy.context.scene.BIMProperties.features_file + '.feature.html'))
|
||||
os.chdir(cwd)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class BIMTesterPurge(bpy.types.Operator):
|
||||
bl_idname = 'bim.bim_tester_purge'
|
||||
bl_label = 'Purge Tests'
|
||||
|
||||
def execute(self, context):
|
||||
import bimtester
|
||||
filename = os.path.join(
|
||||
bpy.context.scene.BIMProperties.features_dir,
|
||||
bpy.context.scene.BIMProperties.features_file + '.feature')
|
||||
cwd = os.getcwd()
|
||||
os.chdir(bpy.context.scene.BIMProperties.features_dir)
|
||||
bimtester.TestPurger().purge()
|
||||
os.chdir(cwd)
|
||||
return {'FINISHED'}
|
||||
|
||||
@@ -1348,6 +1348,14 @@ class BIM_PT_qa(Panel):
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(bim_properties, "scenario")
|
||||
else:
|
||||
return
|
||||
|
||||
row = layout.row()
|
||||
row.operator("bim.execute_bim_tester")
|
||||
|
||||
row = layout.row()
|
||||
row.operator("bim.bim_tester_purge")
|
||||
|
||||
layout.label(text="Quality Auditing:")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user