Files
Kristian Bendiksen 7899736f05 Python ruff fixes
* Python: Clean up imports.
* Python: Clean up error handling example.
* Python: Remove unused local variables
* Python: Avoid comparing against True/False.
* Python: Remove unused name variable.
* Python: Reuse class definition type variable.
* Python: Fix more unused imports
* Black fixes
2025-05-16 15:46:45 +02:00

30 lines
827 B
Python

"""
ResInsight 2d plot module
"""
import Commands_pb2
from .pdmobject import add_method
from .resinsight_classes import PlotWindow as PlotWindow, Plot as Plot
@add_method(PlotWindow)
def export_snapshot(self, export_folder="", file_prefix="", output_format="PNG"):
"""Export snapshot for the current plot
Arguments:
export_folder(str): The path to export to. By default will use the global export folder
prefix (str): Exported file name prefix
output_format(str): Enum string. Can be 'PNG' or 'PDF'.
"""
return self._execute_command(
exportSnapshots=Commands_pb2.ExportSnapshotsRequest(
type="PLOTS",
prefix=file_prefix,
viewId=self.id,
exportFolder=export_folder,
plotOutputFormat=output_format,
)
)