How to use ET GeoWizards functionality in .NET

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

There are two ways to execute the functionality of ET GeoWizards 12 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 ETGWRun.exe
     Dim ETRunPath As String = "C:\Program Files\ETSpatial Techniques\ETGeo Wizards\ETGWRun.exe"
     'We are going to use the Explode Multipart Features for thei example
     Dim sFunction As String = "ExplodeMultipart"
     '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\aaaa.shp" & Chr(34)
     'Set the full name of the output
     Dim sOutFN As String = Chr(34) & "C:\testData\0000result3.shp" & Chr(34)
     'Execute the ExplodeMultipart function
     Dim sArgumentList As String = sFunction & " " & sInDataset & " " & sOutFN
     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 GeoWizards 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 GeoWizards 12 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 ETGWOutRun
     Dim ETGWOut As ETGWOutX.ETGWOutRun = New ETGWOutX.ETGWOutRun(True)
     'We are going to use the Explode Multipart Features for the example
     'Set the input dataset with the full path to the shapefile
     Dim sInDataset As String = "C:\testData\input.shp
"
     'Set the full name of the output
     Dim sOutFN As String = "C:\testData\result.shp
"
     'Execute the ExplodeMultipart function
     Dim iResult As Integer = ETGWOut.ExplodeMultipart(sInDataset, sOutFN)
     '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