Jump to content

Changing 'heading' of classes


Recommended Posts

Hi Guys:

 

I've had a google and a search of the site but nothing has turned up. Probably using the wrong terms for the search, but anyway...

 

I have a Symbol Library that I have created over the years, where the classes are labelled something along these lines

 

EOB - LX - Overhead - Source 4 26

 

There are a good few hundred symbols in there, and I'm wondering if there is a quick way to change the class names from  EOB - LX etc to say IGN - LX  or something without having to modify each class name individually.

 

Many thanks

 

Smiffy

 

 

Link to comment

By deleting that Class !

And when VW asks if you want to keep potential geometry by assigning an alternative Class to choose

the one with the new name.

 

You have to be careful that you already have the better named Class created and available before you delete.

 

And it is a bit risky that some of the more complex Plugin Objects will not 100% adapt to that change and

get corrupt and crash VW at one point ;)

 

 

If you have the German Localized Version of VW you could simply use their Find+Replace Tool to change

many related Class Names Parts or Pre/Suffixes in one go.

 

Link to comment

Thanks guys:


That script looks like it might do the trick, but returns many errors when run as a .VS file. 

 

Unfortunately i'm not very au fait with scripting so not sure what is required to fix it. I'll paste it here for reference nevertheless and in case anyone can see what might be required to fix it or indeed suggest what i'm doing wrong. 
 

PROCEDURE FindRenameClasses; { Modded by Andrew Chau based on Renameclasses by ? Petri Sakkinen 1997 - 2009 } 

VAR
className, newName, cs1, cs2 {cs1 is the trigger or to be replaced, cs2 is the replacement} : STRING;
i, j, n : INTEGER;

BEGIN
cs1:=StrDialog(Concat('Find text string in class name to rename...',Chr(13),Chr(13),'Find:'), 'S_');
IF NOT DidCancel THEN cs2:=StrDialog(Concat('Rename text string in class name...',Chr(13),Chr(13),'Replace:'),'X_S-');
j := LEN(cs1);  
FOR i := 3 TO CLASSNUM DO BEGIN
	className := CLASSLIST(i);
	n := POS(cs1, className);
	IF (n=1) THEN BEGIN 
		newName := className; 
		DELETE(newName, 1, j);  
		RENAMECLASS(className, CONCAT(cs2, newName)); 
	END; 
END;
END;

RUN(FindRenameClasses);

In this instance I saved it as a text file on the desktop and changed the file extension to .vs so the file is now called FindRenameClasses.vs and then within VW Spotlight 2017 using the Tools > Plugins > Run Script command, found the file and hit okay. It then stops with an error.

Link to comment

I just did the same thing and got no errors.  Are you sure you saved it as a true text file? If you used something like Word to save it, it is likely to have extraneous characters that will cause problems. It worked for me here on some test classes based on what you said you have.

 

You could also Copy from the email and then go to the Resource Manager, Click New Resource, Script, Name the Palette, Name the Script (or accept the default names) and then paste the script in there.  Run it by double clicking on the script name in the palette.

 

It will only change the beginning of the Class name, and it must be a direct match, so if you wanted to change the EOB to IGN, just enter those values into the dialog boxes. If you wanted to change from EOB - LX to EOB - XL,  you would need to put the entire string to find and replace into the dialog boxes.

 

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...