Create Thickness of a Solid

Use Case Description

This script was generated to provide the ability to calculate the thickness of a solid, it will output a string file in text format with the thickness on each ray trace. The function is designed to be used with the Create Best Fit Trend Surface script as it requires a trend surface to inform the orientation of the ray traces. The ray traces measure the intersection points and calculate a thickness based on these intersects.

The output can then be used as a visual representation but also to estimate in to a block model if needed along with the Bearing, Dip and Plunge based on the ray traces being the minor direction.

Capability

The script works by firstly converting the input solid  and trend surface to an .obj file for use in the python script. 

The script then loads the trend surface and solid file in to a python library called Trimesh, this library performs the intersection commands and handles the ray tracing in an efficient manner.

A local co-ordinate transform is applied to the trend surface, this allows the solid to be heavily folded and for us to still measure the most sensible direction when calculating the thickness. It means that we test in multiple directions and not just a single orientation. 

The input solid is then projected on to the local transform, this gives us a flat footprint of the solid which is used later to limit the number of ray traces that we need. 

A sampling grid is then applied at the user specified grid spacing, only points that are inside the footprint of the solid from the previous step are retained. These points are then used to create the ray traces which will measure the thickness of the solid.

The sampling grid nodes are then back transformed on to the real 3D trend surface, they retain their orientation at this point from the trend surface. 

There are 2 methods to then calculate the thickness although only 1 works in practical conditions. The first method was designed to provide a test to see if the grid spacing was adequate however it relies on the solid being valid in Trimesh which for Surpac solids they almost never are. As such the 1st method will often fail with a non-critical warning message. 

The second thickness method takes every node on the sampling grid and generates an infinite ray both forwards and backwards until they intersect the solid. For GEMS users you can imagine this as needling as it is very similar. We record the intersections and calculate the distance between entry and exit points. Often a ray will fail due to the trend surface being outside the solid boundary, or it only records a single intersection or it misses the solid entirely due to a hole. Rays can also be excluded based on a user specified Maximum Distance which eliminate erroneous large rays due to complex shapes of the solid and trend surface. These failed rays are retained and exported as part of the output file as grid node points in string 3. 

Once all rays are complete the valid rays are averaged and the thickness reported in the message window. The script in version v1.2 now also writes the Bearing, Plunge and Dip in to the D3, D4 and D5 fields of string 2. This can then be used with the Surpac search ellipse to show an orientated ellipse based on the surpac ZXY-LRL convention. This can then be input to the block model as dynamic anisotropy search criteria.

The output file also shows these rays with the thickness of each ray written to the D1 field of string 1. String 2 is also generated as a mid-point of the ray traces and hold the thickness in D1, the total average thickness in D2, Bearing, Plunge and Dip in to the D3, D4 and D5.

The final output is the footprint boundary of the solid which is written to string 8. All string numbers are hardcoded but could be customised if required.

The script then performs a clean up deleting the intermediate .obj and .mlt files.

It should be noted that this script will only work if you have the required python libraries installed and have a version of Surpac that can execute python scripts. It is recommended to use it on GA versions of Surpac 2026 RF2 and above running the embedded python interpreter.

Output

The script will output a text based string file with all rays (successful and failed), mid-points and boundary.

Video

 

Script

V1.2.1 - Corrected rays being falsely removed due to intersection only occurring on one side. All rays that intersect twice and are within Max Search Distance are now retained.

Example Dataset

​​​​​​​