Files
ResInsight/ApplicationCode/GrpcInterface/Python/rips/plot.py
T

35 lines
1.3 KiB
Python
Raw Normal View History

"""
ResInsight 2d plot module
"""
import rips.generated.Commands_pb2 as Cmd
from rips.pdmobject import PdmObject
class Plot(PdmObject):
"""ResInsight plot class
Attributes:
view_id(int): View Id corresponding to the View Id in ResInsight project.
"""
def __init__(self, pdm_object):
2019-10-09 10:51:24 +02:00
PdmObject.__init__(self, pdm_object.pb2_object(), pdm_object.channel(), pdm_object.project())
self.view_id = pdm_object.get_value("ViewId")
2020-01-21 12:36:22 +01:00
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
2020-01-21 12:36:22 +01:00
output_format(str): Enum string. Can be 'PNG' or 'PDF'.
"""
return self._execute_command(
exportSnapshots=Cmd.ExportSnapshotsRequest(type='PLOTS',
prefix=file_prefix,
viewId=self.view_id,
2020-01-21 12:36:22 +01:00
exportFolder=export_folder,
plotOutputFormat=output_format))
2020-01-21 08:48:56 +01:00