02.05.2014 Views

Ocean for Petrel Plugin Creation - Ocean - Schlumberger

Ocean for Petrel Plugin Creation - Ocean - Schlumberger

Ocean for Petrel Plugin Creation - Ocean - Schlumberger

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Protected override void<br />

InvokeSimpleCore(WellFromPoints.Arguments argumentPackage)<br />

{<br />

// Set up input argument variables from argumentPackage<br />

PointSet pointset = argumentPackage.InputPoints;<br />

Borehole result = argumentPackage.Result;<br />

String boreholename = argumentPackage.Name;<br />

BoreholeCollection folder = argumentPackage.BoreholeCollection;<br />

// Start a transaction <strong>for</strong> the process<br />

using (ITransaction trans = DataManager.NewTransaction())<br />

{<br />

// If a not specified, create a new Borehole<br />

if (result == null)<br />

{<br />

if (folder == null)<br />

{<br />

Project p = <strong>Petrel</strong>Project.PrimaryProject;<br />

folder = BoreholeCollection.GetRootBoreholeCollection(p);<br />

}<br />

trans.Lock(folder);<br />

// if not supplied, set Borehole name to “wildcat”<br />

if (boreholename == null) boreholename = "wildcat";<br />

result = folder.CreateBorehole(boreholename);<br />

// New Borehole is locked implicitly.<br />

}<br />

else {<br />

// Lock the Borehole since we’ll be modifying it<br />

trans.Lock(result);<br />

}<br />

// Set the Kelly Bushing value <strong>for</strong> the well.<br />

result.KellyBushing = 100.0f;<br />

// Set the location of the well as the first point in the set<br />

<strong>for</strong>each (Point3 p in pointset.Points)<br />

{<br />

result.WellHead = new Point2(p.X, p.Y);<br />

}<br />

break;<br />

}<br />

}<br />

// Make a polyline from the points and append it to the well.<br />

// Note that this is an append, so executing the workstep twice<br />

// on the same well will loop and duplicate the trajectory.<br />

// When replacing the trajectory of an existing Borehole,<br />

// set Trajectory.Polyline, instead of calling AppendPolyline<br />

IPolyline3 polyline = new Polyline3(pointset.Points);<br />

result.Trajectory.AppendPolyline(polyline);<br />

wildCat.AppendPolylineTrajectory(polyline);<br />

// Commit the data created in the transaction to the data store.<br />

trans.Commit();<br />

// Set the output argument to the new borehole.<br />

argumentPackage.Result = result;<br />

Figure 3-7 WellsFromPoints InvokeSimpleCore method code.<br />

15. Build the solution to make sure it compiles. We’ll describe the running of<br />

the process later.<br />

34

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!