# Filename: tri_get_face.py
# Purpose: Gets a facet and its point indices by index.
# Returns: The indices of facet points as a list.

from maptek import vulcan

input_tri = 'headframe.00t' # input triangulation

with vulcan.triangulation(input_tri) as tri:
    num_face = tri.n_faces()
    num_nodes = tri.n_nodes() # returns the number of nodes
    print(f"{input_tri} has {num_face} facets and {num_nodes} nodes.")
    for i in range(0, num_face):
        node_indices = tri.get_face(i) # Get node indices of face.
    
        # do something with list of node indices...
        print(f"facet: {i}")
        for node in node_indices:
            pt = tri.get_node(node) # The X, Y, Z coordinates of a node.
            print(f"    {node} : {pt}")