Duplicate of Destination X Rail spline of a MoSpli
On 26/08/2015 at 11:18, xxxxxxxx wrote:
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!
from c4d import gui
#Welcome to the world of Python
def main() :
#Create clone of original Spline
oSp = op.GetClone()
#Create 2nd Spline
sSp = oSp.GetClone()
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
#Clone new Spline from rail
rSp.SetName("New spline from rail X")
On 27/08/2015 at 02:16, xxxxxxxx wrote:
the MoSpline object is a generator. This means it will create new geometry or in this case, it will change the points of the linked splines. But a generator won't do anything just by standing there. A generator is only executed when the whole scene is evaluated.
So when you create the MoSpline in memory it won't do anything until it is part of a document and that document is evaluated.
To evaluate the document you can call ExecutePasses(). As it turns out, one must call ExecutePasses() twice to execute the MoSpline object completely.
On 27/08/2015 at 10:08, xxxxxxxx wrote:
Thanks, Sebastian. It worked perfectly!