Jump to content
Developer Wiki and Function Reference Links ×

Simple script - who can solve the problem?


VvierA

Recommended Posts

Hi there,

I have a simple script and I can not figure out, what the problem is:

PROCEDURE test;

VAR

numsel :INTEGER;

BEGIN

numsel := Count((SEL=TRUE));

message (numsel);

END;

run(test);

The script shows the number of the selected objects.

The problem is: if I run this script from within the annotations of a viewport on layout layer I always get 1 - no matter how many objects are selected.

If I run it while having selected objects on a construction layer or even directly on a layout layer the script message shows the exact number of selected objects.

Any ideas?

Thank you all

kind regards

VvierA

Link to comment
Hi there,

I have a simple script and I can not figure out, what the problem is:

PROCEDURE test;

VAR

numsel :INTEGER;

BEGIN

numsel := Count((SEL=TRUE));

message (numsel);

END;

run(test);

The script shows the number of the selected objects.

The problem is: if I run this script from within the annotations of a viewport on layout layer I always get 1 - no matter how many objects are selected.

If I run it while having selected objects on a construction layer or even directly on a layout layer the script message shows the exact number of selected objects.

Any ideas?

Thank you all

kind regards

VvierA

It returns 1 because you have the viewport selected.

From what you describe I'd say it doesn't return selected objects inside that container.

When using a foreachobject loop you could define how deep the search has to look but that would traverse everything in the drawing.

Look at http://developer.vectorworks.net/index.php/VS:GetVPGroup

to get a handle to the annotations group, then traverse the group and find all selected objects. I believe that's the easiest way.

Edited by Hippocode
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...