James Russell Posted April 12, 2011 Share Posted April 12, 2011 Hey all, I'm just trying to understand the structure of selection criteria and mass edits in scripts. Wondering if someone can write me an example script that selects all the rectangles (T=RECT) on a drawing and sets their width to 200 for example. I can select things fine through my scripts but it's just that leap to editing the values of the selected objects that I'm not getting. Any help or guidance appreciated. Cheers, James Quote Link to comment
Vectorworks, Inc Employee Matt Panzer Posted April 12, 2011 Vectorworks, Inc Employee Share Posted April 12, 2011 Hi James, Here's one way to do it. This script simply edits all rectangles in the file (no need to select them). Depending on what you want, you could expand the criteria to include only visible rectangles on the active layer, etc. You may want to look at the ForEachObjectInLayer or ForEachObjectInList calls. These may help you get better control depending on your situation. HTH --------------------------------------------------- PROCEDURE MAIN; {-----------------------------------------} PROCEDURE EditRect( ObjHand : HANDLE ); BEGIN SetWidth( ObjHand, 200 ); ResetObject( ObjHand ); END; {||||| MAIN ||||||||||||||||||||||||||||||||||} BEGIN ForEachObject( EditRect, T = RECT ); ReDrawAll; END; RUN(MAIN); --------------------------------------------------- Quote Link to comment
James Russell Posted April 13, 2011 Author Share Posted April 13, 2011 Matt, Thanks for this, I was missing the link that the ForEach statements need to call a procedure and that all my alteration would go inside. I'll keep exploring and see what I find, at least I've got a map now. Cheers, James Quote Link to comment
Vectorworks, Inc Employee Matt Panzer Posted April 13, 2011 Vectorworks, Inc Employee Share Posted April 13, 2011 You welcome James. Glad to 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.