grant_PD Posted April 18, 2022 Share Posted April 18, 2022 Is there a script to change a selected item's class? Say I have a bunch of extrudes I just made and I forgot to put them in the none class. I select them all and run the script, it puts them in that class. Quote Link to comment
JBenghiat Posted April 18, 2022 Share Posted April 18, 2022 SetClass() will set an object's class. https://developer.vectorworks.net/index.php/VS:SetClass ForEachObject() will iterate through objects https://developer.vectorworks.net/index.php/VS:ForEachObject also https://developer.vectorworks.net/index.php/VS:ForEachObjectInLayer https://developer.vectorworks.net/index.php/VS:ForEachObjectInList Quote Link to comment
grant_PD Posted April 18, 2022 Author Share Posted April 18, 2022 Thanks Joshua! If it's already selected, do I need a handle? Quote Link to comment
JBenghiat Posted April 18, 2022 Share Posted April 18, 2022 Yes — a handle is like a temporary ID for an object (it's actually the location of where the object is stored in Vectorworks' memory). Most vs functions take the handle as the parameter. ForEachObject lets you send selected objects to your action function. You might want something like this: Function ChangeClass( h: HANDLE ):BOOLEAN; BEGIN SetClass( h, 'None' ); END; ForEachObjectInList( ChangeClass, 2 {selected objects}, 0 {shallow}, FSActLayer ); 1 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.