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
    • Recent
    • Tags
    • Users
    • Login

    Custom Helix Spline Y_Movement [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 469 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 13/02/2015 at 01:03, xxxxxxxx wrote:

      I have this script for my own Helix spline:

      spl_A = doc.SearchObject("Spline_01")    
              
          spl_pntC = 36    
          spl_start = c4d.Vector (100.0, 0.0, 0.0) # Spline Size 
          
          pnt_rad = utils.Rad((360.0 + 10.0) / spl_pntC)
          spl_end = c4d.Vector(0.0, 1.0, 0.0) #Movement
          
          spl_A.SetPoint (0,spl_start)
               
          spl_A.ResizeObject(spl_pntC) 
          
          for id in xrange(1,spl_pntC) : 
              
              spl_start = utils.MatrixRotY(pnt_rad) * utils.MatrixMove(spl_end) * spl_start 
              
              spl_A.SetPoint(id, spl_start) 
        
          spl_A[c4d.SPLINEOBJECT_TYPE] = c4d.SPLINETYPE_AKIMA 
        
          # Spline does not close 
          spl_A[c4d.SPLINEOBJECT_CLOSED] = False 
          
          # Update of object 
          spl_A.Message (c4d.MSG_UPDATE)
      

      I have a problem with my "MatrixMove" part. It does do what it is suppose to but I want to read it in cm eg: 21cm and not the matrix data. How would I do that 😊 
      I want to adjust the height up and down with a control

      Thanks for any help

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

        On 13/02/2015 at 02:31, xxxxxxxx wrote:

        Hello,

        it´s already there.

        your spl_end variable gives you units in centimeters.
        c4d.Vector(0.0, 10.0, 0.0)  is 10 cm hight.

        If your object should be 360 cm high you´ll need 37 points (because the first one is 0)
        Keep in mind that your spline interpolation method add´s some hight to the bounding box, too.
        With e.g. linear interpolation you´ll get exactly 360 cm at 37 points.

        Best wishes
        Martin

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

          On 13/02/2015 at 02:50, xxxxxxxx wrote:

          Hi Martin.

          This "c4d.Vector(0.0, 10.0, 0.0) " does not give me a 10cm height as you stated but give me a height of 350 cm.

          Is there maybe another way to re-script this so that I can get a accurate height reading.

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

            On 13/02/2015 at 03:00, xxxxxxxx wrote:

            Hi,
            this is your step vector you multiply it for every x in xrange in the script so:
            Let´s say 37 steps -> spl-pntC = 37
            the first one is at 0.0 height.
            36*10 = 360 cm

            if you want 10 cm at the end how is your step size than?
            your step size should be 10/36.

            easy I guess

            hope this helps

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

              On 13/02/2015 at 04:09, xxxxxxxx wrote:

              Geez, thanks Martin 👏
              As simple as that 😊

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