VS:Layer

From Vectorworks Developer
Jump to: navigation, search

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Procedure Layer creates a new layer in a VectorWorks document. After creation, the new layer becomes the active layer of the document.

Layer can also be used to switch the active layer of the document. If the layer name passed to the procedure already exists, the procedure switches the active layer to the specified layer.

Single quotes should be avoided in layer names, as they will be treated as a mismatched string specifier, and will cause an error to be generated.

PROCEDURE Layer(
name  :STRING);
def vs.Layer(name):
    return None

Parameters

name STRING Name of new or existing layer.

Example

VectorScript

{ example from unknown author on Vectorlab, Dec 2006 }
PROCEDURE IsolateLayer; {sets selected object's layer to active and greys all others}
VAR
    x, y: REAL;
    h, layHand: HANDLE;
    layName: STRING;
BEGIN
    GetPt(x, y);
    h := PickObject(x, y);

    IF h <> NIL THEN BEGIN
        SetSelect(h);
        layHand := GetLayer(h);
        layName := GetLName(layHand);
        Layer(layName);
        SetLayerOptions(2);

        SetDSelect(h);
    END;
END;
RUN(IsolateLayer);

Python


def PickPointCallback(pt):
	h = vs.PickObject(pt[0], pt[1])
	if h != None:
		vs.SetSelect(h)
		layHand = vs.GetLayer(h)
		layName = vs.GetLName(layHand)
		vs.Layer(layName)
		vs.SetLayerOptions(2)
		vs.SetDSelect(h)
    
	

def IsolateLayer(): #{sets selected object's layer to active and greys all others}
    vs.GetPt( PickPointCallback )
    
IsolateLayer()

Version

Availability: from All Versions
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox