How can I export my HeightField to 3D DXF in Voxler Scripter?

This article contains a sample script for opening a Voxler project containing a heightfield module and then exporting to 3D DXF.

To run this script:

  1. Copy the script below, or download the attached BAS file: 3dDXF_Export.BAS.
  2. In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Voxler 4\Scripter.
  3. Double click on Scripter.exe to launch Scripter.
  4. Press Ctrl+A to select all of the existing lines then press Delete.
  5. If you copied this script, press Ctrl+V to paste it into Scripter. If you downloaded it, click File | Open, select the BAS file from your downloads directory, and click Open.
  6. Click Script | Run to run the script.


' 3dDXF_Export.bas
' This script opens the Helens (contour map).voxb sample file and exports the file to 3D DXF.
' Change the file path on line 32 to choose a different file to open.
' The export options that are commented out can be changed and added back in as needed.
' Change the file path on line 56 to a location that exists on your computer before running.
' If Voxler is running, retrieve the current instance of Voxler. Otherwise,
' create a new instance of Voxler.
Function VoxlerApplication()
On Error Resume Next
Set VoxlerApplication = GetObject(, "Voxler.Application")
If Err.Number <> 0 Then
Set VoxlerApplication = CreateObject("Voxler.Application")
End If
On Error GoTo 0
End Function

Sub Main
'Retrieve running instance of Voxler or create a new instance of Voxler
Dim VoxlerApp As Object
Set VoxlerApp = VoxlerApplication()

'Make Voxler visible
VoxlerApp.Visible = True

'Access CommandApi
Set CommandApi = VoxlerApp.CommandApi

'Open an existing file
CommandApi.Construct ("Open")
CommandApi.Option ("Path", VoxlerApp.Path+"\Samples\Helens (ContourMap).voxb")

'Export the HeightField module to a 3D DXF
'Change the export Path to one that exists on your computer
CommandApi.Option("GuiEnabled", "False")
CommandApi.Option("ClearOptions", "False")
CommandApi.Option("Filter", "dxf")
CommandApi.Option("Module", "HeightField")
'CommandApi.Option("ModuleId", "0")
CommandApi.Option ("Options","FileCompatibility=21")
CommandApi.Option ("Options", "FormatASCII=1")
'CommandApi.Option ("Options", "MaxBitmapSizeInMB=10")
'CommandApi.Option ("Options","AllColorsSame=0")
'CommandApi.Option ("Options","AllCStylesSame=0")
'CommandApi.Option ("Options","AllWidthsSame=0")
'CommandApi.Option ("Options", "AllTextToAreas=0")
'CommandApi.Option ("Options", "UseSpatialInfo=0")
'CommandApi.Option ("Options","ColorMapping=0")
'CommandApi.Option("Options", "RenderMarkers=0")
CommandApi.Option("Path", "C:\Temp\test2.dxf")
CommandApi.Option("PersistOptions", "True")

End Sub


Updated April 13, 2017

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.