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