Xaver77 Posted August 27, 2021 Share Posted August 27, 2021 Hello everyone, I would like to create a script with which I can make class groups visible or invisible. I have already found the following function references. HideClass ('▲ 00 standard - hairline 0.18'); and ShowClass ('▲ 00 standard - hairline 0.18'); My question is. How can I design the script in such a way that I can switch the class visible or invisible with a script, depending on the class visibility at the moment. I was thinking of an if / else query. greet Xaver Quote Link to comment
Julian Carr Posted August 27, 2021 Share Posted August 27, 2021 Something like this: IF GetCVis('▲ 00 standard - hairline 0.18') < 0 THEN ShowClass('▲ 00 standard - hairline 0.18') ELSE HideClass('▲ 00 standard - hairline 0.18'); 1 Quote Link to comment
michaelk Posted August 27, 2021 Share Posted August 27, 2021 This is an excellent example of something a tiny script is good at doing. This script is simple enough that it can be done without variables, and without all the formalities of Procedure and Run statements. Obviously you've found the developer page online or the local copy w/ your VW installation. You need one other function: GetCVis(className); It will return 0 if the class is visible, -1 if the class is hidden and 2 if the class is gray. Instead of an IF/THEN/ELSE it might be faster to use a CASE. (check out the VS Language Guide: https://developer.vectorworks.net/images/7/72/VectorScriptGuide.pdf) CASE GetCVis('Test1') OF 0 : HideClass('Test1'); -1 : ShowClass('Test1'); END; CASE GetCVis('Test2') OF 0 : HideClass('Test2'); -1 : ShowClass('Test2'); END; Of course it would be great if the script also checked to see if the class even exists in the drawing. But this works 🙂 1 Quote Link to comment
michaelk Posted August 27, 2021 Share Posted August 27, 2021 Australia wins for the shortest script! Quote Link to comment
Xaver77 Posted August 30, 2021 Author Share Posted August 30, 2021 Thanks for the great help! How can I specify the class that it hides the entire class group from me? Quote Link to comment
michaelk Posted August 30, 2021 Share Posted August 30, 2021 I don 't think you can. Sub classes are just classes with a dash in the name. So you would need to list every class. You could do it as a loop to make managing the list easier. If you're ready for that step post back 🙂. We'll walk you through it. PS. This occurred to me as another option. It does the same thing as above, but adds a beep if the class is grey. CASE GetCVis('Test1') OF 0 : HideClass('Test1'); -1 : ShowClass('Test1'); 2 : Sysbeep; END; 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.