On 26/08/2015 at 11:18, xxxxxxxx wrote:
Hi,
As an exercise I am trying to duplicate the Destination X Rail spline of a MoSpline, after changing its width.
So far I wasn't able to create a duplicate of the spline with the new offset/width, I just get the original one as if it is ignoring it is being modified by the MoSpline.
Any ideas with way to go? I was looking into GetCache(), but I wanted to ask first in case is something way more simpler.
Thanks in advance!
import c4d
from c4d import gui
#Welcome to the world of Python
def main() :
#Create clone of original Spline
oSp = op.GetClone()
oSp.SetName("original")
#Create 2nd Spline
sSp = oSp.GetClone()
sSp.SetName("rail X")
#Create MoSpline
mS = c4d.BaseObject(440000054)
#Assign splines and width
mS[c4d.MGMOSPLINEOBJECT_MODE] = 1
mS[c4d.MGMOSPLINEOBJECT_SOURCE_SPLINE] = oSp
mS[c4d.MGMOSPLINEOBJECT_DEST_RAILX] = sSp
mS[c4d.MGMOSPLINEOBJECT_SPLINE_WIDTH] = 100
#Add to Scene
doc.InsertObject(mS)
doc.InsertObject(oSp)
doc.InsertObject(sSp)
#Clone new Spline from rail
rSp =sSp.GetClone()
rSp.SetName("New spline from rail X")
doc.InsertObject(rSp)
#mS.Remove()
c4d.EventAdd()
if __name__=='__main__':
main()