# Filename: tri_set_properties_crange.py
# Purpose: Set the properties of a triangulation to colour by range.
# Returns: Void.

from maptek import vulcan

input_tri = 'topo.00t' # input triangulation

# property list
# USE_CRANGE: use colour range: True = 1; False = 0
# MIN_CRANGE: min colour index: int
# MAX_CRANGE: max colour index: int
# VARY_CRANGE: axis to colour by: X/Y/Z
# EQUALISE_RANGE: True = 1; False = 0

with vulcan.triangulation(input_tri,'w') as tri: # Open triangulation in write mode
    props = tri.get_properties()
    props["SHADED"] = 1
    props["WIREFRAME"] = 0
    props['USE_CRANGE'] = 1
    props['MIN_CRANGE'] = 0
    props['MAX_CRANGE'] = 100
    props['VARY_CRANGE'] = 'Z'
    props["EQUALISE_RANGE"] = 1
    tri.set_properties(props)