[SOLVED]Turn between SplineData and BaseContainer?

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~

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.

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

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