# Filename: tri_put_faces.py
# Purpose: Put a NumPy array of facets in a triangulation.
# Returns: None.

from maptek import vulcan
from maptek import vulcan_gui
import numpy as np

new_tri = 'new2.00t'
with vulcan.triangulation(new_tri, 'w') as tri:
    # create coordinate arrays for each node
    n0 = [77888.0, 4739.0, 100.0]
    n1 = [78160.0, 4208.0, 100.0]
    n2 = [78177.0, 4759.0, 50.0]
    n3 = [78353.0, 4399.0, 50.0]
    n4 = [78462.0, 5039.0, 100.0]
    
    f0 = [0,1,2]
    f1 = [1,2,3]
    f2 = [0,2,4]
    
    # create NumPy arrays
    nodes = np.array([n0, n1, n2, n3])
    faces = np.array([f0, f1])
    
    tri.put_vertices(nodes)
    tri.put_faces(faces)

vulcan_gui.load_triangulation(new_tri)