whats stopping render

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 23/03/2012 at 04:04, xxxxxxxx wrote:

Put this in a generator
turn off cache

drop in poly object

results in spline

but you then can't render in viewport?

import c4d
from c4d import utils 
def main() :
    output = None
    obj = op.GetDown()
    if not obj: return None
       
    if obj:
        if not obj.CheckType(c4d.Opolygon) : return None
        if obj[c4d.ID_BASEOBJECT_VISIBILITY_EDITOR] != 1:   
            obj.Edit()   
            doc.SetMode(c4d.Medges) 
        source = obj.GetClone()
        obj[c4d.ID_BASEOBJECT_VISIBILITY_EDITOR] = 1
        obj[c4d.ID_BASEOBJECT_VISIBILITY_RENDER] = 1
        utils.SendModelingCommand(c4d.MCOMMAND_SELECTALL, list = [obj], mode = c4d.MODELINGCOMMANDMODE_EDGESELECTION, bc = c4d.BaseContainer(), doc = doc)
  
        if c4d.utils.SendModelingCommand(c4d.MCOMMAND_EDGE_TO_SPLINE, [source]) :
            output = source.GetDown().GetClone()
            source.DelBit(c4d.BIT_AOBJ)
    return output

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 23/03/2012 at 14:42, xxxxxxxx wrote:

I'm pretty sure that you have to manually check for Dirty in your code if you turn of the cache option like that.
Otherwise the generator keeps running in an infinite loop and prevents it from rendering.

Here's a different approach to making the child of a generator a spline object:

import c4d  
from c4d import utils  
   
def main() :  
    
  sweep = None    #Error handling if no object is a child of the generator      
    
  obj = op.GetDown()  
  
  if obj is not None and obj.CheckType(c4d.Opolygon) :  
      obj[c4d.ID_BASEOBJECT_VISIBILITY_EDITOR] = 1  
      obj[c4d.ID_BASEOBJECT_VISIBILITY_RENDER] = 1  
      source = obj.GetClone()  
      utils.SendModelingCommand(c4d.MCOMMAND_SELECTALL, list = [obj], mode = c4d.MODELINGCOMMANDMODE_EDGESELECTION, bc = c4d.BaseContainer(), doc = doc)  
  
      if c4d.utils.SendModelingCommand(c4d.MCOMMAND_EDGE_TO_SPLINE, [source]) :  
          spline = source.GetDown().GetClone() #Return a clone of the selected splines  
  
      circle = c4d.BaseObject(c4d.Osplinecircle) #Create the sweep profile object  
      circle[c4d.PRIM_CIRCLE_RADIUS] = 2  
     
      sweep = c4d.BaseObject(c4d.Osweep) #Create a sweepNURBS object  
      spline.InsertUnder(sweep)          #Put the source object under the sweep object  
      circle.InsertUnder(sweep)          #Put the circle object under the sweep object  
  
  return sweep

-ScottA

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 25/03/2012 at 03:55, xxxxxxxx wrote:

Thanks Scott - as ever, appreciate the input.

Really want just the spline.

Can't see any way to get dirty data - no explanation of generate cache
Wish there were more info an the generator, its limitations, how to's etc