Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Updating a spline

    Cinema 4D SDK
    2
    3
    545
    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.
    • KantroninK
      Kantronin
      last edited by

      Hi

      How to update a spline if the number of points changes ?

      If the number of points is the same, we can use the following function:

      def spline_update(spline,tabPoint):
      	dim = len(tabPoint)
      	for i in range(0,dim):
      		spline.SetPoint(i,tabPoint[i])
      
      	spline.Message(c4d.MSG_UPDATE)
      	return spline
      

      If the number of points changes, we must use the ResizeObject() method

      I'm looking for an example, which will save me from doing tests.

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF ferdinand moved this topic from General Talk on
      • ferdinandF
        ferdinand @Kantronin
        last edited by

        Hello @Kantronin,

        I have moved your topic due to being in the wrong forum. You might want to look at our geometry_splineobject_s26.py example, as it demonstrates all fundamental aspects of the type, including resizing it.

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

        KantroninK 1 Reply Last reply Reply Quote 0
        • KantroninK
          Kantronin @ferdinand
          last edited by

          @ferdinand

          I made this function which works fine:

          def spline_update(doc,spline,tabNewPoint):
          	tabPoint = spline.GetAllPoints()
          	
          	dim = len(tabNewPoint)
          	if len(tabPoint) != dim:
          		spline.ResizeObject(dim)
          	
          	for i in range(0,dim):
          		point = tabNewPoint[i]
          		spline.SetPoint(i,point)
          
          	spline.Message(c4d.MSG_UPDATE)
          	return spline
          
          1 Reply Last reply Reply Quote 0
          • First post
            Last post