Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    SplineData.MakeLinearSplineLinear()

    Scheduled Pinned Locked Moved PYTHON Development
    12 Posts 0 Posters 899 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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().

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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. 😊

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            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:)

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                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()   
                
                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  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). 😉

                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    Helper
                    last edited by

                    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()

                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      Helper
                      last edited by

                      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)
                      
                      1 Reply Last reply Reply Quote 0
                      • H Offline
                        Helper
                        last edited by

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

                        Niklas, you'r THE MAN!!!

                        Thank you.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post