From 1cfe49262af821f653d877887312b0595fa4472d Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 2 Oct 2026 12:33:56 +0200 Subject: [PATCH] #14828: Do not create a view when creating a grid from the Python API Previously a view was created and ACTNUM displayed when running with GUI. Users can create a view explicitly through the API. Fixes #14828. --- .../ProjectDataModelCommands/RimcProject.cpp | 20 +------------------ .../tests/test_export_corner_point_grid.py | 15 ++++++++++++++ 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcProject.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcProject.cpp index df9d0226f1..6f8e6e6caf 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcProject.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcProject.cpp @@ -28,7 +28,6 @@ #include "RiaPreferencesGrid.h" #include "RiaQStringFormatter.h" #include "RiaRegressionTestRunner.h" -#include "RiaResultNames.h" #include "ExportCommands/RicSnapshotAllPlotsToFileFeature.h" #include "ExportCommands/RicSnapshotAllViewsToFileFeature.h" @@ -46,8 +45,6 @@ #include "RimCase.h" #include "RimCornerPointCase.h" #include "RimEclipseCaseCollection.h" -#include "RimEclipseCellColors.h" -#include "RimEclipseView.h" #include "RimFileSummaryCase.h" #include "RimGeneric3dView.h" #include "RimGenericViewCollection.h" @@ -324,22 +321,7 @@ std::expected RimProject_createGridFromKeyValues RimMainPlotCollection::current()->ensureDefaultFlowPlotsAreCreated(); - if ( RiaGuiApplication::isRunning() ) - { - if ( RimEclipseView* riv = grid->createAndAddReservoirView() ) - { - riv->loadDataAndUpdate(); - - if ( !riv->cellResult()->hasResult() ) - { - riv->cellResult()->setResultVariable( RiaResultNames::undefinedResultName() ); - } - - analysisModels->updateConnectedEditors(); - - if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->selectAsCurrentItem( riv->cellResult() ); - } - } + analysisModels->updateConnectedEditors(); keyValueStore->remove( m_coordKey().toStdString() ); keyValueStore->remove( m_zcornKey().toStdString() ); diff --git a/GrpcInterface/Python/rips/tests/test_export_corner_point_grid.py b/GrpcInterface/Python/rips/tests/test_export_corner_point_grid.py index 67aa879e74..14660b3f4f 100644 --- a/GrpcInterface/Python/rips/tests/test_export_corner_point_grid.py +++ b/GrpcInterface/Python/rips/tests/test_export_corner_point_grid.py @@ -204,6 +204,21 @@ def test_create_corner_point_grid_geometry_properties(rips_instance, initialize_ assert values["DEPTH"][active_index] == pytest.approx(1050.0 + k * 100.0) +def test_create_corner_point_grid_does_not_create_view(rips_instance, initialize_test): + """Creating a grid from the python API must not create a view (issue #14828).""" + + nx, ny, nz = 1, 1, 1 + coord = [0, 0, 1000, 0, 0, 1100] * 4 + zcorn = [1000] * 4 + [1100] * 4 + actnum = [1] + + case = rips_instance.project.create_corner_point_grid( + "NoViewGrid", nx, ny, nz, coord, zcorn, actnum + ) + + assert len(case.views()) == 0 + + def test_export_corner_point_grid_return_types(rips_instance, initialize_test): """Test that export_corner_point_grid returns the correct types"""