Jump to content
Alessio

Scale all design layers

Recommended Posts

Hi All,

 

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

 

Alessio

Share this post


Link to post

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?

  • Like 1

Share this post


Link to post

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);

 

 

 

  • Like 3

Share this post


Link to post

Hi Michaelk,

 

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

 

thanks!

Share this post


Link to post

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);

 

Share this post


Link to post

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

  • Like 1

Share this post


Link to post

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?

Share this post


Link to post

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

Share this post


Link to post

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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


 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...