On 07/09/2014 at 17:10, xxxxxxxx wrote:
Hi guys,
I'm new to Python Generators and need some help please.
I am using this code snippet (from this forum) to dynamically create a spline Outline of the supplied child object...
from c4d import utils as u
def main() :
nada = c4d.BaseObject(c4d.Ospline)
outline = op[c4d.ID_USERDATA,1] # Userdata "meter"
obj = op.GetDown()
if not obj: return nada
source = obj.GetClone()
if source.CheckType(c4d.Ospline) is False: #Parametric object
pobj = u.SendModelingCommand(
command = c4d.MCOMMAND_CURRENTSTATETOOBJECT,
list = [source],
mode = c4d.MODELINGCOMMANDMODE_ALL,
doc = obj.GetMain())
source = pobj[0]
bc = c4d.BaseContainer()
bc.SetData(c4d.MDATA_SPLINE_OUTLINE, outline)
offspline = u.SendModelingCommand(
c4d.MCOMMAND_SPLINE_CREATEOUTLINE,
[source],
c4d.MODELINGCOMMANDMODE_ALL,
bc)
return source.GetClone()
This all works great.
I am wanting to make a very slight modification, so that I can opt to ONLY keep the newly created offset segment and remove the original spline from the generator output. The Python SDK suggests there is already this functionality, just like it exists with the the destructive version of this modelling tool.
ie. MCOMMAND_SPLINE_CREATEOUTLINE by adding True flag to MDATA_SPLINE_OUTLINESEPARATE.
However I am not sure how to implement this properly, and i suspect because it creates a new separate object beneath the generator op, i don't know how to return it properly. I've tried some silly things and nothing really works.
Help a noob?
Thanks guys.
Parallel thread at CGSociety here...