Make RimWellPathCompletionSettings scriptable

Support scripting of wellNameForExport, GroupNameForExport, MswLinerDiameter, MswRoutghness, Preferred Fluid Phase scriptable
This commit is contained in:
Magne Sjaastad 2023-11-03 15:46:19 +01:00
parent 508ab90487
commit b1d1c397d4
3 changed files with 58 additions and 5 deletions

View File

@ -24,6 +24,8 @@
#include "RimWellPath.h" #include "RimWellPath.h"
#include "cafPdmDoubleStringValidator.h" #include "cafPdmDoubleStringValidator.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmUiLineEditor.h" #include "cafPdmUiLineEditor.h"
#include "cafPdmUiOrdering.h" #include "cafPdmUiOrdering.h"
#include "cafPdmUiTreeOrdering.h" #include "cafPdmUiTreeOrdering.h"
@ -79,13 +81,13 @@ CAF_PDM_SOURCE_INIT( RimWellPathCompletionSettings, "WellPathCompletionSettings"
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimWellPathCompletionSettings::RimWellPathCompletionSettings() RimWellPathCompletionSettings::RimWellPathCompletionSettings()
{ {
CAF_PDM_InitObject( "Completion Settings", ":/CompletionsSymbol16x16.png" ); CAF_PDM_InitScriptableObject( "Completion Settings", ":/CompletionsSymbol16x16.png" );
CAF_PDM_InitField( &m_wellNameForExport, "WellNameForExport", QString(), "Well Name" ); CAF_PDM_InitScriptableField( &m_wellNameForExport, "WellNameForExport", QString(), "Well Name" );
m_wellNameForExport.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); m_wellNameForExport.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_groupName, "WellGroupNameForExport", QString(), "Group Name" ); CAF_PDM_InitScriptableFieldWithScriptKeyword( &m_groupName, "WellGroupNameForExport", "GroupNameForExport", QString(), "Group Name" );
CAF_PDM_InitField( &m_referenceDepth, "ReferenceDepthForExport", QString(), "Reference Depth for BHP" ); CAF_PDM_InitField( &m_referenceDepth, "ReferenceDepthForExport", QString(), "Reference Depth for BHP" );
CAF_PDM_InitFieldNoDefault( &m_preferredFluidPhase, "WellTypeForExport", "Preferred Fluid Phase" ); CAF_PDM_InitScriptableFieldNoDefault( &m_preferredFluidPhase, "WellTypeForExport", "Preferred Fluid Phase" );
CAF_PDM_InitField( &m_drainageRadiusForPI, "DrainageRadiusForPI", QString( "0.0" ), "Drainage Radius for PI" ); CAF_PDM_InitField( &m_drainageRadiusForPI, "DrainageRadiusForPI", QString( "0.0" ), "Drainage Radius for PI" );
CAF_PDM_InitFieldNoDefault( &m_gasInflowEquation, "GasInflowEq", "Gas Inflow Equation" ); CAF_PDM_InitFieldNoDefault( &m_gasInflowEquation, "GasInflowEq", "Gas Inflow Equation" );
CAF_PDM_InitFieldNoDefault( &m_automaticWellShutIn, "AutoWellShutIn", "Automatic well shut-in" ); CAF_PDM_InitFieldNoDefault( &m_automaticWellShutIn, "AutoWellShutIn", "Automatic well shut-in" );
@ -98,6 +100,14 @@ RimWellPathCompletionSettings::RimWellPathCompletionSettings()
m_mswParameters = new RimMswCompletionParameters; m_mswParameters = new RimMswCompletionParameters;
m_mswParameters.uiCapability()->setUiTreeHidden( true ); m_mswParameters.uiCapability()->setUiTreeHidden( true );
m_mswParameters.uiCapability()->setUiTreeChildrenHidden( true ); m_mswParameters.uiCapability()->setUiTreeChildrenHidden( true );
CAF_PDM_InitScriptableFieldNoDefault( &m_mswLinerDiameter, "MswLinerDiameter", "MSW Liner Diameter" );
m_mswLinerDiameter.registerGetMethod( this, &RimWellPathCompletionSettings::mswLinerDiameter );
m_mswLinerDiameter.registerSetMethod( this, &RimWellPathCompletionSettings::setMswLinerDiameter );
CAF_PDM_InitScriptableFieldNoDefault( &m_mswRoughness, "MswRoughness", "MSW Roughness" );
m_mswRoughness.registerGetMethod( this, &RimWellPathCompletionSettings::mswRoughness );
m_mswRoughness.registerSetMethod( this, &RimWellPathCompletionSettings::setMswRoughness );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -361,3 +371,35 @@ QString RimWellPathCompletionSettings::formatStringForExport( const QString& tex
if ( text.contains( ' ' ) ) return QString( "'%1'" ).arg( text ); if ( text.contains( ' ' ) ) return QString( "'%1'" ).arg( text );
return text; return text;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletionSettings::setMswRoughness( const double& roughness )
{
m_mswParameters->setRoughnessFactor( roughness );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimWellPathCompletionSettings::mswRoughness() const
{
return m_mswParameters->roughnessFactor();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathCompletionSettings::setMswLinerDiameter( const double& diameter )
{
m_mswParameters->setLinerDiameter( diameter );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimWellPathCompletionSettings::mswLinerDiameter() const
{
return m_mswParameters->linerDiameter();
}

View File

@ -20,6 +20,7 @@
#include "cafPdmChildField.h" #include "cafPdmChildField.h"
#include "cafPdmField.h" #include "cafPdmField.h"
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cafPdmProxyValueField.h"
class RimMswCompletionParameters; class RimMswCompletionParameters;
class RimWellPathCompletionsLegacy; class RimWellPathCompletionsLegacy;
@ -93,6 +94,11 @@ protected:
private: private:
QString formatStringForExport( const QString& text, const QString& defaultText = "" ) const; QString formatStringForExport( const QString& text, const QString& defaultText = "" ) const;
void setMswRoughness( const double& roughness );
double mswRoughness() const;
void setMswLinerDiameter( const double& diameter );
double mswLinerDiameter() const;
private: private:
friend class RimWellPathCompletions; friend class RimWellPathCompletions;
@ -110,4 +116,9 @@ private:
caf::PdmField<int> m_fluidInPlaceRegion; caf::PdmField<int> m_fluidInPlaceRegion;
caf::PdmChildField<RimMswCompletionParameters*> m_mswParameters; caf::PdmChildField<RimMswCompletionParameters*> m_mswParameters;
// Use proxy fields for selected parameters in RimMswCompletionParameters, so it is possible to modify these values from the same
// scripting object
caf::PdmProxyValueField<double> m_mswLinerDiameter;
caf::PdmProxyValueField<double> m_mswRoughness;
}; };

View File

@ -129,7 +129,7 @@ RimWellPath::RimWellPath()
m_completions = new RimWellPathCompletions; m_completions = new RimWellPathCompletions;
m_completions.uiCapability()->setUiTreeHidden( true ); m_completions.uiCapability()->setUiTreeHidden( true );
CAF_PDM_InitFieldNoDefault( &m_completionSettings, "CompletionSettings", "Completion Settings" ); CAF_PDM_InitScriptableFieldNoDefault( &m_completionSettings, "CompletionSettings", "Completion Settings" );
m_completionSettings = new RimWellPathCompletionSettings; m_completionSettings = new RimWellPathCompletionSettings;
CAF_PDM_InitFieldNoDefault( &m_wellLogFiles, "WellLogFiles", "Well Log Files" ); CAF_PDM_InitFieldNoDefault( &m_wellLogFiles, "WellLogFiles", "Well Log Files" );