Pat Stanford Posted August 18, 2008 Share Posted August 18, 2008 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); (*****************) 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.