Results 1 to 9 of 9

Thread: Iterate through points

  1. #1

    Iterate through points

    pointCount on a box results in 8 but the iteration loops fails after index of 5. What gives.

    Code:
    main
    {
        mesh = Mesh(0);
        info (mesh.pointCount(1));
        pc = mesh.pointCount();  
        for(i=1; i <= pc; i++)
        {
        	pnt = mesh.points[i];
        	nPos = mesh.position(pnt);
            info (nPos);
        }
    }
    My opinions and comments do not represent those of my employer.
    www.ernestpchan.com
    www.zazzle.com/gopuggo

  2. #2
    This same code works in Layout but not Modeler...what the!
    My opinions and comments do not represent those of my employer.
    www.ernestpchan.com
    www.zazzle.com/gopuggo

  3. #3
    Member
    Join Date
    Oct 2003
    Location
    Near Edinburgh
    Posts
    246
    Just ran a test in modeler 9.6 with and without debug, get all 8 points on a basic box.

  4. #4
    Quote Originally Posted by iain_r View Post
    Just ran a test in modeler 9.6 with and without debug, get all 8 points on a basic box.
    Ok, something must have broken in 11.6.3 then.

    Thx iain_r for checking.
    My opinions and comments do not represent those of my employer.
    www.ernestpchan.com
    www.zazzle.com/gopuggo

  5. #5
    TrueArt Support
    Join Date
    Feb 2003
    Location
    Poland
    Posts
    8,280
    What does 1 mean in 2nd row "info (mesh.pointCount(1));"
    What is difference between "info (mesh.pointCount(1));" and "info (mesh.pointCount());" ?
    (I would use info(pc) - that's loop counter after all)

    Check to which it goes when you remove info()
    f.e. add info after whole loop, just read i variable.

    In C/C++ LWSDK pointCount() takes argument whether returned should be all points, or selected points, or deleted points.
    Last edited by Sensei; 03-03-2015 at 11:25 PM.

  6. #6
    Member
    Join Date
    Oct 2003
    Location
    Near Edinburgh
    Posts
    246
    When I run this in 11.6.3 with debug it finds all the points, however when not in debug I get the following error message "Line 14, illegal index value: point[5]"

    Iain

  7. #7
    Member
    Join Date
    Oct 2003
    Location
    Near Edinburgh
    Posts
    246
    Broken from 11.5, tried that and 11.6

    Iain

  8. #8
    Member
    Join Date
    Oct 2003
    Location
    Near Edinburgh
    Posts
    246

    Points in object

    You can try this piece of code for modeler

    Regards

    Iain

    Code:
    @version 2.8
    @warnings
    @name NumberPoints
    @script modeler
    
    main
    {
        selmode(USER);
        pc = pointcount();  
        info(pc);
        editbegin();
        for(i=1; i <= pc; i++)
        {
        	nPos = pointinfo(points[i]);
            info (nPos);
        } 
        editend();
    }

  9. #9
    Thanks! Will do.
    My opinions and comments do not represent those of my employer.
    www.ernestpchan.com
    www.zazzle.com/gopuggo

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
  •