Generate RBF Surface from SDM file

Use Case Description

This TCL macro creates a 3D geogical or terrain mesh from point data stored in a Surpac SDM file. It is intended for users who need to convert scattered XYZ coordinates into a regular interpolated surface that can be visualised and used within Surpac. The workflow begins with a Guido form, which allows the user to select the input and output SDM files, choose an interpolation method and kernel, define the grid cell size and model extents, and decide whether the completed mesh should be opened automatically in GEOVIA Surpac after completion.

After the user submits the form, the macro converts the input SDM into a text-based Surpac string file. TCL reads the converted file, removes empty lines, extracts the required coordinate fields, and reformats them into a simplified XYZ file. This intermediate file is then supplied to an embedded Python script, which performs the numerical interpolation and mesh construction.

 

Capability

The macro supports two SciPy radial basis function methods: the legacy Rbf interpolator and the newer RBFInterpolator. The user can select an appropriate kernel for the chosen method, including linear, cubic, quintic, thin-plate, multiquadric, inverse multiquadric, and Gaussian options where available. The script uses Pandas to read and organise the coordinate data, NumPy to create the regular XY grid and manipulate the numerical arrays, and SciPy to calculate interpolated Z values across the grid.

Once interpolation is complete, the Python component converts the calculated surface into a set of three-dimensional vertices and divides each grid cell into two triangular faces. These vertices and faces are written to an OBJ mesh file. The TCL macro then converts the OBJ file back into a GEOVIA SDM file, removes the temporary text and OBJ files, and optionally recalls the finished SDM into a new Surpac layer. The result is an automated end-to-end workflow that combines Surpac file management, TCL scripting, Python numerical processing, radial basis function interpolation, and triangular mesh generation.

 

Output

The script will output a SDM file containing a surface mesh built from a grid of points.

 

Video

 

 

 

Script

 

 

Example Dataset & Settings

​​​​​​​

 

Example output (using RBFInterpolator & thin plate spline):

Note output mesh is a regular grid of triangles:

 

Limitations:

  • Large datasets may be slow: RBF interpolation can use significant processing time and memory, especially when many input points or a very fine grid are used.
  • Limited input checking: The script does not fully check whether the input data contains valid numeric XYZ values, sufficient points, duplicate locations, or missing elevations.
  • No smoothing or outlier control: The interpolation uses zero smoothing, so the surface attempts to follow the input points closely. Outliers or noisy survey data may therefore create unwanted peaks, depressions, or irregularities in the mesh.

  • Tested and built on Surpac 2026 RF2.