blimey Posted July 6, 2005 Share Posted July 6, 2005 Good Afternoon ! I've posted a question in the general discussion regarding how to updates classes, here was the post : "Help! I've spent the whole day (and night) trying to find a way to update classes : We're working with workgroup reference and many files created from the same template. We use class style at creation so to have a coherent presentation throughout the files. Quite of few classes have been change in the Template (color, line width and pattern) although their names remain unchanged... Is it possible to update the classes of all the files to match the template's classes new color and other attributes? I can't imagine to do it manually for each of the files...!!!" Bruce Ferguson, from Nemetschek, said that this is not yet possible but is considered for a future version of VW. In the meantime I was looking fo some idea that would help, Raymond advised me to write a script so as not to do it manually for each file. I'm new to everything. So this is why I'm posting here... Could you give me your advise on how you'd start that script, what to keep in mind, and what not to do? Thank you very much. Best, LiMei Quote Link to comment
ccroft Posted July 6, 2005 Share Posted July 6, 2005 I think that Ray (as usual) has an excellent idea. Create a new doc from the new template. File>Export>Export Vectorscript. Open the resulting file in a text editor. You'll see a ton of code. Almost at the end you'll see a section that starts with {Classes} and ends with {End of Class Entries}. Delete everything in this file except the Procedure statement at the top,Begin, the class section, End and the Run statement at the bottom. Pay particular attention to the punctuation. You now have your script. Save it as it may come in handy if you run into trouble.To facilitate the job at hand you'll want this script to be a Menu Command, and added to your workspace so you can run it on any file that is opened. Copy all the script in the edited file for pasting later. In vWorks go Organize>Scripts>Vectorscript Plug-in Editor. New>give it a name (Update Classes?)>confirm that Command is selected>OK>Script button>Paste in the text. Hit the little gear button and try to correct any errors (feel free to write in for help). Keep correcting and pressing this button until you get the cheerful "Script Compiled Successfully!" message, then OK and Done. Now you have to edit your workspace and add this menu command. You'll find it in the miscellaneous category under Menus. Test it on a fresh new document. Carefully verify that all the needed classes are created, and that all their attributes are as expected. Your script will look something like this: Procedure LoadFile; BEGIN {Classes} NameClass('None'); SetClFillFore('None',0,0,0); SetClFillBack('None',65535,65535,65535); SetClPenFore('None',0,0,0); SetClPenBack('None',65535,65535,65535); SetClFPat('None',0); SetClLS('None',2); SetClLW('None',4); SetClUseGraphic('None',FALSE); NameClass('Dimension'); SetClFillFore('Dimension',0,0,0); SetClFillBack('Dimension',65535,65535,65535); SetClPenFore('Dimension',0,0,0); SetClPenBack('Dimension',65535,65535,65535); SetClFPat('Dimension',1); SetClLS('Dimension',2); SetClLW('Dimension',1); SetClUseGraphic('Dimension',TRUE); NameClass('c top'); SetClFillFore('c top',0,0,0); SetClFillBack('c top',65535,65535,65535); SetClPenFore('c top',0,0,0); SetClPenBack('c top',65535,65535,65535); SetClFPat('c top',0); SetClLS('c top',2); SetClLW('c top',4); SetClUseGraphic('c top',TRUE); NameClass('finpan'); SetClFillFore('finpan',0,0,0); SetClFillBack('finpan',65535,65535,65535); SetClPenFore('finpan',0,0,0); SetClPenBack('finpan',65535,65535,65535); SetClFPat('finpan',0); SetClLS('finpan',2); SetClLW('finpan',4); SetClUseGraphic('finpan',FALSE); {End of Class Entries} END; Run(LoadFile); Only with a lot more NameClass sections.I believe this will be what you want. Good Luck Charles [ 07-06-2005, 02:19 PM: Message edited by: ccroft ] Quote Link to comment
ccroft Posted July 6, 2005 Share Posted July 6, 2005 Caveat: It's very important that your class names haven't changed in the new template. Otherwise you could end up with a gigantic mess. Likewise, it's important that you or your co-workers don't run this on a file that wasn't created from the template. That is to say that the class names in the script should match the class names in the file. If not, the classes in the file won't be touched and any class that's not in the file but is in the script will added to the file It is possible to write a procedure that would not allow this script to be run on a file that didn't match these criteria, but it will be fairly complicated compared to the above script. Quote Link to comment
blimey Posted July 7, 2005 Author Share Posted July 7, 2005 WAOUHW! Super! As we say here in Brussels! That's great. I'm going to try right now. THANK YOU so much !!! Li Mei Quote Link to comment
blimey Posted July 9, 2005 Author Share Posted July 9, 2005 Hey Charles, Just a little post to let you know that I've done the script just as you said and it works really well!!! I'm jumping with excitement and joy !!! :-) HAPPY! Thank you again, Li Mei Quote Link to comment
Sean R. Posted February 11, 2021 Share Posted February 11, 2021 I tried using this method to make a script to update my classes with the new tiles I want to use but it did not work. It made the classes that did not exist like I wanted but it doesn't seem to set tiles as a class setting. Any ideas? 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.