SendModelingCommand returns in wrong place[SOLVED]



  • On 30/10/2014 at 04:41, xxxxxxxx wrote:

    Hi
    I've written a script to merge 2 mesh objects in the scene using SendModelingCommand.  But the returned merged object is offset in position.  Something to do with local / world coords I presume - but not sure how to fix it.  Here's my code..

    import c4d  
    import c4d.utils  
    
    #Welcome to the world of Python
    

    > def main() :
    >
    >     
    >
    >     obs = doc.GetObjects()
    >
    >     z = obs
    >
    >
    >
    >
    >     settings = c4d.BaseContainer()
    >
    >     
    >
    >     z = c4d.utils.SendModelingCommand(command = c4d.MCOMMAND_JOIN,
    >
    >                                         list = z,
    >
    >
    >
    >
    >                                         mode = c4d.MODELINGCOMMANDMODE_ALL,
    >
    >                                         
    >
    >                                         bc = settings,
    >
    >
    >
    >
    >                                         doc = doc )
    >
    >     doc.InsertObject(z[0])
    >
    >     c4d.EventAdd()
    >
    >     
    >
    > if __name__=='__main__':
    >
    >     main()



  • On 30/10/2014 at 09:14, xxxxxxxx wrote:

    Got it - I just set the abs position of the merged object back to 0,0,0

    z[0][c4d.ID_BASEOBJECT_ABS_POSITION] = c4d.Vector(0,0,0)


Log in to reply