# Worksheet of Layers in File

## Recommended Posts

A member on the Vectorworks mail list asked about how to get the design layer names into an Excel worksheet. The following script makes a VW Worksheet of the Design Layer names and opens it. You can then copy/paste the layer names as needed.

This is not a two-way worksheet. If you edit the names in the worksheet it will not change the names of the layers.

Lightly tested, but use at your own risk. Backup early and often.

Pat

```Procedure DesignLayers_to_Worksheet;
{Make a worksheet listing all of the design layers in a VW file}
{Lists both used and unused layers}
{The worksheet is named "Layers:"with and appended date}
{Sorts layers in alphabetical order prior to storing in worksheet}
{March 19, 2015}
{© 2015,2010, 2008, Pat Stanford pat@coviana.com}

var	H1, H2:	Handle;
N1, N2:	LongInt;
LayerSort : Array[1..1024] of string;

Begin
H2:=FLayer;
N2:=1;

While H2 <> nil do
Begin
If GetObjectVariableInt(H2,154)= 1 then
Begin
LayerSort[N2]:=GetLName(H2);
N2:= N2 + 1;
End;
H2:=NextLayer(H2);
End;

{Add Curly Braces (comment out) the next line to not sort the layers by name}
SortArray(LayerSort,N2-1,0);

H1:=CreateWS(Concat('Layers:',date(2,1)),N2,2);
For N1:= 1 to  N2-1 do SetWSCellFormula(H1,N1+1,1,N1+1,1,LayerSort[N1]);

SetWSCellFormula(H1,1,1,1,1,'Layers in File');

ShowWS(H1,True);

End;

Run(DesignLayers_to_Worksheet);
```

Thank you Pat!

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×