Jump to content
Developer Wiki and Function Reference Links ×

Example of Selection


Recommended Posts

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

Link to comment
  • Vectorworks, Inc Employee

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);

---------------------------------------------------

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...