WhoCanDo Posted May 8, 2018 Share Posted May 8, 2018 I thought this was easy but alas it's not. I want to x := Count ((Sel = True)); Message (x); However, if I have a group of 3 objects and only this group object selected then x := 4 Some of my selected objects will be polygons, rectangles & groups of them. Quote Link to comment
Julian Carr Posted May 8, 2018 Share Posted May 8, 2018 You will need something like this, which only counts object whose parent is a layer: PROCEDURE xxxxx; VAR gNumObjects : INTEGER; Procedure CountThem(h1 : HANDLE); BEGIN IF GetType(GetParent(h1)) = 31 THEN gNumObjects := gNumObjects + 1; END; BEGIN gNumObjects := 0; ForEachObject(CountThem, (Sel = True)); Message(gNumObjects); END; RUN(xxxxx); Quote Link to comment
WhoCanDo Posted May 9, 2018 Author Share Posted May 9, 2018 Nice one Julian, This got me onto the right track. Regards Quote Link to comment
Pat Stanford Posted May 9, 2018 Share Posted May 9, 2018 @Julian Carr Sometimes having been around for a long time is a hinderance. I just found out about this one myself a few months ago. There is a new criteria called Visible Selection State. It only returns the objects that are individually visible (i.e. container objects) and ignores any selected objects inside those containers. Try count(((VSel=True))) In a file with a selected group made up of three selected objects, when I put the following formulas into a worksheet I get: Count(Sel=True) returns 4 Count(VSel=True) returns 1 I think this is what @WhoCanDo is actually looking for. Quote Link to comment
Julian Carr Posted May 9, 2018 Share Posted May 9, 2018 Well blow me down Pat - thanks. I need to get out more. Quote Link to comment
WhoCanDo Posted May 9, 2018 Author Share Posted May 9, 2018 VW is changing in leaps and bounds but what about ScriptFunctionReference.html. It's always behind the times and doesn't offer explanations nor examples. Thanks Pat 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.