Hi @ferdinand !
Thank you for your response. It has to be the issue then. Is it possible to convert SplineObject to LineObject somehow?
Here's my code so far:
def main():
parent = c4d.BaseObject(c4d.Onull)
distance= op[c4d.ID_USERDATA,10]
custom_distance=op[c4d.ID_USERDATA,1]
link=op[c4d.ID_USERDATA,5]
spline_color=op[c4d.ID_USERDATA,9]
outline_only=op[c4d.ID_USERDATA,2]
hide_input=op[c4d.ID_USERDATA,3]
outline_color=op[c4d.ID_USERDATA,8]
final_distance=5
if distance == 0 :
final_distance=5
elif distance == 1 :
final_distance=8
elif distance==2:
final_distance=custom_distance
link_clone = link.GetClone()
connect_obj = c4d.BaseObject(c4d.Oconnector)
link_clone.InsertUnder(connect_obj)
if link_clone: #Parametric object
pobj = u.SendModelingCommand(
command = c4d.MCOMMAND_CURRENTSTATETOOBJECT,
list = [connect_obj],
mode = c4d.MODELINGCOMMANDMODE_ALL,
doc = op.GetMain())
connect_obj = pobj[0]
if outline_only:
bc = c4d.BaseContainer()
settings = c4d.BaseContainer() # Settings
settings[c4d.MDATA_SPLINE_OUTLINE] = final_distance # Distance
settings[c4d.MDATA_SPLINE_OUTLINESEPARATE] = True #Crée un nouvel objet
offspline = u.SendModelingCommand(
c4d.MCOMMAND_SPLINE_CREATEOUTLINE,
[connect_obj],
c4d.MODELINGCOMMANDMODE_ALL,
bc=settings,
doc=doc)
if offspline :
offspline[0].InsertUnder(parent)
offspline[0][c4d.ID_BASEOBJECT_USECOLOR] = 2 # Use Object ColorSpline
offspline[0][c4d.ID_BASELIST_ICON_COLORIZE_MODE]=2
offspline[0][c4d.ID_BASEOBJECT_COLOR] = outline_color # Red Color
# Convert the spline to a line (edges) using a Modeling Command
return offspline[0]
if not outline_only:
#settings[c4d.MDATA_SPLINE_OUTLINESEPARATE] = True #Crée un nouvel objet
#connect_obj = c4d.BaseObject(c4d.Oconnector)
bc = c4d.BaseContainer()
bc.SetData(c4d.MDATA_SPLINE_OUTLINE, final_distance)
offspline = u.SendModelingCommand(
c4d.MCOMMAND_SPLINE_CREATEOUTLINE,
[connect_obj],
c4d.MODELINGCOMMANDMODE_ALL,
bc)
return connect_obj.GetClone()
I'm inputting a null with multiple splines as children, then I put it under Connect object, simplify it, run outline command and get the result.