title: Generating objects with position in Maya using Python
body: <p>I have some code that uses Python to read some data from a file, and then while still using Python generates an object in Maya based on the file. Everything is working good and the object comes out looking correctly. The problem is however that non of the segments that the object is made up of has a correct actual position, the Translate XYZ is set to 0 for all of them, even though they look correctly. The problem with this is that when I later on import the model into Unity3D I can't interact with the objects properly as the position is still at 0 while the mesh is were it should be. Is there some correct way to generate objects to make them have a position?</p>
  <p>The code calls multiple functions to make different segments (one example of one of these functions is shown below). Then it uses maya.cmds.polyUnite to make it into one object. This is then repeated using a for-loop that runs for some amount of times (specified in the file). This for-loop calls cmds.duplicate(object made above) and moves the new object in the z-axis using cmds.move(0, 0, z, duped object). Due to some bad coding the code then calls polyUnite to make it all into one big object and then calls polySeperate to split it into small segements again. Is it possible that this is causing the problem?</p>
  <p>Each segment is generated something like this:</p>
  <pre><code>    cmds.polyCube(n='leftWall', w=w, h=h, d=d, sw=w, sh=h, sd=d)
      cmds.setAttr('leftWall.translateX', -Bt/float(2)-(THICKNESS/float(2)))
      cmds.setAttr('leftWall.translateY', a)
      cmds.setAttr('leftWall.rotateZ', -90)
      cmds.polyNormal('leftWall', nm=0, unm=0)
  
      cmds.polyCube(n='rightWall', w=w, h=h, d=d, sw=w, sh=h, sd=d)
      cmds.setAttr('rightWall.translateX', Bt/float(2)+(THICKNESS/float(2)))
      cmds.setAttr('rightWall.translateY', a)
      cmds.setAttr('rightWall.rotateZ', 90)
      cmds.polyNormal('rightWall', nm=0, unm=0)
  
      cmds.polyUnite('leftWall', 'rightWall', n='walls')
      addTexture('walls', 'wall.jpg')
  </code></pre>