# Filename: tri_clear_triangles.py
# Purpose: Clears all triangle data, leaving attributes intact.
# Returns: None.

from maptek import vulcan

input_tri = 'headframe.00t'

with vulcan.triangulation(input_tri, 'w') as tri:
    tri.clear_triangles() # removes all triangle data from triangulation
    
    # Do something to make it a valid triangulation so that it can be saved.
    # In this case, a simple facet is added.
    n1 = tri.add_node(77700.0, 4625.0, 100.0) # add node and get its index
    n2 = tri.add_node(77846.0, 4750.0, 110.0) # add node and get its index
    n3 = tri.add_node(77920.0, 4875.0, 103.5) # add node and get its index
    tri.add_face(n1, n2, n3)
    tri.save()