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

    [SOLVED]Turn between SplineData and BaseContainer?

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 506 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 29/11/2017 at 04:13, xxxxxxxx wrote:

      [Original Topic] Convert between SplineData and base container?

      [Original Post]

      Hello, again!

      In a previous Topic, I learn how to create a default spline user data.

      But there comes some other problems.

      <1> If I want to use c4d.SplineData to set some value first, then turn it into a base container for adding it to user data,

      <2> or use c4d.SplineData to change some value in a predefined "SplineData" base container,
      how can I do?

      Thanks again~

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

        On 29/11/2017 at 05:41, xxxxxxxx wrote:

        import c4d
          
        def main() :
            obj = doc.GetActiveObject()
            if not obj: return
            
            # Create Spline Data
            bc = c4d.GetCustomDatatypeDefault(c4d.CUSTOMDATATYPE_SPLINE)
            bc[c4d.DESC_NAME] = "Spline"
            splineID = obj.AddUserData(bc)
            
            # Assign default vaue
            spline = c4d.SplineData()
            spline.SetKnot(1,c4d.Vector(1,1,0))
            
            obj[splineID] = spline
            
            c4d.EventAdd()
          
        if __name__=='__main__':
            main()
          
        
        

        Basicly SplineData do not get a Basecontainer but it's the host objet that have one. And you copy or set this basecontainer that link to a SplineData.

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

          On 29/11/2017 at 08:53, xxxxxxxx wrote:

          Thank you for your patience and detail answer!
          I learn a lot!
          Thank you again!

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