Ozzie Posted September 19, 2007 Share Posted September 19, 2007 Hi there, Is there a way to list all of the Classes from a drawing to a text file or a Worksheet? Quote Link to comment
Pat Stanford Posted September 19, 2007 Share Posted September 19, 2007 If you are willing to accept classes that are used only, it is pretty easy to create a worksheet. 1. Create a new worksheet 2. Create a database row (click in the row header column) 3. Set the criteria to All Objects 4. In the header row of the worksheet (the one without a number after the decimal), type in =C 5. Select the header row and drag the SUM icon into the worksheet column header. 6. If you want to sort the classes, drag either of the sort icons to the same column header that has the SUM icon. If you need all of the classes let me know. I think I have a script to do that somewhere, but I am not going toind it tonight. Pat Quote Link to comment
Ozzie Posted September 19, 2007 Author Share Posted September 19, 2007 Pat, Thanks for getting back to me - I knew how to do that - just! I have created a Standards Drawing which has all of my normal Classes, Layers etc within it. I have also created a WS that quantifies by Class as I draw to quantify things. Being a dumbo the WS I fiddled with to get it working correctly in the Standards file I wanted to take it back into another drawing with some altered Classes. So all I wanted to do was check the Classes worked correctly simply. In future the WS will live in the Standards file - but if you have script for future purposes it could be really handy. Thanks again Quote Link to comment
Chris D Posted September 19, 2007 Share Posted September 19, 2007 (edited) We use a script to export class names to a text file. Someone in my office gave it to me - he may have borrowed part of the code from elsewhere - apologies if you recognise it (I'll amend this post to credit you if so) - CREDIT, PERHAPS, TO PETRI! ;-) I made a VSM menu item out of it and added it to my workspace Edited September 20, 2007 by Chris D Quote Link to comment
Ozzie Posted September 19, 2007 Author Share Posted September 19, 2007 Chris, Thank you Quote Link to comment
Petri Posted September 19, 2007 Share Posted September 19, 2007 apologies if you recognise it (I'll amend this post to credit you if so It could be my 1994 version... Can't be sure, though. The 1998 version allowed for cancellation & used the name of the current file in the proposed output file name. The 2000 version (still in use) wrote the list to a worksheet and recorded the visibility statuses (or, to be pedantic, status with a longer "u".) But then again, it's not rocket science and the variable names are obvious, so it might just as well be someone else's. The name of the procedure suggests it is not by me. Whatever, the script can be made to skip classes "None" and "Dimension" by changing counter:=0; to counter:=2; Oh, what the heck! PROCEDURE ListClasses; {(c) Petri Sakkinen 1994/1998 } VAR counter, countClasses : INTEGER; outputfile, theFile : STRING; BEGIN outputfile:=CONCAT(GetFName,'-CLASSES'); countClasses:=CLASSNUM+1; IF (countClasses>2) THEN BEGIN counter:=1; PUTFILE('Class names to file',outputfile,theFile); IF NOT DIDCANCEL THEN BEGIN REWRITE(theFile); REPEAT WRITELN(CLASSLIST(counter)); counter:=counter+1; UNTIL (counter=countClasses); CLOSE(outputfile); END; END; END; RUN(ListClasses); Quote Link to comment
Pat Stanford Posted September 19, 2007 Share Posted September 19, 2007 Ok, here is another one. This will put all of the classes in the file into a new worksheet titled with the date and time the script is run. Procedure Classes_to_Worksheet; var H1: Handle; N1: LongInt; Begin H1:=CreateWS(Concat('Classes:',date(2,1)),Classnum+2,2); For N1:= 1 to Classnum do SetWSCellFormula(H1,N1+1,1,N1+1,1,ClassList(N1)); SetWSCellFormula(H1,1,1,1,1,'Classes in File'); End; Run(Classes_to_Worksheet); Regards, Pat 1 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.