Loading selected Points as an array?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/02/2010 at 05:53, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   11.5 
    Platform:      Mac OSX  ; 
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    Hi,

    I was wondering if anybody could help me. I'm very new to scripting and have not done very much at all, so sorry if this is the easiest thing in the world.

    I'm trying to create a plugin that effects selected points of an object only. I'm struggling to find a way to load the currently selected points as an array so that I can move them. Is there a way to do this? I know how to get the point selection as a member of the BaseSelect class, but don't know how to access the individual point coordinates once I have done this.

    Any help would be greatly appreciated!

    Oh, one side note, I'm currently working out the script on a coffee tag within the document so I don't know whether this changes the way I approach this task.

    Thanks in Advance!

    Peth



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/02/2010 at 06:46, xxxxxxxx wrote:

    The GetPoints() method of the PointObject class returns an array with the object's points.

    Or use the GetPoint() method to access single points.

    Example:

      
    // op is your polygon/point object  
    var sel = op->GetPointSelection();  
      
    var points = op->GetPoints();  
    var pcnt = op->GetPointCount();  
      
    var i = 0;  
    for (i = 0; i < pcnt; i++)  
    {  
      if (sel->IsSelected(i))  
      {  
          println(i);    //index of selected point  
          println(points[i]);    //value of selected point  
      }  
    }  
    

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/02/2010 at 06:57, xxxxxxxx wrote:

    Excellent, thanks so much. I'd got some of the way there, but couldn't quite get it working. That's brilliant though, thanks!


Log in to reply