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

    Sweep object SplineScale splinedata

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 382 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 27/02/2013 at 07:19, xxxxxxxx wrote:

      Hi all,

      I have a script where I am creating sweepNURBs objects in python based on imported data. Its all working fine. I have radius information for each point of the imported splines, and I'd like to address the SweepNURBS[c4d.SWEEPOBJECT_SPLINESCALE] spline data parameters to:

      - set the spline type to linear

      - add spline knots for each data point

      - set the y value to reflect the radius at that point

      - set the x value to position the knot along the spline proportional to the point's position along the imported spline.

      I've searched, but I'm not finding much about this, and I may be wrong, but the c4d.SplineData documentation seems mostly oriented toward making custiom GUIs...

      Any insight from the hive mind? Thanks in advance...

      Nick

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

        On 27/02/2013 at 08:41, xxxxxxxx wrote:

        read c4d.SplineData, it is all there. the class is the wrapper for the SplineData CustomGui, but
        has itself nothing to do with CustomGuis (spline data is just like most of the the c4d interface
        elements a CustomGui).

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

          On 27/02/2013 at 10:48, xxxxxxxx wrote:

          Hi,

          I've read the splinedata section but my attempts to use it haven't worked.

          Here's an example of what I've tried:

          Sweep = c4d.BaseObject(c4d.Osweep)
                      Sweep[c4d.ID_BASELIST_NAME] = "Sweep"
                      Sweep[c4d.SWEEPOBJECT_CONSTANT] = False
                      
                      splineRadius = Sweep[c4d.SWEEPOBJECT_SPLINESCALE]
                      splineRadius.InsertKnot(0.5, 0.5, 0)

          doc.InsertObject(Sweep)

          Here I'm hoping that a new knot is created between the default knots at a y position of .5. I've also tried the SetKnot command to no avail.

          I don't get errors, but I also don't get any new knots...

          Nick

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

            On 27/02/2013 at 10:58, xxxxxxxx wrote:

            you have to write your variable back or dircetly use the your spline object.
            Sweep[c4d.SWEEPOBJECT_SPLINESCALE].InsertKnot(args)

            but you should use setknot, as it is the method connected to the new splinedata 
            interface.

               
            # --- init values
            # -----------------------------------------------------------------------------------
            def Init(self, node) :
                ...
                rampSpl, rmpCount = c4d.SplineData(), 7
                rampSpl.MakePointBuffer(rmpCount)
                step = 1.0/ (rmpCount-1)
                for i in xrange(rmpCount) :
                    if i == 0:
                        rampSpl.SetKnot(index = i, vPos = c4d.Vector(i * step, (i * step) ** 5, 0), interpol = 1)
                    elif i >= rmpCount-2:
                        rampSpl.SetKnot(index = i, vPos = c4d.Vector(i * step, (i * step) ** 5, 0), interpol = 1)
                    else:
                        rampSpl.SetKnot(index = i, vPos = c4d.Vector(i * step, (i * step) ** 5, 0), interpol = 2)
              
                linearSpl = c4d.SplineData()
                linearSpl.SetKnot(index = 0, vPos = c4d.Vector(0,  1, 0), vTangentLeft = c4d.Vector(-.25, 0, 0), vTangentRight = c4d.Vector(.25, 0, 0))
                linearSpl.SetKnot(index = 1, vPos = c4d.Vector(1, .8, 0), vTangentLeft = c4d.Vector(-.25, .15, 0), vTangentRight = c4d.Vector(0, 0, 0))
              
                node[c4d.IDC_NOISE_SPREADSPLINE]      = rampSpl
                node[c4d.IDC_NOISE_VERTEXSCALESPLINE] = linearSpl
            
            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 28/02/2013 at 13:17, xxxxxxxx wrote:

              Many thanks for your help...

              I still couldn't get it to work (beginning Python coder here), so I tried another tack: I duplicated the path spline, and adjusted the points to provide a rail spline for the sweepNURBs object. Works very well, and results in more controllable geometry.

              This is for the reconstruction of neuron geometry from morphology data files...

              Nick

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