Helix 3D Toolkit – Well Viewer Part 1

I've done a little work in the oil & gas industry. A common need in applications is to show a 3D plot of a well. My first rendition of a 3D well plot, I made in Excel. It was rather crude, and used a 3D to 2D orthographic transformation. Using this transform will let you plot a wireframe drawing onto a simple XY scatter plot type chart.

It's not beautiful or elegant but it works. But what if you want a more elegant plot? Something that looks a little better. If you're using WPF you have access to a decent 3D graphics rendering engine. Helix Toolkit gives you a little extra goodness. In this post I'll show you how I rendered a 3D well profile with Helix 3D toolkit.

Helix wraps the core WPF 3D functionality, to provide an extra level of sweetness and ease of use. One downfall of the project is the documentation. It is almost non-existent. But, the source code does have a great suite of sample applications. And as you should know, code samples are worth thousands of words :)

After looking through several of the 3D examples I was able to start piecing the chunks together. Helix support databinding making it simple to test your view-models. High level classes such as the Helix3DViewport provides panning, zooming, and rotation. This makes developing a sophisticated looking viewport very simple.

For my implementation of a well plot, I decided to have a small preview plot, and a larger window with 3D controls.

This larger window gives the user a more immersive 3D experience and a rich set of controls.

Get the Code: Github Gist

Issues: I did run into one issue. The preview plot uses one view instance. When a user clicks on a well, a new WellSurveyPlotViewModel is instantiated and the data context of the preview is updated. Opening the larger well viewer uses a window service to create a new window passing the WellSurveyPlotViewModel as its data context. The view refused to zoom to extents with the new camera information. After reading the source code I arrived at the idea of using an attached property to solve the issue. The following two lines, in an attached property hooked into a ReZoom boolean property in the preview view model solved the issue.

  viewport.Camera = viewport.DefaultCamera;
  viewport.ZoomExtents();

This toolkit is great! Using Helix, I was able to create the 3D well plot during a weekend of several short coding sessions. In an upcoming post I'll enhance the well viewer to provide a few more capabilities.