Perforation Interval: make properties scriptable from Python.

This commit is contained in:
Kristian Bendiksen 2023-10-06 09:52:53 +02:00 committed by Magne Sjaastad
parent 445672cbb2
commit db77ea5762
5 changed files with 28 additions and 9 deletions

View File

@ -33,6 +33,9 @@
#include "Riu3DMainWindowTools.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
CAF_PDM_SOURCE_INIT( RimPerforationCollection, "PerforationCollection" );
//--------------------------------------------------------------------------------------------------
@ -40,12 +43,12 @@ CAF_PDM_SOURCE_INIT( RimPerforationCollection, "PerforationCollection" );
//--------------------------------------------------------------------------------------------------
RimPerforationCollection::RimPerforationCollection()
{
CAF_PDM_InitObject( "Perforations", ":/PerforationIntervals16x16.png" );
CAF_PDM_InitScriptableObject( "Perforations", ":/PerforationIntervals16x16.png" );
nameField()->uiCapability()->setUiHidden( true );
setName( "Perforations" );
CAF_PDM_InitFieldNoDefault( &m_perforations, "Perforations", "Perforations" );
CAF_PDM_InitScriptableFieldNoDefault( &m_perforations, "Perforations", "Perforations" );
m_perforations.uiCapability()->setUiTreeHidden( true );
CAF_PDM_InitFieldNoDefault( &m_nonDarcyParameters, "NonDarcyParameters", "Non-Darcy Parameters" );

View File

@ -32,6 +32,7 @@
#include "RimWellPath.h"
#include "RimWellPathValve.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmUiDateEditor.h"
#include "cafPdmUiDoubleSliderEditor.h"
@ -45,10 +46,10 @@ RimPerforationInterval::RimPerforationInterval()
{
CAF_PDM_InitScriptableObject( "Perforation", ":/PerforationInterval16x16.png" );
CAF_PDM_InitField( &m_startMD, "StartMeasuredDepth", 0.0, "Start MD" );
CAF_PDM_InitField( &m_endMD, "EndMeasuredDepth", 0.0, "End MD" );
CAF_PDM_InitField( &m_diameter, "Diameter", 0.216, "Diameter" );
CAF_PDM_InitField( &m_skinFactor, "SkinFactor", 0.0, "Skin Factor" );
CAF_PDM_InitScriptableField( &m_startMD, "StartMeasuredDepth", 0.0, "Start MD" );
CAF_PDM_InitScriptableField( &m_endMD, "EndMeasuredDepth", 0.0, "End MD" );
CAF_PDM_InitScriptableField( &m_diameter, "Diameter", 0.216, "Diameter" );
CAF_PDM_InitScriptableField( &m_skinFactor, "SkinFactor", 0.0, "Skin Factor" );
CAF_PDM_InitField( &m_startOfHistory_OBSOLETE, "StartOfHistory", true, "All Timesteps" );
m_startOfHistory_OBSOLETE.xmlCapability()->setIOWritable( false );

View File

@ -36,6 +36,8 @@
#include "cvfAssert.h"
#include "cafPdmDoubleStringValidator.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmUiDoubleValueEditor.h"
#include "cafPdmUiLineEditor.h"
#include "cafPdmUiTreeOrdering.h"
@ -49,9 +51,9 @@ CAF_PDM_SOURCE_INIT( RimWellPathCompletions, "WellPathCompletions" );
//--------------------------------------------------------------------------------------------------
RimWellPathCompletions::RimWellPathCompletions()
{
CAF_PDM_InitObject( "Completions", ":/CompletionsSymbol16x16.png" );
CAF_PDM_InitScriptableObject( "Completions", ":/CompletionsSymbol16x16.png" );
CAF_PDM_InitFieldNoDefault( &m_perforationCollection, "Perforations", "Perforations" );
CAF_PDM_InitScriptableFieldNoDefault( &m_perforationCollection, "Perforations", "Perforations" );
m_perforationCollection = new RimPerforationCollection;
m_perforationCollection.uiCapability()->setUiTreeHidden( true );

View File

@ -125,7 +125,7 @@ RimWellPath::RimWellPath()
CAF_PDM_InitField( &m_wellPathRadiusScaleFactor, "WellPathRadiusScale", 1.0, "Well Path Radius Scale" );
CAF_PDM_InitField( &m_wellPathColor, "WellPathColor", cvf::Color3f( 0.999f, 0.333f, 0.999f ), "Well Path Color" );
CAF_PDM_InitFieldNoDefault( &m_completions, "Completions", "Completions" );
CAF_PDM_InitScriptableFieldNoDefault( &m_completions, "Completions", "Completions" );
m_completions = new RimWellPathCompletions;
m_completions.uiCapability()->setUiTreeHidden( true );

View File

@ -32,3 +32,16 @@ coord = [1054.28, 250, -50]
target = geometry.append_well_target(coord)
well_path.append_perforation_interval(3300, 3350, 0.2, 0.76)
# Update skin factor of the perforation
perforation_coll = well_path.completions().perforations()
perforation = perforation_coll.perforations()[0]
new_skin_factor = 0.9
print(
"Changing perforation skin factor from {} to {}.".format(
perforation.skin_factor, new_skin_factor
)
)
perforation.skin_factor = new_skin_factor
perforation.update()