VvierA Posted August 9, 2016 Share Posted August 9, 2016 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 Quote Link to comment
Hippocode Posted August 10, 2016 Share Posted August 10, 2016 (edited) 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 August 10, 2016 by Hippocode Quote Link to comment
VvierA Posted August 10, 2016 Author Share Posted August 10, 2016 Thank you. As you suggested I traverse the group and simply count the selected objects. 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.