Borehole

For this example we create a borehole and output it in PNG. We assume that we have a feature class with name “area1” that has some TIN features.

Getting the feature ids

We can get them from a feature class like so.

feature_classes = ni.list_feature_classes()
area1_feature_class = next((fc for fc in feature_classes
                            if fc.name == "area1"))
area1_features = ni.list_features(area1_feature_class)

Or we could get them from a MoMa node like in the following example.

List all child feature ids of a MoMa Node

Setting up the input parameters

bore_point = GSTPy.Point2d(5398872, 5667584)
bore_point_srs = area1_feature_class.srs
input_params = GSTPy.BoreHoleImageParameters(area1_feature_ids, bore_point,
                                             bore_point_srs)

Setting up the output parameters

With a template.

output_path = r"D:\temp\isec\output"
template = r"D:\temp\isec\templates\borehole_template.svg"
output_params = GSTPy.OutputImageParameters(
    output_path, image_type=GSTPy.ImageType.PNG, template_file_path=template)

With a template and json config.

import json
output_path = r"D:\temp\isec\output"
template = r"D:\temp\isec\templates\borehole_template.svg"
json_config = json.dumps({
    "unit": "cm",
    "borehole-font-size": 0.59,
    "borehole-font-family": "Sans"
})
output_params = GSTPy.OutputImageParameters(
    output_path,
    image_type=GSTPy.ImageType.PNG,
    template_file_path=template,
    json_config=json_config)

Only json config.

Note: intersection and legend image will be separate.

import json
json_config = json.dumps({
    "unit": "cm",
    "dpi": 200,
    "borehole-image-width": 25,
    "borehole-image-height": 25,
    "legend-image-width": 10,
    "legend-image-height": 20
})
output_params = GSTPy.OutputImageParameters(
    output_path, image_type=GSTPy.ImageType.PNG, json_config=json_config)

Performing the intersection

info = ni.save_borehole_image(input_params, output_params)

Full code sample

import GSTPy

# getting the feature ids
feature_classes = ni.list_feature_classes()
area1_feature_class = next((fc for fc in feature_classes
                            if fc.name == "area1"))
area1_features = ni.list_features(area1_feature_class)
area1_feature_ids = [f.feature_id for f in area1_features]

# input parameters
bore_point = GSTPy.Point2d(5398872, 5667584)
bore_point_srs = area1_feature_class.srs
input_params = GSTPy.BoreHoleImageParameters(area1_feature_ids, bore_point,
                                             bore_point_srs)

# output parameters variant 1
output_path = r"D:\temp\isec\output"
template = r"D:\temp\isec\templates\borehole_template.svg"
output_params = GSTPy.OutputImageParameters(
    output_path, image_type=GSTPy.ImageType.PNG, template_file_path=template)

# intersection
info = ni.save_borehole_image(input_params, output_params)