List of points of spline?

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

On 08/02/2012 at 00:40, xxxxxxxx wrote:

Dear Café,

can anyone please tell me how can I get a list of spline's point? Or iterate through points.

What I want to do is go through all point of spline and execute Diconnect command on each point but I can't figure out how to do that.

Thanks, 
Sergey

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

On 08/02/2012 at 01:17, xxxxxxxx wrote:

Hello sergey,

did you take a look into the documentation?

def main() :  
  if not op.CheckType(c4d.Ospline) :  
      # not a spline-object  
      return  
  for point in op.GetAllPoints() :  
      # process points  
      pass

See the PointObject class for reference. Note that this is also available for Polygon-objects.

Cheers, Niklas

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

On 08/02/2012 at 01:23, xxxxxxxx wrote:

Hi Sergey,

SplineObject is a child class of PointObject. And there's a method GetAllPoints() in PointObject returning all the points of a a geometric object (polygon or spline).
To test this, execute this command in the console (with a spline object selected) :

op.GetAllPoints()

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

On 08/02/2012 at 05:55, xxxxxxxx wrote:

Many thanks to both of you!
Sorry for stupid question, I'm not a programmer, so a lot of obvious things doesn't make any sense to me :(
I've seen this method, and at first I thought that everything would be easy, but I have no idea what to do with it because it returns positions of points. And I can't simply do c4d.(command for disconnect) for them, because it tries to disconnect bunch of vector data, not the actual points. Maybe there's something else I don't understand?

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

On 09/02/2012 at 23:06, xxxxxxxx wrote:

I guess my question wasn't exactly correct, because as I understand Point methods return things like tangents or positions, but what I need is to select all points of spline turn by turn and apply disconnect. 
I guess every point has it's index so basically what I have to do is something like 
select(0)
for point in op.GetPointCount() :
disconnect;
select(point + 1)
but what don't seem to get is how to select a specific point.

Update: sorry for being an idiot, got it all by myslelf

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

On 09/02/2012 at 23:54, xxxxxxxx wrote:

Maybe you search for something like this:

import c4d
def main() :  
    selection = op.GetPointS();  
    selection.DeselectAll();  
    selection.Select(0);  
    for i in xrange(1, op.GetPointCount(), 0) :  
        #  
        # process stuff  
        #  
        selection.Deselect(i-1);  
        selection.Select(i);

Note: Written from scratch and therefore untested. Don't have access to C4D now.
__ 
Cheers, Niklas

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

On 10/02/2012 at 01:04, xxxxxxxx wrote:

Probably best to write down what you want to achieve in C4D itself

It sounds like you want to take a spline with X number of points
and go to each point in turn - running the disconnect command
thus replacing the whole spline - with individual 2 point segments

one complete spline made up of x points
spline[.-.-.-.-.-.]

same spline turned into separate 2 point segments
spline[.-. .-. .-. .-. ]

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

On 10/02/2012 at 07:41, xxxxxxxx wrote:

Thanks, Niklas! That was exactly what I wanted to do.

deepshade, yes, that's what I was doing. I've encountered a problem because after every 'disconnect' the index of next point I needed to disconnect has been shifting by 3, not by 1, but I figured it out. So thanks everyone!