diff --git a/GrpcInterface/Python/rips/case.py b/GrpcInterface/Python/rips/case.py index 963ddb4493..4360c82489 100644 --- a/GrpcInterface/Python/rips/case.py +++ b/GrpcInterface/Python/rips/case.py @@ -1008,8 +1008,10 @@ def simulation_wells(self): :class:`rips.generated.generated_classes.SimulationWell` """ - wells = self.descendants(SimulationWell) - return wells + if self.views(): + # Use the first view to get simulation wells. + return self.views()[0].descendants(SimulationWell) + return [] @add_method(Case) diff --git a/GrpcInterface/Python/rips/simulation_well.py b/GrpcInterface/Python/rips/simulation_well.py index 7c29d1c4e0..9b6f1b3e81 100644 --- a/GrpcInterface/Python/rips/simulation_well.py +++ b/GrpcInterface/Python/rips/simulation_well.py @@ -14,6 +14,7 @@ from .resinsight_classes import SimulationWell from .case import Case +from .view import View from .pdmobject import PdmObjectBase, add_method from typing import List, Optional @@ -80,4 +81,8 @@ def cells( @add_method(SimulationWell) def case(self: SimulationWell) -> Optional[Case]: - return self.ancestor(Case) + view = self.ancestor(View) + if view: + return view.case() + else: + return None