Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    SendModelingCommand returns in wrong place[SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    2 Posts 0 Posters 239 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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()

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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)

        1 Reply Last reply Reply Quote 0
        • First post
          Last post