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

    Spline with closed and open segments

    Cinema 4D SDK
    python r19 r20
    2
    5
    872
    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.
    • a_blockA
      a_block
      last edited by

      Hi,

      the API of the SplineObject seems to suggest, one could have a spline with the open and closed segments (as one can set the closed flag on a per segment basis in SplineObject.SetSegment()). But I simply can't get it to work.

      Basically I'm doing something like the following, always ending up with all open segments:

      import c4d
      
      def main():
          spline = c4d.SplineObject(6, c4d.SPLINETYPE_LINEAR)
          spline.ResizeObject(7, 2)
          spline.SetPoint(0, c4d.Vector(0.0, 0.0, 100.0))
          spline.SetPoint(1, c4d.Vector(100.0, 0.0, 100.0))
          spline.SetPoint(2, c4d.Vector(100.0, 100.0, 100.0))
          spline.SetSegment(0, 3, True)
          spline.SetPoint(3, c4d.Vector(0.0, 0.0, 200.0))
          spline.SetPoint(4, c4d.Vector(100.0, 0.0, 200.0))
          spline.SetPoint(5, c4d.Vector(100.0, 100.0, 200.0))
          spline.SetSegment(1, 3, False)
          spline.Message(c4d.MSG_UPDATE)
          doc.InsertObject(spline)
          c4d.EventAdd()
      
      if __name__=='__main__':
          main()
      

      Playing around with the Spline Pen, I'm somewhat afraid, this feature of the API is not working at all, as the Pen starts working with two spline objects as soon as a segment of the other "openess" gets involved.

      Not urgent at all, I can work with the obvious workaround of multiple splines.
      While writing this, I took a look at the C++ API and now, I'm pretty sure, I can answer the question myself already. In C++ such option does not seem to exist. Strangely so, this additional "closed" parameter in Python is not even optional.

      So, it's maybe more a request for a documentation fix than a real question.

      Cheers,
      Andreas

      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by

        hello Andreas ^^

        As Sebastian pointed to me there's this structure on c++ so we are not sure if it's a documentation issue, something that have never been used or simply a bug.

        I have to dive into the code to have a look and probably send an email.

        I'll be back with information as soon as i have them. (with the release it can take a bit more time than usual)

        Hope you everything is running fine on your side man 🙂

        Cheers,
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • a_blockA
          a_block
          last edited by a_block

          Thanks, Manuel!
          Indeed I overlooked the C++ Segment struct.
          Take your time.
          Here everything's fine 🙂

          1 Reply Last reply Reply Quote 0
          • ManuelM
            Manuel
            last edited by Manuel

            hi,
            sorry for the delay of this answer ...

            Well, as you understood, you can't have a spline with open and closed segments. It's global for the entire spline, either all closed or all opened.

            The parameter is there, in the structure. It's sometimes used internally instead of the spline parameter.

            Cheers,
            Manuel

            MAXON SDK Specialist

            MAXON Registered Developer

            1 Reply Last reply Reply Quote 0
            • a_blockA
              a_block
              last edited by

              Thanks, Manuel, for looking into it.
              Maybe worth a note in the docs? It is a bit confusing, isn't it?
              Cheers to the entire team,
              Andreas

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