# Get the number of objects in a layer.

from maptek import vulcan

dgd_file = "pydemo.dgd.isis"  # design database we want to access
layer_name = "POINT"  # layer we want to use

with vulcan.dgd(dgd_file, "r") as dgd:  # open up the database in read mode
    layer = dgd.get_layer(layer_name)  # get layer

    n_obj = layer.num_objects()  # get the number of objects
    
    if n_obj == 1:
        print(f"The {layer_name} layer has {n_obj} object")
    if n_obj > 1:
        print(f"The {layer_name} layer has {n_obj} objects")
