next up previous contents index
Next: Layer Database Up: Main Functions 3 Previous: Current Layer   Contents   Index

Layer Table

(int) LayersUsed()
This returns a count of the layers in the layer table for the current display mode.

(int) AddLayer(name, index)
This adds the named layer to the layer table, in the position specified by the integer second argument. If the second argument is negative, the new layer will be added at the end, above all existing layers. If the index is 0, the new layer will be positioned at the index of the current layer, and the current layer and those above moved up. Otherwise, the index is a 1-based index into the layer table, where the new layer will be inserted. The layer at that index and those above will be moved up.

The name can match the name of an existing layer that has been removed from the layer table. It can also be a unique new name, and a new layer will be created. If the name matches an existing layer in the table, a new layer will also be created, but with an internally generated name.

The function will return 0 if it is not possible to create a new layer, for example if the name is not a valid layer name. On success 1 is returned.

If the name is not in the layer:purpose form, any new layer created will use the default ``drawing'' purpose.

(int) RemoveLayer(stdlyr]/)
This removes the layer indicated by the standard layer argument from the layer table if found. This returns 1 if the layer is found and removed, 0 otherwise.

(int) RenameLayer(oldname, newname)
The oldname is a standard layer argument. The newname is a string providing a new layer/purpose name in the layer[:purpose] form. If no purpose field is given, the default ``drawing'' purpose is assumed. This renames the layer specified in oldname to newname. The renamed layer will have any alias name removed.

This fails if oldname is unresolved or newname is null, and returns 0 on error, with an error message available from GetError.

(stringlist_handle) LayerHandle(down)
This function returns a handle to a list of the layer names from the layer table. If the argument is 0, the list is in ascending order. If the argument is nonzero, the list is in descending order. The layers used in the current display mode are listed.

(string) GenLayers(stringlist_handle)
This function returns a string containing a layer name from the layer table. The argument is the handle returned by LayerHandle. A different layer is returned for each call. The null string is returned after all layers have been cycled through. This is equivalent to ListNext.

(stringlist_handle) GetLayerPalette(regnum)
The argument is an integer 0-7 corresponding to a layer palette register, as used with the Layer Palette panel, and associated with the PhysLayerPalette and ElecLayerPalette technology file keyword families. The return value is a stringlist handle, where the strings are the names of layers saved in the indexed palette register corresponding to the display mode of the main drawing window.

If the palette register is empty, or the argument is out of range, a scalar 0 is returned.

The register with index 0 is used internally to save the last Layer Palette user area before it pops down. Thus, this index should not be used unless this behavior is expected.

(int) SetLayerPalette(list, regnum)
The second argument is an integer 0-7 corresponding to a layer palette register, as used with the Layer Palette panel, and associated with the PhysLayerPalette and ElecLayerPalette technology file keyword families.

The first argument provides a list of layers, or null, to be saved in the indexed palette register corresponding to the display mode of the main drawing window. If the argument is a scalar 0, or a null string, the palette register will be cleared. Otherwise this argument can be a string consisting of space-separated layer names, or a stringlist handle, where the strings are layer names. The handle is unaffected by this function call.

The function returns 1 on success, 0 if the register index is out of range. The call will fail (halt the script) if a bad argument is passed.

There is no checking of the validity of the string saved as palette register data.


next up previous contents index
Next: Layer Database Up: Main Functions 3 Previous: Current Layer   Contents   Index
Stephen R. Whiteley 2024-09-29