<?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: Make an opened document the active doument in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/make-an-opened-document-the-active-doument/m-p/13247128#M3153</link>
    <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;Using parameter(" ")=.. means that it will be parameter from document in wchich you ran the rule.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try this instead:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDrawing&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPart&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt; = &lt;SPAN&gt;oDrawing&lt;/SPAN&gt;.&lt;SPAN&gt;ReferencedDocuments&lt;/SPAN&gt;(1)
&lt;SPAN&gt;oPart&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Parameters&lt;/SPAN&gt;(&lt;SPAN&gt;"Length"&lt;/SPAN&gt;).&lt;SPAN&gt;Expression&lt;/SPAN&gt; = 20 ' or &lt;SPAN&gt;oPart&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Parameters&lt;/SPAN&gt;(&lt;SPAN&gt;"Length"&lt;/SPAN&gt;).value= 20
&lt;SPAN&gt;oPart&lt;/SPAN&gt;.&lt;SPAN&gt;Update&lt;/SPAN&gt;
&lt;SPAN&gt;oDrawing&lt;/SPAN&gt;.&lt;SPAN&gt;Update&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Jan 2025 10:55:36 GMT</pubDate>
    <dc:creator>marcin_otręba</dc:creator>
    <dc:date>2025-01-07T10:55:36Z</dc:date>
    <item>
      <title>Make an opened document the active doument</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/make-an-opened-document-the-active-doument/m-p/13247107#M3152</link>
      <description>&lt;P&gt;I have created a simple example demonstrating a drawing rule that opens the referenced part, activates it then changes a parameter.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDrawing&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPartPath&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;oDrawing&lt;/SPAN&gt;.&lt;SPAN&gt;ReferencedDocuments&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(1).&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPart&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;Documents&lt;/SPAN&gt;.&lt;SPAN&gt;Open&lt;/SPAN&gt;(&lt;SPAN&gt;oPartPath&lt;/SPAN&gt;, &lt;SPAN&gt;True&lt;/SPAN&gt;)
&lt;SPAN&gt;oPart&lt;/SPAN&gt;.&lt;SPAN&gt;Activate&lt;/SPAN&gt;()
&lt;SPAN&gt;Parameter&lt;/SPAN&gt;(&lt;SPAN&gt;"Length"&lt;/SPAN&gt;) = 20
&lt;SPAN&gt;oPart&lt;/SPAN&gt;.&lt;SPAN&gt;Save&lt;/SPAN&gt;
&lt;SPAN&gt;oPart&lt;/SPAN&gt;.&lt;SPAN&gt;Close&lt;/SPAN&gt;(&lt;SPAN&gt;True&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;The problem is, the activate line doesn't appear to do anything because it gets error, when attempting to change the parameter:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="harvey_craig2RCUH_0-1736246284723.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1451829i94B4D00D6621AF68/image-size/medium?v=v2&amp;amp;px=400" role="button" title="harvey_craig2RCUH_0-1736246284723.png" alt="harvey_craig2RCUH_0-1736246284723.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This parameter definitely exists in the part. Where have I gone wrong? I've attached the example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Harvey&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 10:42:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/make-an-opened-document-the-active-doument/m-p/13247107#M3152</guid>
      <dc:creator>harvey_craig2RCUH</dc:creator>
      <dc:date>2025-01-07T10:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: Make an opened document the active doument</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/make-an-opened-document-the-active-doument/m-p/13247128#M3153</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;Using parameter(" ")=.. means that it will be parameter from document in wchich you ran the rule.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try this instead:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDrawing&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPart&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt; = &lt;SPAN&gt;oDrawing&lt;/SPAN&gt;.&lt;SPAN&gt;ReferencedDocuments&lt;/SPAN&gt;(1)
&lt;SPAN&gt;oPart&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Parameters&lt;/SPAN&gt;(&lt;SPAN&gt;"Length"&lt;/SPAN&gt;).&lt;SPAN&gt;Expression&lt;/SPAN&gt; = 20 ' or &lt;SPAN&gt;oPart&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Parameters&lt;/SPAN&gt;(&lt;SPAN&gt;"Length"&lt;/SPAN&gt;).value= 20
&lt;SPAN&gt;oPart&lt;/SPAN&gt;.&lt;SPAN&gt;Update&lt;/SPAN&gt;
&lt;SPAN&gt;oDrawing&lt;/SPAN&gt;.&lt;SPAN&gt;Update&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 10:55:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/make-an-opened-document-the-active-doument/m-p/13247128#M3153</guid>
      <dc:creator>marcin_otręba</dc:creator>
      <dc:date>2025-01-07T10:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: Make an opened document the active doument</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/make-an-opened-document-the-active-doument/m-p/13247206#M3154</link>
      <description>&lt;P&gt;You can specify the document name using the Parmeter command&lt;/P&gt;&lt;P&gt;See &lt;A href="https://help.autodesk.com/view/INVNTOR/2025/ENU/?guid=3dfb2e63-5750-d8a2-6d5c-5ae6bb99b9f9" target="_blank"&gt;https://help.autodesk.com/view/INVNTOR/2025/ENU/?guid=3dfb2e63-5750-d8a2-6d5c-5ae6bb99b9f9&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe DisplayName is what is needed, you could also try the InternalName if this doesn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Parameter(oPart.DisplayName,"Length") = 20&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 12:00:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/make-an-opened-document-the-active-doument/m-p/13247206#M3154</guid>
      <dc:creator>g.georgiades</dc:creator>
      <dc:date>2025-01-07T12:00:57Z</dc:date>
    </item>
  </channel>
</rss>

