I've attached the entire script.
Basically u select any number of objects in your scene (any kind) and when you run it, enter a percentage value, say 20%.
The script is supposed to generate unique random objects and select only 20% of the selected items.
I made a small error when I sent in the original script... my loop actually runs from 1 to arrayLength coz I assumed that u have to do at least one SelectObject before I can use AddToSelection...
correct me if I am wrong though.
thanks again though!
On 1/11/08, Ponthieux, Joey <j.ponthieux(at)nasa.gov> wrote:
Someone correct me if I'm wrong here but aren't you adding the same
object back to the Selection Object?
When you use SelectObj it places whatever into Selection, in this case
it looks as though objArray[0] gets placed in Selection(0), but without
knowing what the content of objArray is this could be questionable.
Then you set up a loop, which starts at 0 and you attempt to iterate
through objArray ultimately adding
objArray[0] back into Selection where it already exists.
Joey Ponthieux
NCI Information Systems Inc.
NASA Langley Research Center
____________________________________________________________
Opinions stated here-in are strictly those of the author and
do not represent the opinions of NASA or any other party.
Ajit Menon wrote:
> Hi all
> I have a simple selection script which however every now and then
> gives me an error:
>
> // WARNING : 3030-SELE-AddToSelection - Command was cancelled.
>
> I have no idea why it's doing it coz it seems random. Here's that part
> of the script:
>
>
> SelectObj(objArray[0], null, true);
>
> for (s=0;s<arrayLength;s++)
> {
>
> // logmessage("Selected Array index is :"+sel);
> // logmessage("Selected Object is :"+objArray[sel]);
> AddToSelection (objArray[s], null, true);
> }
>
>
>
> Thanks in advance
> Ajit
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi
Attachment:
fad_select_script.js
Description: JavaScript source