View Full Version : Actual number of selected polys?

04-13-2009, 09:25 AM
I'm writing an lscript to rename surfaces in multiple layers, and have run into a problem:

If I do selmode(SET,SURFACE,mysurface) and there are no polys with the chosen surface, no polys are directly selected. However, polycount() then returns the total number of polys instead of the number 0 (which would be more polite, not to mention more accurate.)

Any way around this?

04-13-2009, 10:53 AM
There is no use for selmode() as you showed it. Did you mean selpolygon()?

Anways. Using selmode(USER), which is the default, you either get the count of selected elements or all elements if none is selected (implies all is selected, as per usual in Modeler). Using selmode(DIRECT) you get the count of the selected elements, if none is selected you get 0. Using selmode(GLOBAL) you get count of all elements. Page 93 in the LScript Reference manual! Mind you, to use selpolygon/selpoints you need to be in selmode(USER). You can switch at anytime (except within a MeshDataEdit session I think).

04-13-2009, 11:23 AM
Yes, I did mean selpolygon() not selmode(). I was typing from memory - sorry about that.

Thanks for the tip! I'll try that when I get back to my PC.