Created
May 1, 2018 18:23
-
-
Save dominijk/7bfcc6d02686261ad65296e0d7f23a3a to your computer and use it in GitHub Desktop.
Vectorworks snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Procedure PrefixClasses; | |
{ Add "OS-" to the front of classes that begin with "G80". } | |
CONST | |
Prefix = 'G80'; | |
VAR | |
ClassName, NewName :STRING; | |
i :INTEGER; | |
BEGIN | |
i := 1; | |
REPEAT | |
ClassName:= ClassList(i); | |
if (pos(Prefix, ClassName) = 1) then begin { only do next 2 lines if condition is met } | |
NewName:= Concat( 'OS-', ClassName ); | |
RenameClass ( ClassName, NewName ); | |
end; | |
i:=i+1; | |
UNTIL i = (ClassNum+1); | |
Sysbeep; | |
AlrtDialog('Renaming classes is complete!'); | |
END; | |
Run (RenameClasses); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From https://forum.vectorworks.net/index.php?/topic/24380-mass-class-renaming/ | |
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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment