How to use ET Surface functionality in .NET

All the functions of ET Surface 7 can be used in custom applications developed in .NET. The syntax of each ET Surface function is described in the main topic of the function ==> .NET implementation.

There are two ways to execute the functionality of ET Surface in .NET

A. As a separate process - The advantages are:

Example:

Prerequisites

  1. Start Visual Studio
  2. Go to File ==> New ==> Project
  3. Create a button on your form
  4. Double click on the button to start editing the code
  5. Paste the code below
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
     'Set the path to ETSRun.exe
     Dim ETRunPath As String = "C:\Program Files\ETSpatialTechniques\ETSurface\ETSRun.exe"
     'We are going to use the Create TIN function for the example
     Dim sFunction As String = "CreateTin"
     'Set the input dataset with the full path to the shapefile. Note that the Argument separator is space. If a string might contain a space, you need to double quote it.
     Dim sInDataset As String = Chr(34) & "C:\testData\points.shp" & Chr(34)
     'Set the full name of the output
     Dim sOutTin As String = Chr(34) & "C:\testData\PointTin" & Chr(34)
     'Set the name of the field to be used for elevation values.
     Dim sFieldName As String = Chr(34) & "Elevation" & Chr(34)
     'Set the triangulation type.
     Dim sTriangulation As String = Chr(34) & "Point" & Chr(34)
     'Execute the CreateTin function
     Dim sArgumentList As String = sFunction & "  " & sInDataset & "  " & sOutTin & "  " & sFieldName & " " & sTriangulation
     Dim wProc As Diagnostics.Process = New Diagnostics.Process
     Dim procParam As String = sArgumentList
     wProc.StartInfo.FileName = ETRunPath
     wProc.StartInfo.Arguments = procParam
     wProc.Start()
     Dim wProcID As Integer = wProc.Id
     wProc.WaitForExit()
     Dim iResult As Integer
     If wProc.HasExited Then
         'Check the result - iResult = 0 - Success, any other returned value indicate that the function failed.
         iResult = wProc.ExitCode
     If iResult = 0 Then
         MsgBox("Function completed successfully!!!")
     Else
         MsgBox("Problems encountered during the execution!!! See the log file for details.")
          End If
     End If
End Sub

B. Using directly the Core ET Surface DLL

Example:

Prerequisites

  1. Start Visual Studio
  2. Go to File ==> New ==> Project
  3. Go to Project ==> Properties ==> References:
  4. Make sure that your application is 64-Bit
  5. Save the Assembly and Build it.
  6. Copy from the ET Surface 70 installation folder to the folder where your application is the following files
  7. Create a button on your form
  8. Double click on the button to start editing the code
  9. Paste the code below
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
     'Get reference to ETSOutRun
     Dim ETSOut As ETSOutX.ETSOutRun = New ETSOutX.ETSOutRun(True)
     'We are going to use the Create TIN function for the example
     'Set the input dataset with the full path to the shapefile
     Dim sInDataset As String = "C:\testData\Points.shp
"
     'Set the full name of the output
     Dim sOutTin As String = "C:\testData\PointTin
"
     'Set the name of the field to be used for elevation values.
     Dim sFieldName As String = "Elevation"
     'Set the triangulation type.
     Dim sTriangulation As String = "Point"
     'Execute the CreateTIN function
     Dim iResult As Integer = ETSOut.CreateTin(sInDataset, sOutTin, sFieldName, sTriangulation)
     'Check the result - iResult = 0 - Success, any other returned value indicate that the function failed.
     If iResult = 0 Then
          MsgBox("Function completed successfully!!!")
     Else
          MsgBox("Problems encountered during the execution!!! See the log file for details.")
     End If
End Sub