Automatically Press Button on Oobject Type

On 14/03/2017 at 21:16, xxxxxxxx wrote:

Hi Guys, 
It's as been a while I haven't post anything. lol 
But here's my problem, its setting or would say automatically press Flip Button on SYMMETRY OBJECT.
c4d.CallButton don't work. Is  I'm using it in the wrong way.

def main() :
  
    doc = c4d.documents.GetActiveDocument()
    Cube = doc.GetActiveObject()
  
    Sym = c4d.BaseObject(c4d.Osymmetry) # Symmetry 
    Sym[c4d.SYMMETRYOBJECT_AUTOFLIP]=True 
    Sym[c4d.SYMMETRYOBJECT_PLANE]=1 
    Sym.SetName("Python")
    Cube.InsertUnder(Sym)
  
    ### Problem ###	
    c4d.CallButton(Sym, c4d.SYMMETRYOBJECT_FLIP)
  
    doc.InsertObject(Sym) 
    c4d.EventAdd()
if __name__=='__main__':
    main()

Thanks in advance for any help.
Cheers,
Ashton

On 15/03/2017 at 01:16, xxxxxxxx wrote:

Hi,

You are not wrong. but the order is wrong,try this:

  
    Cube = doc.GetActiveObject()
  
    Sym = c4d.BaseObject(c4d.Osymmetry) # Symmetry 
    Sym[c4d.SYMMETRYOBJECT_AUTOFLIP]=True 
    Sym[c4d.SYMMETRYOBJECT_PLANE]=1 
    Sym.SetName("Python")
    Cube.InsertUnder(Sym)
    doc.InsertObject(Sym)   
  
    c4d.CallButton(Sym, c4d.SYMMETRYOBJECT_FLIP)  
  
    c4d.EventAdd()  
  

by the way ,doc = c4d.documents.GetActiveDocument() is not necessary.

Best wishes!
Ching

On 15/03/2017 at 12:39, xxxxxxxx wrote:

lol I feel so dumb lol 
Thanks WeiChing