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

    Set Sweep Spline Points?

    Scheduled Pinned Locked Moved PYTHON Development
    8 Posts 0 Posters 806 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

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

      On 11/07/2012 at 23:48, xxxxxxxx wrote:

      Having a hard time with this spline stuff, how do I get this to work on a tag?

      def main() :
          obj = op.GetObject()
          sweepSpline = obj[c4d.SWEEPOBJECT_SPLINESCALE]
          s1XPos = some changing value
          sweepSpline.SetKnot(index=0, vPos= c4d.Vector(s1XPos, 0, 0))

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

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

        On 12/07/2012 at 02:56, xxxxxxxx wrote:

        One would think one should only reset the spline with the changed point like:

        obj[c4d.SWEEPOBJECT_SPLINESCALE] = sweepSpline
        

        at the end of the code, but that gives a broken result......

        I'd be happy to see how to as well.....

        Cheers
        Lennart

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

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

          On 12/07/2012 at 09:05, xxxxxxxx wrote:

          This seems to work like I'd expect it to work.
          What do you think is  broken about this code Lennart?

          #This example sets the spline GUI to 3 points with some tangent settings  
          #This only works in R13++  
            
          import c4d  
            
          def main() :  
            obj = op.GetObject()  
            sweepSpline = obj[c4d.SWEEPOBJECT_SPLINESCALE]  
            sweepSpline.MakeLinearSplineLinear(3)  
            sweepSpline.SetKnot(index=0, vPos=c4d.Vector(0, 0, 0),vTangentRight=c4d.Vector(0,.2,0))  
            sweepSpline.SetKnot(index=1, vPos=c4d.Vector(.5, .5, 0),vTangentLeft= c4d.Vector(0,.2,0),vTangentRight=c4d.Vector(0,.2,0))  
            sweepSpline.SetKnot(index=2, vPos=c4d.Vector(1, 1, 0),vTangentLeft= c4d.Vector(-.2,-.4,0))  
            
            obj[c4d.SWEEPOBJECT_SPLINESCALE]=sweepSpline
          

          -ScottA

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

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

            On 12/07/2012 at 09:12, xxxxxxxx wrote:

            Scott, your code works fine if you are setting the points in the spline at predetermined values, and also restricting the change of any of these values. But what I was looking for was being able to adjust the values of the position of index(1) XPos for example with values that may change over time.

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

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

              On 12/07/2012 at 09:38, xxxxxxxx wrote:

              Originally posted by xxxxxxxx

              what I was looking for was being able to adjust the values of the position of index(1) XPos for example with values that may change over time.

              Maybe I'm being thick headed and not understanding what you want to do.
              But it sounds like you just simply need to create variables for the knot's values and put those variables inside of the SetKnot() parameters instead of the hard coded values I used.
              Then use those variables to check for certain conditions to change the knot's values.

              A tag will always execute the code inside of it.
              So if you wanted to be able manually move the knot & also move the knot automatically when a condition happens. You'll have to set up some kind of mixing, or switching condition in the code for that.

              Everything seems to work as expected to me.
              But like I said. Maybe I'm misunderstanding what you're trying to achieve.

              -ScottA

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

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

                On 12/07/2012 at 09:41, xxxxxxxx wrote:

                Scott, it works, I don't have the test I did yesterday, so I can't tell as why it failed.

                Cheers
                Lennart

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

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

                  On 12/07/2012 at 09:54, xxxxxxxx wrote:

                  ^OK.
                  Just wondered if I was missing something.

                  -ScottA

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

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

                    On 13/07/2012 at 02:31, xxxxxxxx wrote:

                    Im sorry Scott, your code does indeed achieve what I was asking for, I just didn't take the time to test it or actually work through it. Thank you.

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