<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Object Instancing with the Python 1.0 API in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/object-instancing-with-the-python-1-0-api/m-p/12417778#M636</link>
    <description>&lt;P&gt;Thanks a lot for your help &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1220770"&gt;@brentmc&lt;/a&gt;! This now works.&lt;/P&gt;&lt;P&gt;I guess the other examples I saw were based on the 2.0 API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Dec 2023 10:34:54 GMT</pubDate>
    <dc:creator>aries2</dc:creator>
    <dc:date>2023-12-04T10:34:54Z</dc:date>
    <item>
      <title>Object Instancing with the Python 1.0 API</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/object-instancing-with-the-python-1-0-api/m-p/12416379#M634</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am exploring the Maya API and testing code to instance an object by parenting a new transform node to the existing shape node:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;import maya.OpenMaya as om
import maya.OpenMayaMPx as mpx

#explicitly get shape node
list = om.MSelectionList()
om.MGlobal.getSelectionListByName("pCubeShape1",list)
shape_node = om.MObject()
list.getDependNode(0,shape_node)

#create transform node
trans_node = om.MFnTransform().create()
dag_node = om.MFnDagNode(trans_node)

#parent shape node to transform node and instance with 'keepExistingParents' flag
dag_node.addChild(shape_node,keepExistingParents=True)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting the error: 'TypeError: MFnDagNode_addChild() takes no keyword arguments'.&lt;/P&gt;&lt;P&gt;Obviously it's supposed to take this keyword argument and I've seen several example python scripts which do pass this flag to the call.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any Ideas?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 03 Dec 2023 16:30:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/object-instancing-with-the-python-1-0-api/m-p/12416379#M634</guid>
      <dc:creator>aries2</dc:creator>
      <dc:date>2023-12-03T16:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: Object Instancing with the Python 1.0 API</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/object-instancing-with-the-python-1-0-api/m-p/12417742#M635</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Python 1.0 API is auto-generated from the C++ API so named arguments are not supported. (and one of the reasons the 2.0 API was developed)&lt;BR /&gt;&lt;BR /&gt;So, in your example you just have to provide an index argument and then a boolean for keepExistingParents like this:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;dag_node.addChild(shape_node, 0, True)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 10:17:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/object-instancing-with-the-python-1-0-api/m-p/12417742#M635</guid>
      <dc:creator>brentmc</dc:creator>
      <dc:date>2023-12-04T10:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: Object Instancing with the Python 1.0 API</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/object-instancing-with-the-python-1-0-api/m-p/12417778#M636</link>
      <description>&lt;P&gt;Thanks a lot for your help &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1220770"&gt;@brentmc&lt;/a&gt;! This now works.&lt;/P&gt;&lt;P&gt;I guess the other examples I saw were based on the 2.0 API.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 10:34:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/object-instancing-with-the-python-1-0-api/m-p/12417778#M636</guid>
      <dc:creator>aries2</dc:creator>
      <dc:date>2023-12-04T10:34:54Z</dc:date>
    </item>
  </channel>
</rss>

