Alessio 0 Posted January 6 Hi All, can someone help me on a script to set all design layers to 1:100 Alessio Quote Share this post Link to post
Peter Vandewalle 35 Posted January 6 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? 1 Quote Share this post Link to post
Alessio 0 Posted January 6 I know where to do this but i want a quicker way to do it Alessio Quote Share this post Link to post
michaelk 468 Posted January 6 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); 3 Quote Share this post Link to post
Alessio 0 Posted January 6 Hi Michaelk, this is exactley where i was looking for!!! great!!!! thanks! Quote Share this post Link to post
Pat Stanford 1,445 Posted January 6 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); Quote Share this post Link to post
michaelk 468 Posted January 6 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. 🙂 1 Quote Share this post Link to post
michaelk 468 Posted January 6 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? Quote Share this post Link to post
Pat Stanford 1,445 Posted January 6 It should probably be NextLayer. I don't know what NextObj does if you pass it a Layer handle. Quote Share this post Link to post