# Change the name and description of an existing layer using properties

from maptek import vulcan

dgd_file = "pydemo.dgd.isis"  # design database to access

with vulcan.dgd(dgd_file, "w") as dgd:  # open up the database in write mode
    layer_obj = dgd.get_layer('POINT')  # get an existing layer

    # set properties...
    layer_obj.name = 'POINT_2'  # give a new name to the layer by changing the properties
    layer_obj.description = 'This is a point'

    dgd.save_layer(layer_obj)  # save the layer

    # get properties...
    layer_name = layer_obj.name
    layer_description = layer_obj.description

    print(f"Layer name: {layer_name}\nLayer description: {layer_description}")
    dgd.delete_layer('POINT')  # delete the old version of the layer