Interpret Script Example#
Download the InterpretExample.slmd for this example.
Code Snippet: Interpret Scripting Functionality#
from Slide2Scripting.Slide2Interpreter import Slide2Interpreter
import os, inspect
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(lambda: None)))
Slide2Interpreter.startApplication(60075)
slide2_interpreter = Slide2Interpreter(60075)
model = slide2_interpreter.openFile(rf"{current_dir}\example_models\InterpretExample.slmd")
interpret_data = model.getInterpretData()
interpret_data.setActiveStage(0)
methods = interpret_data.listAnalysisMethods()
print(f"Analysis methods: {len(methods)}")
for method in methods:
print(f" [{method.getIndex()}] {method.getName()}")
active_method = interpret_data.getActiveAnalysisMethod()
print(f"Active method: [{active_method.getIndex()}] {active_method.getName()}")
surfaces = interpret_data.getAllSurfaces()
print(f"Surfaces (current filter): {len(surfaces)}")
model.close(saveChanges=False)
slide2_interpreter.closeApplication()
Output#
Analysis methods: 3
[0] bishop simplified
[1] spencer
[2] gle/morgenstern-price
Active method: [0] bishop simplified
Surfaces (current filter): 4219