# Create a 10 x 10 grid of points

from maptek import vulcan

dgd_file = "pydemo.dgd.isis"  # design database we want to access
layer_name = 'POINT_GRID'
origin_x = 75000.0
origin_y = 4700.0
origin_z = 0.0
index = 0

with vulcan.dgd(dgd_file, "w") as dgd:  # open up the database in read mode
    layer = vulcan.layer(layer_name)  # Make a new layer

    for i in range(10):
        origin_y = 4700.0 # reset y coordinate after each column is created
        for j in range(10):
            new_pt = vulcan.polyline([[origin_x, origin_y, origin_z]])  # create object with one point
            new_pt[0].name = 'pt_' + str(i) + str(j)  # create point name based on grid index
            new_pt.colour = index + 1

            layer.append(new_pt)  # put newly edited object into the layer

            layer.set_object(index, new_pt)  # make each point a unique object

            index += 1
            origin_y += 100
        origin_x += 100

    dgd.save_layer(layer)  # save layer