mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Make modeled well paths scriptable
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
# Load ResInsight Processing Server Client Library
|
||||
import rips
|
||||
# Connect to ResInsight instance
|
||||
resinsight = rips.Instance.find()
|
||||
# Example code
|
||||
print("ResInsight version: " + resinsight.version_string())
|
||||
|
||||
modeled_well_paths = resinsight.project.descendants(rips.ModeledWellPath)
|
||||
|
||||
for wellpath in modeled_well_paths:
|
||||
geometry = wellpath.well_path_geometry()
|
||||
geometry.print_object_info()
|
||||
reference_point = geometry.reference_point
|
||||
reference_point[0] += 100
|
||||
geometry.update()
|
||||
geometry.print_object_info()
|
||||
@@ -31,6 +31,8 @@
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathFracture.h"
|
||||
#include "RimWellPathFractureCollection.h"
|
||||
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimModeledWellPath, "ModeledWellPath" );
|
||||
@@ -40,12 +42,18 @@ CAF_PDM_SOURCE_INIT( RimModeledWellPath, "ModeledWellPath" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimModeledWellPath::RimModeledWellPath()
|
||||
{
|
||||
CAF_PDM_InitScriptableObject( "Modeled WellPath",
|
||||
CAF_PDM_InitScriptableObject( "Modeled Well Path",
|
||||
":/EditableWell.png",
|
||||
"",
|
||||
"A Well Path created interactively in ResInsight" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_geometryDefinition, "WellPathGeometryDef", "Trajectory", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithScriptKeywordNoDefault( &m_geometryDefinition,
|
||||
"WellPathGeometryDef",
|
||||
"WellPathGeometry",
|
||||
"Trajectory",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
m_geometryDefinition = new RimWellPathGeometryDef;
|
||||
|
||||
// Required, as these settings are set in RimWellPath()
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#include "RiuViewerCommands.h"
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
#include "cafPdmFieldScriptingCapabilityCvfVec3d.h"
|
||||
#include "cafPdmObjectScriptingCapability.h"
|
||||
#include "cafPdmUiDoubleValueEditor.h"
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
@@ -44,7 +46,7 @@
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "cvfGeometryTools.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimWellPathGeometryDef, "WellPathGeometryDef" );
|
||||
CAF_PDM_SOURCE_INIT( RimWellPathGeometryDef, "WellPathGeometryDef", "WellPathGeometry" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -52,29 +54,41 @@ CAF_PDM_SOURCE_INIT( RimWellPathGeometryDef, "WellPathGeometryDef" );
|
||||
RimWellPathGeometryDef::RimWellPathGeometryDef()
|
||||
: m_pickTargetsEventHandler( new RicCreateWellTargetsPickEventHandler( this ) )
|
||||
{
|
||||
CAF_PDM_InitObject( "Well Targets", ":/WellTargets.png", "", "" );
|
||||
CAF_PDM_InitScriptableObjectWithNameAndComment( "Well Targets",
|
||||
":/WellTargets.png",
|
||||
"",
|
||||
"",
|
||||
"WellPathGeometry",
|
||||
"Class containing the geometry of a modeled Well Path" );
|
||||
|
||||
this->setUi3dEditorTypeName( RicWellPathGeometry3dEditor::uiEditorTypeName() );
|
||||
CAF_PDM_InitField( &m_referencePointUtmXyd, "ReferencePosUtmXyd", cvf::Vec3d( 0, 0, 0 ), "UTM Reference Point", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldWithScriptKeyword( &m_referencePointUtmXyd,
|
||||
"ReferencePosUtmXyd",
|
||||
"ReferencePoint",
|
||||
cvf::Vec3d( 0, 0, 0 ),
|
||||
"UTM Reference Point",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
|
||||
CAF_PDM_InitField( &m_airGap, "AirGap", 0.0, "Air Gap", "", "", "" );
|
||||
CAF_PDM_InitScriptableField( &m_airGap, "AirGap", 0.0, "Air Gap", "", "", "" );
|
||||
m_airGap.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() );
|
||||
CAF_PDM_InitField( &m_mdAtFirstTarget, "MdAtFirstTarget", 0.0, "MD at First Target", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_wellTargets, "WellPathTargets", "Well Targets", "", "", "" );
|
||||
CAF_PDM_InitScriptableField( &m_mdAtFirstTarget, "MdAtFirstTarget", 0.0, "MD at First Target", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_wellTargets, "WellPathTargets", "Well Targets", "", "", "" );
|
||||
m_wellTargets.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() );
|
||||
m_wellTargets.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
m_wellTargets.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
|
||||
m_wellTargets.uiCapability()->setCustomContextMenuEnabled( true );
|
||||
|
||||
CAF_PDM_InitField( &m_useAutoGeneratedTargetAtSeaLevel,
|
||||
"UseAutoGeneratedTargetAtSeaLevel",
|
||||
true,
|
||||
"Generate Target at Sea Level",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
CAF_PDM_InitScriptableField( &m_useAutoGeneratedTargetAtSeaLevel,
|
||||
"UseAutoGeneratedTargetAtSeaLevel",
|
||||
true,
|
||||
"Generate Target at Sea Level",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_autoTargetAtSeaLevel, "AutoGeneratedTarget", "Auto Generated Target", "", "", "" );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_autoTargetAtSeaLevel, "AutoGeneratedTarget", "Auto Generated Target", "", "", "" );
|
||||
m_autoTargetAtSeaLevel = new RimWellPathTarget;
|
||||
m_autoTargetAtSeaLevel->setEnabled( false );
|
||||
|
||||
|
||||
@@ -150,6 +150,10 @@ RifReaderEclipseRft* RimFileSummaryCase::findRftDataAndCreateReader( const QStri
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifSummaryReaderInterface* RimFileSummaryCase::summaryReader()
|
||||
{
|
||||
if ( m_summaryFileReader.isNull() )
|
||||
{
|
||||
createSummaryReaderInterface();
|
||||
}
|
||||
return m_summaryFileReader.p();
|
||||
}
|
||||
|
||||
@@ -158,6 +162,10 @@ RifSummaryReaderInterface* RimFileSummaryCase::summaryReader()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifReaderRftInterface* RimFileSummaryCase::rftReader()
|
||||
{
|
||||
if ( m_summaryEclipseRftReader.isNull() )
|
||||
{
|
||||
createRftReaderInterface();
|
||||
}
|
||||
return m_summaryEclipseRftReader.p();
|
||||
}
|
||||
|
||||
|
||||
@@ -191,6 +191,10 @@ void RimGridSummaryCase::createSummaryReaderInterface()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifSummaryReaderInterface* RimGridSummaryCase::summaryReader()
|
||||
{
|
||||
if ( m_summaryFileReader.isNull() )
|
||||
{
|
||||
createSummaryReaderInterface();
|
||||
}
|
||||
return m_summaryFileReader.p();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user