Jump to content
Sign in to follow this  
Pat Stanford

Stack By Class

Recommended Posts

This script sets the stacking order of objects in a draw by class. Object on Classes that are higher in an alphabetic sort will be stacked to the top of the drawing. Objects lower in the "alphabet" will be stacked lower.

Licensed so you can use as you see fit.

(***************************)

Procedure StackByClass;

{This script steps through each class, selects all the objects in each class}

{And Sends To Front. BY starting at the bottom of the class list, it will}

{Put the object in the higher names classes at the top of the stacking order.}

{August 15, 2008}

{? 2008, Coviana, Inc - Pat Stanford pat@coviana.com}

{Licensed under the GNU Lesser General Public License}

Const MaxClasses=100;

Type ClassStruct = STRUCTURE

CLSNum : LongInt;

CLSName : String;

End;

Var

NumClasses, ClassCounter : LongInt;

ThisClassCriteria : String;

ClassArray : Array [1..MaxClasses] of ClassStruct;

CLSOptions : Integer;

Begin

NumClasses:=ClassNum;

CLSOptions:=GetClassOptions;

{Fill Array with the Class Names and location in the Class List}

For ClassCounter := 1 to ClassNum do

Begin

ClassArray[ClassCounter].CLSNum := ClassCounter;

ClassArray[ClassCounter].CLSName := ClassList(ClassCounter);

End;

{Sort the array by the class name}

SortArray(ClassArray, ClassNum, 2);

{Prepare to handle all objects in each class individually}

SetClassOptions(6);

DSelectAll;

SetClassOptions(5);

{Activate each class and send objects to front}

For ClassCounter := ClassNum downto 1 do

Begin

NameClass(ClassArray[ClassCounter].CLSName);

ThisClassCriteria:=Concat('C=',CHR(39),ClassArray[ClassCounter].CLSName,CHR(39));

SelectObj(ThisClassCriteria);

DoMenuTextByName('Send to Front',0);

DSelectAll;

End;

DSelectAll;

SetClassOptions(CLSOptions);

Message(Date(2,2),' Done');

End;

Run(StackByClass);

(*****************)

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

 

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.

×