Convert Object internally



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

    On 19/02/2011 at 20:06, xxxxxxxx wrote:

    Hi Guys,

    just started Python and I think I'm doing very well.
    I've created a simple Cloner with the Python Generator. Now I want to Convert the Clone internally to a PolygonObject.
    I tried SendModelingCommand() but it crashes because there is no document overloaded (because the Object is just virtual x) ).

    So, my Question would be: Is there a way to Convert an Object internally in Python ?

    Thanks in advance, nux



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

    On 25/02/2011 at 08:01, xxxxxxxx wrote:

    I could find a way to do it:

    def MakeEditable(op) :  
      import c4d  
      if (not op) | op.CheckType(c4d.Opolygon) | op.CheckType(c4d.Ospline) : return op  
      
      op = [op.GetClone()]  
      doc = c4d.documents.BaseDocument()  
      doc.InsertObject(op[0],None,None)  
      op = c4d.utils.SendModelingCommand(  
                                command = c4d.MCOMMAND_MAKEEDITABLE,  
                                list = op,  
                                doc = doc )  
      return op[0]
    

    Cheers, nux



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

    On 25/02/2011 at 08:03, xxxxxxxx wrote:

    I recommend you to use c4d.Ospline, c4d.Opolygon,... instead of hardcoded constants. I would also use CheckType(...) instead of GetType() so it accepts subtypes as well.

    op.CheckType(c4d.Opolygon)
    

    Cheers, Sebastian



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

    On 25/02/2011 at 08:29, xxxxxxxx wrote:

    Ah thanks, changed it :)


Log in to reply