2019-10-09 02:21:28 -05:00
|
|
|
"""
|
|
|
|
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 03:51:24 -05:00
|
|
|
PdmObject.__init__(self, pdm_object.pb2_object(), pdm_object.channel(), pdm_object.project())
|
2019-10-09 02:21:28 -05:00
|
|
|
self.view_id = pdm_object.get_value("ViewId")
|
|
|
|
|
2020-01-21 05:36:22 -06:00
|
|
|
def export_snapshot(self, export_folder='', file_prefix='', output_format='PNG'):
|
2019-10-09 02:21:28 -05:00
|
|
|
""" 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 05:36:22 -06:00
|
|
|
output_format(str): Enum string. Can be 'PNG' or 'PDF'.
|
2019-10-09 02:21:28 -05:00
|
|
|
|
|
|
|
"""
|
|
|
|
return self._execute_command(
|
|
|
|
exportSnapshots=Cmd.ExportSnapshotsRequest(type='PLOTS',
|
|
|
|
prefix=file_prefix,
|
|
|
|
viewId=self.view_id,
|
2020-01-21 05:36:22 -06:00
|
|
|
exportFolder=export_folder,
|
|
|
|
plotOutputFormat=output_format))
|
2019-10-09 02:21:28 -05:00
|
|
|
|
2020-01-21 01:48:56 -06:00
|
|
|
|