SplineData.MakeLinearSplineLinear()

On 28/01/2013 at 04:30, xxxxxxxx wrote:

Hi guys.

I am using MakeLinearSplineLinear() in PYTHON, but this function is only implemented since R13. What function should I look in R12?

What I need to make, is in INIT stage I need to set 2 points on spline. Ho should this be done in R12?

Thank you.

On 28/01/2013 at 04:43, xxxxxxxx wrote:

Hi Tomas,

you can use the SplineData.SetKnot() method.

On 28/01/2013 at 04:47, xxxxxxxx wrote:

Isn't SplineData.SetKnot() implemented only since R13?
http://chicagoc4d.com/C4DPythonSDK/modules/c4d/CustomDataType/SplineData/index.html#SplineData.SetKnot

On 28/01/2013 at 04:50, xxxxxxxx wrote:

Originally posted by xxxxxxxx

Isn't SplineData.SetKnot() implemented only since R13?
http://chicagoc4d.com/C4DPythonSDK/modules/c4d/CustomDataType/SplineData/index.html#SplineData.SetKnot

Hi Tomas,

Yes, you should instead call SplineData.InsertKnots() and set the tension with SplineData.SetRound().

On 28/01/2013 at 04:55, xxxxxxxx wrote:

Originally posted by xxxxxxxx

Isn't SplineData.SetKnot() implemented only since R13?
http://chicagoc4d.com/C4DPythonSDK/modules/c4d/CustomDataType/SplineData/index.html#SplineData.SetKnot

You're right, my fault. 😊

On 28/01/2013 at 05:33, xxxxxxxx wrote:

Thanks guys:), InsertKnot() seems to be working.
But maybe I am missing something else?
I am getting four point on the spline now 😞

self.sizeSpline = c4d.SplineData()
            self.sizeSpline.SetRound(0)
            self.sizeSpline.InsertKnot(0, 1)
            self.sizeSpline.InsertKnot(1, 0)

And it looks nothing as expected:)

On 28/01/2013 at 05:37, xxxxxxxx wrote:

Hi Tomas,

I'm sure you wanted to thank Yannick, he told you about the InsertKnot() method. 😉

_> >> I am getting four point on the spline now 😞 _

You probably need to remove the points that are there by default. Use the DeleteAllKnots()
method before inserting your knots.

On 28/01/2013 at 05:47, xxxxxxxx wrote:

yeap, sorry about that Yannick:)

WOW - I removed points and now it works. Wo-Hoooo. Thank you everybody.
In case someone will find this topic useful, here's a code

  
spline = c4d.SplineData()   
spline.DeleteKnot(0)     #Delete Knot 0   
spline.DeleteKnot(0)     #Delete Knot 1   
spline.InsertKnot(0, 1) #Set the first knot's position   
spline.InsertKnot(1, 0) #Set the second knot's position   
print "Point Count: ", spline.GetKnotCount()   

On 28/01/2013 at 05:53, xxxxxxxx wrote:

Hi Tomas,

Instead of using DeleteKnot() two times, you can just use DeleteAllKnots () to flush all knots
from the SplineData (as I suggested above). 😉

On 28/01/2013 at 06:12, xxxxxxxx wrote:

Strage, but I get error "AttributeError: 'c4d.SplineData' object has no attribute 'DeleteAllKnots'"
if I use this:

spline = c4d.SplineData()
spline.DeleteAllKnots()

On 28/01/2013 at 06:21, xxxxxxxx wrote:

Hi Tomas,

I just tested it in R12 and I get the same error. The R12 documentation must be wrong then.
Alternatively, you can use this function:

def flush_splinedata(spl) :
    count = spl.GetKnotCount()
    for i in xrange(count) :
        spl.DeleteKnot(0)

spl = c4d.SplineData()
flush_splinedata(spl)

On 28/01/2013 at 06:23, xxxxxxxx wrote:

Niklas, you'r THE MAN!!!

Thank you.