MTRobin Posted May 22, 2020 Share Posted May 22, 2020 Hi Everyone, I was hoping someone could help me create a script that would toggle the "Black Background" and "Use Layer Colors" settings on and off based on if I am in a Design Layer or a Sheet Layer. I like to draft in my Design Layers with a black background and layer colors, but then when I switch to Sheet Layers to dimension and add notes to my viewports I prefer to turn off those two settings. As it is now I have those two toggles in my quick settings tool bar, but I would like to automate it so anytime Vectorworks is in a Design Layer it will turn on the "Black Background" and "Use Layer Colors" tools. Then if Vectorworks is in a sheet layer it will turn both of those settings off so the lines are normal colors and the background is white. Any help would be appreciated. Thank you, Maxwell Quote Link to comment
JBenghiat Posted May 22, 2020 Share Posted May 22, 2020 You can set preferences fairly easily with SetPref(). The constants for Layer Colors and Black Background are in the Appendix. https://developer.vectorworks.net/index.php/VS:SetPref You can check if the active layer is design or sheet with https://developer.vectorworks.net/index.php/VS:GetObjectVariableInt The object variable selector is 154. It will return 1 for season layer and 2 for sheet layer. Having the process be automatic would require the SDK, which is the only way to listen for user actions. You can add a script to a saved view, though. Quote Link to comment
MTRobin Posted May 22, 2020 Author Share Posted May 22, 2020 Thank you for this. One issue I can't solve is what handle I need to get in order to finish the GetObjectVariableInt function. [GetObjectVariableInt(h, 154)] Thanks, Maxwell Quote Link to comment
JBenghiat Posted May 22, 2020 Share Posted May 22, 2020 ActLayer will get a handle to the active layer https://developer.vectorworks.net/index.php/VS:ActLayer Quote Link to comment
MTRobin Posted May 22, 2020 Author Share Posted May 22, 2020 Awesome! I got it to work. I will add a script to my saved views to change the settings based on what view it is currently in. Thanks for your help. 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.