65 lines
2.4 KiB
Python
65 lines
2.4 KiB
Python
import os
|
|
import traceback
|
|
|
|
|
|
workspace = r"F:\codex_proj\LEM_Simulink"
|
|
project_file = os.path.join(workspace, "LinearSimulink.aedt")
|
|
report_file = os.path.join(workspace, "analysis_artifacts", "aedt_project_probe.txt")
|
|
if not os.path.isdir(os.path.dirname(report_file)):
|
|
os.makedirs(os.path.dirname(report_file))
|
|
|
|
|
|
def write_line(handle, label, value=""):
|
|
handle.write("{}\t{}\n".format(label, value))
|
|
handle.flush()
|
|
|
|
|
|
with open(report_file, "w") as report:
|
|
try:
|
|
write_line(report, "PROJECT_FILE", project_file)
|
|
write_line(report, "PROJECT_EXISTS", os.path.isfile(project_file))
|
|
|
|
project = oDesktop.OpenProject(project_file)
|
|
write_line(report, "OPEN_PROJECT_RETURN", project)
|
|
if project is None:
|
|
project = oDesktop.SetActiveProject("LinearSimulink")
|
|
write_line(report, "ACTIVE_PROJECT", project.GetName())
|
|
|
|
try:
|
|
write_line(report, "TOP_DESIGNS", project.GetTopDesignList())
|
|
except Exception as exc:
|
|
write_line(report, "TOP_DESIGNS_ERROR", repr(exc))
|
|
|
|
design = project.SetActiveDesign("Simplorer2")
|
|
write_line(report, "ACTIVE_DESIGN", design.GetName())
|
|
write_line(report, "DESIGN_TYPE", design.GetDesignType())
|
|
|
|
try:
|
|
setup_module = design.GetModule("SimSetup")
|
|
write_line(report, "SETUPS", setup_module.GetSetups())
|
|
except Exception as exc:
|
|
write_line(report, "SETUPS_ERROR", repr(exc))
|
|
|
|
try:
|
|
editor = design.SetActiveEditor("SchematicEditor")
|
|
write_line(report, "EDITOR", editor)
|
|
write_line(report, "ALL_ELEMENTS", editor.GetAllElements())
|
|
except Exception as exc:
|
|
write_line(report, "EDITOR_ERROR", repr(exc))
|
|
|
|
try:
|
|
messages = oDesktop.GetMessages("LinearSimulink", "Simplorer2", 0)
|
|
write_line(report, "MESSAGES", messages)
|
|
except Exception as exc:
|
|
write_line(report, "MESSAGES_ERROR", repr(exc))
|
|
|
|
write_line(report, "PROBE_STATUS", "PASS")
|
|
project.Close()
|
|
except Exception:
|
|
write_line(report, "PROBE_STATUS", "FAIL")
|
|
write_line(report, "TRACEBACK", traceback.format_exc())
|
|
try:
|
|
write_line(report, "DESKTOP_MESSAGES", oDesktop.GetMessages("", "", 0))
|
|
except Exception as message_exc:
|
|
write_line(report, "DESKTOP_MESSAGES_ERROR", repr(message_exc))
|