Send Modeling Command with hierarchy

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

On 14/04/2011 at 09:34, xxxxxxxx wrote:

Hi there,

utils.SendModelingCommand() just returns a null, but it should return a hierarchy when converting a Cloner Object or Particle Geometry. Is this a bug or is thee a way to get the full converted hierarchy ?

thanks !
nux

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

On 14/04/2011 at 10:07, xxxxxxxx wrote:

Can you please post an example?

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

On 14/04/2011 at 10:22, xxxxxxxx wrote:

I'm not able to go to my Pc for today, so i just wrote this code from scratch on my mobile device since I can remember that code.

def MakeEditable(op) :   
    import c4d   
    from c4d.documents import BaseDocument   
    from c4d.utils import SendModelingCommand as SMC   
  
    op  = [op.GetClone()]   
    doc = BaseDocument()   
    doc.InsertObject(op[0])   
    op  = SMC(command = c4d.MCOMMAND_MAKEEDITABLE, list = op, doc = doc)   
    return op   
  
def main() :   
    converted = MakeEditable(op)   
    doc.InsertObject(converted)   
  
  
if __name__ == '__main__':   
    main()

If you convert a ClonerObject, the clones are usually grouped under a null. The same for Particle Geometry.
Executing this script does only insert the Top null, but not the children.

I do hope the code works, I'm sure it is exactly the same I used on my Pc.

Cheers, Niklas

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

On 14/04/2011 at 10:35, xxxxxxxx wrote:

Here's one way that works for me using current state to object:

  
import c4d  
from c4d import gui,utils  
  
def main() :  
    
  bc = c4d.BaseContainer() # Create a new Base Container    
  convert = utils.SendModelingCommand(c4d.MCOMMAND_CURRENTSTATETOOBJECT, list = [op], mode = c4d.MODIFY_ALL, bc = c4d.BaseContainer(), doc = doc)  
  doc.InsertObject(convert[0]) #SMC uses a list.So we need to specify which list element to add to the OM  
  c4d.EventAdd()  
  
if __name__=='__main__':  
  main()  

-ScottA

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

On 14/04/2011 at 10:52, xxxxxxxx wrote:

Oh that could have been the problem !

c4d.MODIFY_ALL

I'll check it out tomorrow, thanks. :)

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

On 19/04/2011 at 01:01, xxxxxxxx wrote:

Unfortunately, it does not.
It just inserts the top Null Object. And in your example, the command automatically inserts the object. And I'd need it just internally. And best also all polygons merged together.

Thanks, nux