diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcWellEventTimeline.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcWellEventTimeline.cpp index c19c8de100..c7fee530f1 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcWellEventTimeline.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcWellEventTimeline.cpp @@ -21,7 +21,6 @@ #include "CompletionExportCommands/RicScheduleDataGenerator.h" #include "RimEclipseCase.h" #include "RimKeywordEvent.h" -#include "RimProject.h" #include "RimWellEventControl.h" #include "RimWellEventKeyword.h" #include "RimWellEventPerf.h" @@ -30,7 +29,6 @@ #include "RimWellEventTubing.h" #include "RimWellEventValve.h" #include "RimWellPath.h" -#include "RimWellPathCollection.h" #include "RimcDataContainerString.h" #include "cafAppEnum.h" @@ -569,7 +567,7 @@ RimcWellEventTimeline_generateSchedule::RimcWellEventTimeline_generateSchedule( { CAF_PDM_InitObject( "Generate Schedule", "", "", "Generate Eclipse schedule text for all wells in the collection" ); - CAF_PDM_InitScriptableField( &m_eclipseCaseId, "EclipseCaseId", -1, "", "", "", "Eclipse Case ID" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_eclipseCase, "EclipseCase", "", "", "", "Eclipse Case" ); CAF_PDM_InitScriptableField( &m_includeWelsegs, "IncludeWelsegs", true, "", "", "", "Include WELSEGS keyword in the exported schedule" ); CAF_PDM_InitScriptableField( &m_includeCompsegs, "IncludeCompsegs", true, "", "", "", "Include COMPSEGS keyword in the exported schedule" ); } @@ -581,24 +579,10 @@ std::expected RimcWellEventTimeline_generateSche { auto timeline = self(); - // Get the parent well path collection - RimWellPathCollection* wellPathCollection = timeline->firstAncestorOrThisOfType(); - if ( !wellPathCollection ) - { - return std::unexpected( QString( "Could not find parent well path collection" ) ); - } - - // Find the Eclipse case by ID - RimProject* project = wellPathCollection->firstAncestorOrThisOfType(); - if ( !project ) - { - return std::unexpected( QString( "Could not find project" ) ); - } - - RimEclipseCase* eclipseCase = project->eclipseCaseFromCaseId( m_eclipseCaseId() ); + RimEclipseCase* eclipseCase = m_eclipseCase(); if ( !eclipseCase ) { - return std::unexpected( QString( "Eclipse case with ID %1 not found" ).arg( m_eclipseCaseId() ) ); + return std::unexpected( QString( "Eclipse case is required" ) ); } // Get the last applied timestamp (from set_timestamp call) diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcWellEventTimeline.h b/ApplicationLibCode/ProjectDataModelCommands/RimcWellEventTimeline.h index 3e32193b17..bff6e758b1 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcWellEventTimeline.h +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcWellEventTimeline.h @@ -225,7 +225,7 @@ public: QString classKeywordReturnedType() const override; private: - caf::PdmField m_eclipseCaseId; - caf::PdmField m_includeWelsegs; - caf::PdmField m_includeCompsegs; + caf::PdmPtrField m_eclipseCase; + caf::PdmField m_includeWelsegs; + caf::PdmField m_includeCompsegs; }; diff --git a/GrpcInterface/Python/rips/well_events.py b/GrpcInterface/Python/rips/well_events.py index 652138d0e9..68ff0f6b77 100644 --- a/GrpcInterface/Python/rips/well_events.py +++ b/GrpcInterface/Python/rips/well_events.py @@ -10,7 +10,7 @@ from typing import Any, Dict from datetime import date, datetime from .pdmobject import add_method -from .resinsight_classes import Case +from .resinsight_classes import EclipseCase from .generated.generated_classes import ( KeywordEvent, WellEventKeyword, @@ -283,7 +283,7 @@ def add_keyword_event( @add_method(WellEventTimeline) def generate_schedule_text( self: WellEventTimeline, - eclipse_case: Case, + eclipse_case: EclipseCase, include_welsegs: bool = True, include_compsegs: bool = True, ) -> str: @@ -297,7 +297,7 @@ def generate_schedule_text( text directly instead of a DataContainerString. Arguments: - eclipse_case (Case): Eclipse case to use for schedule generation. + eclipse_case (EclipseCase): Eclipse case to use for schedule generation. include_welsegs (bool): When False, omit the WELSEGS keyword from the output. Other multi-segment-well keywords (COMPSEGS, WSEGVALV, WSEGAICD) are not affected. Defaults to True. @@ -342,7 +342,7 @@ def generate_schedule_text( ``` """ container = self.generate_schedule( - eclipse_case_id=eclipse_case.id, + eclipse_case=eclipse_case, include_welsegs=include_welsegs, include_compsegs=include_compsegs, )