Results 1 to 5 of 5

Thread: Index of selected polygons

  1. #1
    Registered User
    Join Date
    Jan 2004
    Location
    Canyon Country, CA
    Posts
    12

    Index of selected polygons

    Is there a way of identifying the individual polygons in a user's selection so that command sequences can be run on the individual polygons? Perhaps an array somewhere that has the selected index numbers saved?

    For example, I have a mesh containing 100 polygons, 10 of which are randomly selected by the user. The polycount() show 10 polys selected but I want to be able to isolate each of the 10 selected polys and modify them individually, like extrude each polygon on the Y axis a different amount.

    Thanks!

    Kevin

  2. #2
    One way of doing it would be to copy the polygon IDs from the system provided polygons array then then use selpolygon with each ID to select one polygon at the time.
    This is a rough sketch from head, might have syntax errors:

    selmode(USER);
    editbegin();
    foreach(poly,polygons)
    {
    mypolys = mypolys + poly;
    }

    for(n = 0 ; n < mypolys.count() ; n++)
    {
    selpolygon(SET, POLYID, mypolys[n]);
    //do something with selection
    }
    editend;

  3. #3
    Worms no more! Free fun! Dodgy's Avatar
    Join Date
    Feb 2003
    Location
    Sydney
    Posts
    8,275
    You don't need the foreach, just

    editbegin();
    mypolys=polygons;
    editend();

    will do it. You can't call selpolygon() in an editbegin/end section either I don't think, as it's a command sequence, not meshedit command.
    Push the software, don't let it push YOU!
    My own plugins and work:www.mikegreen.name
    LaptopSetup:corei7 2.4GHz nvidia GT 650M 8Gig win8 64
    WorkSetup:core i7 3.4Ghz nvidia Quadro 2000 12Gig Ram Win7

  4. #4
    Quote Originally Posted by Dodgy
    You don't need the foreach, just

    editbegin();
    mypolys=polygons;
    editend();

    will do it. You can't call selpolygon() in an editbegin/end section either I don't think, as it's a command sequence, not meshedit command.

    You learn something new everyday + I didn't remember if selpolygon runs in edit mode or not without actually trying it so I mentioned that it might contain errors. Thanks for clarification
    Last edited by art; 02-15-2008 at 07:32 AM.

  5. #5
    Registered User
    Join Date
    Jan 2004
    Location
    Canyon Country, CA
    Posts
    12
    Thanks for the help. That solved it.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •