Jump to content

Multiple selection with vectorscript


zuken86

Recommended Posts

You can use ForEachObject and then make the first step of your called procedure a test to see if the object is selected and only process it if it is.

Or you could do as Matt suggested and use ForEachObjectInList so the called function will only get handles to the objects that are selected.

Or you can just set up a loop and use FsActLayer and deselect the processed abject at the bottom of the loop. When FSActLayer returns a nil handle you have processed all the objects (on the active layer).

Really depends on what you are trying to do..

Link to comment

I am trying to create a script to select multiple instances of a selected symbol by name in the active design layer. This is what I have so far but I am missing something.

PROCEDURE SelectSameSymbol;

VAR

h:HANDLE;

name:STRING;

BEGIN

h:=ActSymDef; {How do I pass a selected symbol to h?}

name:=GetSDName(h);

SelectObj(S=name);

END;

RUN(SelectSameSymbol);

Thanks,

Link to comment

So you want to select a single instance of the symbol and have the script select all the instances of the same symbol?

Something like this should work. I have not run this so there may be some errors.

PROCEDURE SelectSameSymbol;

VAR
h:HANDLE;
name:STRING;

BEGIN
h:=FSActLayer;
name:=GetSymName(h);
DSelectAll;
SelectObj(S=name);
END;

RUN(SelectSameSymbol);

There used to be some kind of an issue with setting criteria using variables. The work around was to set the entire criteria to a string variable and then just put that single variable into the function/procedure that needed the criteria.

Link to comment
  • 2 months later...

I created a rectangle and a series of oval using Vectorscript. I wanted to clip surface but I can't seem to make it work. I think it has something to do with the last too lines in my code

SelectObj((T=RECT) AND (T=OVAL));

DoMenuTextByName('Clip Surface',0);

Did I do something wrong?

Thanks,

Link to comment

Short answer: Use OR instead of AND.

Longwinded answer:

SelectObj() is going through a list of objects one at a time and selecting any object that meets, in your case, both criteria (Rect AND Oval).

Since an object cannot be a RECT and and OVAL at the same time, you want the OR operator, instead of the AND operator.

You want to select any object that is either a RECT OR an OVAL. This will work for selecting all RECTs and OVALs:

SelectObj((T=RECT) OR (T=OVAL));

Raymond

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...