<?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: Change component iPart in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/change-component-ipart/m-p/2306676#M150034</link>
    <description>I just put my code sample which works fine in a vb6.exe, in a vb6.dll which I use as a addin in INV2009 and now the line&lt;BR /&gt;
oTableNode.DoSelect doesn't work anymore. So the next command ("AssemblyChangeComponentCmd") doesn't work either. Why is that?&lt;BR /&gt;
&lt;BR /&gt;
Geert</description>
    <pubDate>Tue, 19 Aug 2008 13:35:09 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2008-08-19T13:35:09Z</dc:date>
    <item>
      <title>Change component iPart</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/change-component-ipart/m-p/2306673#M150031</link>
      <description>I've a routine made in VB6 which inserts and constains a iPart in a assembly. Now I want to call the Change Component command which shows the dialog to change a ipart component. See attached file.&lt;BR /&gt;
I tried this with "AssemblyEditComponentCtxCmd"&lt;BR /&gt;
But that don't work. What's the right commandname for this?&lt;BR /&gt;
I use INV 2009&lt;BR /&gt;
&lt;BR /&gt;
Dim oControlDef As ControlDefinition&lt;BR /&gt;
oINVapp.ActiveDocument.SelectSet.Select oOcc1&lt;BR /&gt;
Set oControlDef = oINVapp.CommandManager.ControlDefinitions.Item("AssemblyEditComponentCtxCmd")&lt;BR /&gt;
oControlDef.Execute</description>
      <pubDate>Thu, 24 Jul 2008 13:36:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/change-component-ipart/m-p/2306673#M150031</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-07-24T13:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: Change component iPart</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/change-component-ipart/m-p/2306674#M150032</link>
      <description>Just to clarify, what you want is to be able to launch the 'Change &lt;BR /&gt;
Component' command and NOT perform the change operation, correct? If it's &lt;BR /&gt;
the latter the ComponentOccurrence.ChangeRowOfiPartMember API can be used.&lt;BR /&gt;
&lt;BR /&gt;
If you just want to launch the command, the command name is &lt;BR /&gt;
"AssemblyChangeComponentCmd". However, you need to have the 'Table" node &lt;BR /&gt;
under the occurrence (and not the occurrence itself) selected for the launch &lt;BR /&gt;
to work. Since there isn't an API object for the table node, selecting it is &lt;BR /&gt;
not straightforward. You need to use a browser API workaround as shown &lt;BR /&gt;
below. The code assumes that the name of the table node is "Table" and is &lt;BR /&gt;
not localized.&lt;BR /&gt;
&lt;BR /&gt;
Sanjay-&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Sub ChangeComponentCommand()&lt;BR /&gt;
&lt;BR /&gt;
    Dim oAssembly As AssemblyDocument&lt;BR /&gt;
    Set oAssembly = ThisApplication.ActiveDocument&lt;BR /&gt;
&lt;BR /&gt;
    Dim oCompDef As AssemblyComponentDefinition&lt;BR /&gt;
    Set oCompDef = oAssembly.ComponentDefinition&lt;BR /&gt;
&lt;BR /&gt;
    Dim oOcc As ComponentOccurrence&lt;BR /&gt;
    Set oOcc = oCompDef.Occurrences.Item(1)&lt;BR /&gt;
&lt;BR /&gt;
    Dim oNode As BrowserNode&lt;BR /&gt;
    Set oNode = GetBrowserNodeFromObject(oAssembly, oOcc)&lt;BR /&gt;
&lt;BR /&gt;
    Dim oTableNode As BrowserNode&lt;BR /&gt;
    Set oTableNode = oNode.BrowserNodes.Item("Table")&lt;BR /&gt;
&lt;BR /&gt;
    oAssembly.SelectSet.Clear&lt;BR /&gt;
    oTableNode.DoSelect&lt;BR /&gt;
&lt;BR /&gt;
    Dim oControlDef As ControlDefinition&lt;BR /&gt;
    Set oControlDef = &lt;BR /&gt;
ThisApplication.CommandManager.ControlDefinitions.Item("AssemblyChangeComponentCmd")&lt;BR /&gt;
&lt;BR /&gt;
    oControlDef.Execute&lt;BR /&gt;
&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
Private Function GetBrowserNodeFromObject(ByVal oDoc As Document, ByVal &lt;BR /&gt;
oObject As Object) As BrowserNode&lt;BR /&gt;
&lt;BR /&gt;
    ' Get the browser node definition associated with the object.&lt;BR /&gt;
    Dim oNativeBrowserNodeDef As NativeBrowserNodeDefinition&lt;BR /&gt;
    Set oNativeBrowserNodeDef = &lt;BR /&gt;
oDoc.BrowserPanes.GetNativeBrowserNodeDefinition(oObject)&lt;BR /&gt;
&lt;BR /&gt;
    ' Get the top browser node of the model pane.&lt;BR /&gt;
    Dim oTopBrowserNode As BrowserNode&lt;BR /&gt;
    Set oTopBrowserNode = oDoc.BrowserPanes.ActivePane.TopNode&lt;BR /&gt;
&lt;BR /&gt;
    ' Get the browser node.&lt;BR /&gt;
    ' This assumes that only one node references the browser node &lt;BR /&gt;
definition.&lt;BR /&gt;
    Set GetBrowserNodeFromObject = &lt;BR /&gt;
oTopBrowserNode.AllReferencedNodes(oNativeBrowserNodeDef).Item(1)&lt;BR /&gt;
&lt;BR /&gt;
End Function</description>
      <pubDate>Thu, 24 Jul 2008 23:08:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/change-component-ipart/m-p/2306674#M150032</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-07-24T23:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: Change component iPart</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/change-component-ipart/m-p/2306675#M150033</link>
      <description>First sorry I respond so late but I'm just back from holiday.&lt;BR /&gt;
&lt;BR /&gt;
Thanks Sanjay your code does just what I needed.&lt;BR /&gt;
Only I had to put one line to your code:&lt;BR /&gt;
oTableNode.Expanded = True&lt;BR /&gt;
&lt;BR /&gt;
otherwise it didn't work for me.&lt;BR /&gt;
&lt;BR /&gt;
Best Regards,&lt;BR /&gt;
&lt;BR /&gt;
Geert</description>
      <pubDate>Tue, 19 Aug 2008 11:32:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/change-component-ipart/m-p/2306675#M150033</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-19T11:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: Change component iPart</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/change-component-ipart/m-p/2306676#M150034</link>
      <description>I just put my code sample which works fine in a vb6.exe, in a vb6.dll which I use as a addin in INV2009 and now the line&lt;BR /&gt;
oTableNode.DoSelect doesn't work anymore. So the next command ("AssemblyChangeComponentCmd") doesn't work either. Why is that?&lt;BR /&gt;
&lt;BR /&gt;
Geert</description>
      <pubDate>Tue, 19 Aug 2008 13:35:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/change-component-ipart/m-p/2306676#M150034</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-08-19T13:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: Change component iPart</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/change-component-ipart/m-p/8094649#M150035</link>
      <description>&lt;P&gt;Does anyone know if there is a way to make this work in 2019 version?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 11:56:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/change-component-ipart/m-p/8094649#M150035</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-06-27T11:56:04Z</dc:date>
    </item>
  </channel>
</rss>

