PDA

View Full Version : How can I get the correct Point ID ?



toro
08-15-2003, 09:35 AM
Hello!
I'm beginning to use LScript in these days.

I'm writing an lscript("chamfer vertex" ) that need to get the PointID
from the selected points directly.

The point IDs of the composition elements can be obtained from a selected polygon
Using "Mesh Object Agents and vertex() method" or "polygon/polygon() method ".
But These methods requires more time and effort to only get the PointID from
the selected points directly. It would be not elegant in my case.

So I tried to use editbegin() function... but I could not use it well.

//-- <An example : display selected pointID > -------------//

main
{
 pnt=editbegin();

   for(i=1;i<=pnt;i++)
   info("Selected Point ID : ", points[i]);

 editend();
}

//-----------------------------------------//

When two points (ID:#9 and #27) are sedelcted, I run upper Lscript.
I suposed the information displayed are
<Selected Point ID : 9> and <Selected Point ID : 27>.

However, the information displayed are
<Selected Point ID : 1> and <Selected Point ID : 2> !
Where did I mistake? :-(

any help is appreciated.
Thanx

Tom Speed
08-15-2003, 06:19 PM
Hi,

Point IDs are opaque pointers that only LW needs to know about.

I'm suprised the values you get are 1 and 2!, what version of LW/LScript are you using?

What you should see (as I do when I run it) is something like:

<Selected Point ID : 94470216>
e.t.c

b.t.w If you select some points then hit 'i' for the information window in Modeler, the #numbers you see are Indexes, not IDs.

Cya!
Tom

toro
08-18-2003, 02:08 PM
Thanks Tom!
Your advice taught me that I had mixed up "PointID" and "Point Index".
I was able to understand the meaning of Points[] at last.
thank you!

>what version of LW/LScript are you using?
The Lscript version which I am using is 2.51 (in LW7.5).

Although I tried several times,The result was the same.
numbers are returned in an order from 1.
<Selected Point ID : 1>
<Selected Point ID : 2> .......

fummm.....??:confused:

Tom Speed
08-18-2003, 02:35 PM
Hi again,

LScript v2.51 is an older version, if you have LW7.0+, get the free upgrade to version 7.5c which has LScript v2.6.1.

Tom

faulknermano
08-19-2003, 07:30 AM
Originally posted by Tom Speed
Hi,

Point IDs are opaque pointers that only LW needs to know about.

I'm suprised the values you get are 1 and 2!, what version of LW/LScript are you using?


indeed the pointIDs are opaque pointers, but i think lscript gives it to us in integers to better facilitate debugging and such.


toro: i think your problem is selmode(USER). for every modeler script that you do, NEVER EVER FORGET TO SPECIFY SELMODE(). :D