#13562 Add python api for getting parent well path

Fixes #13562.
This commit is contained in:
Kristian Bendiksen committed 2026-02-06 13:32:22 +01:00
1 parent 9ad2a76f1d
commit 0dfbcd34f6
4 files changed
+115 -1

No files matched your search

@@ -45,6 +45,7 @@
#include "RimWellPathCollection.h"
#include "RimWellPathCompletionSettings.h"
#include "RimWellPathFracture.h"
#include "RimWellPathTieIn.h"
#include "RigDoglegTools.h"
#include "RigStimPlanModelTools.h"
@@ -695,3 +696,36 @@ std::expected<caf::PdmObjectHandle*, QString> RimcWellPath_appendLateralFromGeom
return nullptr;
}
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimWellPath, RimcWellPath_parentBranch, "ParentBranch" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimcWellPath_parentBranch::RimcWellPath_parentBranch( caf::PdmObjectHandle* self )
: PdmObjectMethod( self, PdmObjectMethod::NullPointerType::NULL_IS_VALID, PdmObjectMethod::ResultType::PERSISTENT_TRUE )
{
CAF_PDM_InitObject( "Parent Branch", "", "", "Parent Branch" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::expected<caf::PdmObjectHandle*, QString> RimcWellPath_parentBranch::execute()
{
auto wellPath = self<RimWellPath>();
if ( wellPath->isTopLevelWellPath() ) return nullptr;
if ( wellPath->wellPathTieIn() ) return wellPath->wellPathTieIn()->parentWell();
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimcWellPath_parentBranch::classKeywordReturnedType() const
{
return RimWellPath::classKeywordStatic();
}
@@ -182,3 +182,17 @@ public:
private:
caf::PdmPtrField<RimWellPath*> m_lateral;
};
//==================================================================================================
///
//==================================================================================================
class RimcWellPath_parentBranch : public caf::PdmObjectMethod
{
CAF_PDM_HEADER_INIT;
public:
RimcWellPath_parentBranch( caf::PdmObjectHandle* self );
std::expected<caf::PdmObjectHandle*, QString> execute() override;
QString classKeywordReturnedType() const override;
};