PDA

View Full Version : Modeler Selection Sets



GregMalick
07-23-2004, 01:57 AM
i have a bad feeling about this question...but

Can Point Selection Sets be created and deleted using LScript?

there that wasn't so bad

Karmacop
07-23-2004, 04:33 AM
Yes but it's not a simple command, you need to code for it (as far as I know). Also, there's no direct way to access that information, so for example, you'll need to go through every point to find out if each point belongs to a selection set, and then you'd delete that set from the point. I think anyway.

So the answer is yes, but it's not easy ;)

GregMalick
07-23-2004, 08:59 AM
Having all the point-id's is not a problem.... I'm creating the points. So more to the point [ha]...

How do I create a Point Selection Set (having an array of point ID's)?

faulknermano
07-24-2004, 03:33 AM
Originally posted by GregMalick
Having all the point-id's is not a problem.... I'm creating the points. So more to the point [ha]...

How do I create a Point Selection Set (having an array of point ID's)?

VMSELECT is the constant that defines PSS. PSS are VMaps that contain, i think strings.

dont have time to test but maybe it's something like this:


pss = VMap(VMSELECT,"setName",1);

-or-

pss = VMap(VMSELECT,"setName");

Karmacop
07-24-2004, 05:12 AM
I thought I'd help a bit more, sorry if this takes away your fun of creating a script :p

Vmaps are very annoying compared to doing a lot of other stuff with lscript, so I'll comment this script which does what you want (I think)



main
{

reqbegin("Give me a map name"); //start a requester
c1 = ctlstring("Map name?", "test"); //ask for the name of the selection map
return if !reqpost();
name = getvalue(c1); //get the name entered
reqend(); // end requester

selmode(USER); //select what the user has selected
editbegin();
vmap = VMap(VMSELECT, name,1); //initialise a vmap with the name enetered

foreach(p,points) //for every point ...
{
vmap.setValue(p,1); //set the value of the vmap to 1 (which means selected)
}

editend(); //finish applying yoru vmap
}

GregMalick
07-24-2004, 12:02 PM
WOW kc!:eek:
very very cool! :cool: and awesomely documented.
I'll keep you posted on this LScript that I'll be giving to the community.

This is just a "bell&whistle" that will allow a user to easily select the LScript created points (after closing the script).

BTW, faulknermano headed me in the right direction, but I was getting an error when I used an array of point-IDs. The "foreach" totally circumvents this issue -- Doh!!!
Thanks again....


Community, Community, Community

Karmacop
07-25-2004, 12:31 AM
You can use an array of points too, you're probably just doing something wrong. Don't worry though, lscript can be confusing sometimes :)

Here's how you can use a loop with an array of points



for (p = 1; p <= sizeof(points); p++) {
vmap.setValue(points[p],1);
}


points is created automatically once you enter into the edit mode. It's an array of all the selected points.

sizeof() returns the length of an array, in this case it's returning the number of selected points.

GregMalick
07-25-2004, 01:09 AM
yeah...that's pretty much what I'm doing.
I just thought I might be able to assign the entire set with one command...like you can with selpoint();

Actually, right now I'm redoing a bunch of code because the LScript Editor decided it wanted to turn all my code into a single unprintable character []. Luckily I had backed it up a couple hours defore.

Man, that editor sure doesn't like when you go from insert to overtype! :rolleyes:

Lynx3d
07-25-2004, 03:09 AM
*lol*

That sounds very familiar :D
The editor from LW6.5 crashed like every 5 minutes...just use an editor with customizeable syntax highlighting ;)
For me it's UltraEdit, but i think there are some nice freeware ones out there too...

Karmacop
07-25-2004, 07:37 AM
Yeah, I've elarnt that lesson too :p

I always save scripts as increments and I also try to to provoke the editor too much :p