Jump to content

Prefixing Classes


Recommended Posts

Hi,

Just a quick one...I wonder if anyone had a script which would allow me to prefix all my classes once I have already imported a DWG? It's from a big OS Map, and I simply want to put "OS-" in front of every class so that they are all tucked away neatly, rather than having the 200 odd classes in my list.

Shorter (the CAD consultant at my old office) had a script which I think ran as a VSM, where you could simply highlight the classes you wanted to change, and then it would do the whole thing for you.

If anyone has any ideas, please let me know!

Thanks

N

Link to comment

Hi there...

Here is what we use... You can make this script into a menu command as we've done... should work on every version...

Enjoy!

Procedure AppendStrToAllClasses;

{Written by Frank Brault, ?2004}

VAR

numberOfClasses, classIndex : LongInt;

classVisibility : Integer;

className, newClassName : String;

Begin

newClassName := StrDialog('This command will append the string entered here to the beginning of the name of each class.', 'Import-');

If Not(DidCancel) Then

Begin

numberOfClasses := ClassNum;

If numberOfClasses > 2 Then

Begin

classIndex := 0;

For classIndex := 3 To numberOfClasses Do

Begin

className := ClassList(classIndex);

classVisibility:= GetCVis(className);

RenameClass(className, Concat(newClassName, className));

End;

End

Else AlrtDialog('No classes were appended because there are no non-standard classes in this document. The classes "None" and "Dimension" are reserved.');

End;

End;

Run(AppendStrToAllClasses);

Link to comment

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.

×
×
  • Create New...