Files
ResInsight/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/view_example.py

28 lines
997 B
Python
Raw Normal View History

#############################################################
# This example will alter the views of all cases
# By setting the background color and toggle the grid box
# Also clones the first view
#############################################################
import rips
# Connect to ResInsight instance
2019-09-19 13:25:04 +02:00
resinsight = rips.Instance.find()
# Check if connection worked
2019-09-19 13:25:04 +02:00
if resinsight is not None:
# Get a list of all cases
2019-09-19 13:25:04 +02:00
cases = resinsight.project.cases()
for case in cases:
# Get a list of all views
views = case.views()
for view in views:
# Set some parameters for the view
2019-09-19 14:47:48 +02:00
view.set_show_grid_box(not view.show_grid_box())
view.set_background_color("#3388AA")
# Update the view in ResInsight
view.update()
# Clone the first view
2019-09-19 15:14:01 +02:00
new_view = views[0].clone()
2019-09-19 14:47:48 +02:00
view.set_show_grid_box(False)
2019-09-19 15:14:01 +02:00
new_view.set_background_color("#FFAA33")
new_view.update()