PDA

View Full Version : Check if a Point/Polygon is selected (Modeler)



Robert Zeltsch
08-18-2004, 02:39 PM
Hello,

I have a problem with selections in modeler.
I want to check if a Point (or Polygon) is selected or not.
Is there a solution like "Isselected()" with a boolean output?
Thank you in advance!
:)

GregMalick
08-18-2004, 04:21 PM
I do believe that when in selmode(USER) that the points array contains all the user selected points. You'll need to know the point ID of what you are looking for and then check that array to see if it's there. Guess you could write a UDF to return a boolean.
Something like:




isSelected: myPnt {

for (pnt, points) if (myPnt == pnt) return(true);
return(false);

}

faulknermano
08-18-2004, 07:34 PM
i could be wrong, but it doesnt seem to make much sense to recheck a point's selected or unselected status because the first call to editbegin() will show you that already. even if we're looking for a point index, we can perform the search on the whole array instead of the checking the whole array for every point.

i dunno, maybe it's not practically a big deal, just thought of pointing it out. :)

btw: gregmalick: what a run-on style of coding! i could never get used to so many 'lines' in one line. :D

GregMalick
08-18-2004, 07:43 PM
so.... now I'm embarrassed about sharing code because of my style :o

Robert Zeltsch
08-19-2004, 01:52 AM
Hm, interresting style... :)

@faulknermano: I`m working on a script with two selection functions. One after another... ;) When the second function starts, I want to check if the points/polygons are already selected
by the first function.
I`m not selecting something by mouse - it`s all in the script.

Thanks.