# Scale all design layers

## Recommended Posts

Hi All,

can someone help me on a script to set all design layers to 1:100

Alessio

You can do that by setting the layer scale for 1 layer and selecting the "all layers" checkbox... Or do you have another reason to script this?

I know where to do this but i want a quicker way to do it

Alessio

It's possible.

I had an existing script that deals with layers, so I've recently wrestled with the fun eccentricities of layers (For VW the first layer is the bottom designer layer to the top designer layer, then the next layer is the top sheet layer to the bottom sheet layer.)

This is a quick stab at it.  I tested it and it seems to work.

```PROCEDURE SetAllScaleTo100;

VAR

LayerInQuestion
:HANDLE;

LyrTypInt, Counter, HowManyLayers
: INTEGER;

BEGIN 								{**** MAIN ****}
Counter := 1;
LayerInQuestion:=FLayer;
HowManyLayers := NumLayers;

For Counter := 1 to HowManyLayers DO			{Step through every layer, including Design Layers}
BEGIN

LyrTypInt := GetObjectVariableInt(LayerInQuestion,154);

{***************************************************************************}
{Layer type 1 is a design layer.
It counts them from the bottom of the stack to the top.}

IF LyrTypInt = 1 THEN
Begin
SetLScale(LayerInQuestion,100);
End;

{***************************************************************************}
{Layer type 2 is a Sheet Layer
Sheet Layers are counted by stacking order from top to bottom.}

IF LyrTypInt = 2 THEN
BEGIN
END; {If LyrTypInt is 2 (i.e. Sheet Layer}

{***************************************************************************}

LayerInQuestion:=NextLayer(LayerInQuestion);

END; {1 to number of layers}

END; {main}

RUN(SetAllScaleTo100);```

Hi Michaelk,

this is exactley where i was looking for!!! great!!!!

thanks!

Nice Michael.  I was going to throw something together. I would have not bothered with the counter and just used a While LayerHandle<>nil to control the repeating.

Completely untested and typed here:

```Procedure SetLayerScale;

Var	H1:Handle;

Begin
H1:=FLayer;
While H1 <> Nil do
Begin
If GetObjectVariableInt(H1,154)=1 then SetLayerScale(H1,100);
H1:=NextObj(H1);
End;

Run(SetLayerScale);```

If I was starting from zero I probably would have done something similar.  But I just duplicated an existing script, stuck in the SetLScale function and stripped out all the unnecessary nonsense. 🙂

NextObj(H1) or NextLayer(H1)?

If the first object is a layer will NextObj restrict itself to layers or will it try every object in the drawing?

It should probably be NextLayer.   I don't know what NextObj does if you pass it a Layer handle.

## 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.

×