The startup_code.py module#

Summary#

save_matplotlib_plot

Save a Matplotlib plot to a file and optionally return as base64.

save_pyvista_plot

Save a PyVista plot to a file and optionally return as base64.

get_aedt_version

Get the PyAEDT version.

list_aedt_applications

List available AEDT applications.

Description#

Startup code for a persistent Python session in PyAEDT-MCP.

This module is executed when a persistent Python session is started for running user code in the MCP server context.

Module detail#

startup_code.save_matplotlib_plot(filename='plot.png', return_base64=False, dpi=150)#

Save a Matplotlib plot to a file and optionally return as base64.

Uses the current Matplotlib figure.

Parameters:
filenamestr, default: "plot.png"

Output filename.

return_base64bool, default: False

Whether to return the plot as base64-encoded image data.

dpiint, default: 150

Resolution in dots per inch.

Returns:
str

File path or base64 data URI.

startup_code.save_pyvista_plot(plotter, filename='plot.png', return_base64=False)#

Save a PyVista plot to a file and optionally return as base64.

Parameters:
plotterpv.Plotter

PyVista plotter to save.

filenamestr, default: "plot.png"

Output filename.

return_base64bool, default: False

Whether to return the plot as base64-encoded image data.

Returns:
str

File path or base64 data URI.

startup_code.get_aedt_version()#

Get the PyAEDT version.

startup_code.list_aedt_applications()#

List available AEDT applications.

startup_code.MATPLOTLIB_AVAILABLE = True#
startup_code.PYVISTA_AVAILABLE = True#
startup_code.PIL_AVAILABLE = True#