mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
* #7797 Well Targets: Add scripting capability * #7794 Python : Do not update childField or childFieldArray * #7797: Python - Add scripting to well path collection - Extend the pdmobject.py with method add_object() - allow objects to be created from Python in well path collections - add well targets to modelled well path * #7795 Python : Make sure referenced generated classes are defined * #7810 StimPlanModel: clean-up python generation * Python : Always use empty string as default value for ptrFieldValue It can happen that a ptrField is assigned to a pointer on object construction. (FaciesProperties) Make sure that constructor always assigns an empty string. Co-authored-by: magnesj <magnesj@users.noreply.github.com> Co-authored-by: Kristian Bendiksen <kristian.bendiksen@gmail.com>
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
from rips.generated.generated_classes import (
|
|
ModeledWellPath,
|
|
StimPlanModel,
|
|
WellPathGeometry,
|
|
WellPathTarget,
|
|
)
|
|
import sys
|
|
import os
|
|
|
|
sys.path.insert(1, os.path.join(sys.path[0], "../../"))
|
|
import rips
|
|
|
|
|
|
def test_well_path_target(rips_instance, initialize_test):
|
|
well_path_coll = rips_instance.project.descendants(rips.WellPathCollection)[0]
|
|
|
|
my_well_path = well_path_coll.add_new_object(rips.ModeledWellPath)
|
|
my_well_path.name = "test"
|
|
my_well_path.update()
|
|
|
|
geometry = my_well_path.well_path_geometry()
|
|
geometry.add_new_object(rips.WellPathTarget)
|
|
geometry.add_new_object(rips.WellPathTarget)
|
|
geometry.add_new_object(rips.WellPathTarget)
|
|
assert len(geometry.well_path_targets()) == 3
|
|
|
|
assert len(well_path_coll.well_paths()) == 1
|
|
my_well_path_duplicate = well_path_coll.well_paths()[0]
|
|
assert my_well_path_duplicate.name == "test"
|
|
geometry_duplicate = my_well_path_duplicate.well_path_geometry()
|
|
assert len(geometry_duplicate.well_path_targets()) == 3
|
|
|
|
# Not allowed to add object of unrelated type
|
|
invalid_object = geometry.add_new_object(rips.WellPath)
|
|
assert invalid_object is None
|