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

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.

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.

×
×
  • Create New...