<?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 Displayname code issue in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/displayname-code-issue/m-p/13892695#M178048</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this code snippet that I have been using to overwrite the Displayname of the active document in the model browser. Code works as intended when I trigger it in existing documents but I have a problem with new documents that require an initial save.&lt;BR /&gt;Most probably the cause is that Part number is generated after the rule is ran.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oDoc As Document = ThisDoc.Document
 
Try
	oDoc.DisplayName = iProperties.Value("Project", "Part Number") &amp;amp; " (" &amp;amp; iProperties.Value("Custom", "Part Name") &amp;amp; ")"
Catch
	iProperties.Value("Custom", "Part Name") = ""
End Try
 
oDoc.Update&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My intended use would be to embed the rule into a template file and trigger it when iProperties are changed.&lt;/P&gt;&lt;P&gt;When a user creates a new document, fills out the iProperites (rule trigger), saves and checks the file into Vault the Displayname should be filled like &lt;STRONG&gt;Part number (Part name)&lt;/STRONG&gt; (picture).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="alex_hiis6PJP6_1-1762935143674.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1588625i47599164FDFABC46/image-size/medium?v=v2&amp;amp;px=400" role="button" title="alex_hiis6PJP6_1-1762935143674.png" alt="alex_hiis6PJP6_1-1762935143674.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Nov 2025 08:14:17 GMT</pubDate>
    <dc:creator>alex_hiis6PJP6</dc:creator>
    <dc:date>2025-11-12T08:14:17Z</dc:date>
    <item>
      <title>Displayname code issue</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/displayname-code-issue/m-p/13892695#M178048</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this code snippet that I have been using to overwrite the Displayname of the active document in the model browser. Code works as intended when I trigger it in existing documents but I have a problem with new documents that require an initial save.&lt;BR /&gt;Most probably the cause is that Part number is generated after the rule is ran.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oDoc As Document = ThisDoc.Document
 
Try
	oDoc.DisplayName = iProperties.Value("Project", "Part Number") &amp;amp; " (" &amp;amp; iProperties.Value("Custom", "Part Name") &amp;amp; ")"
Catch
	iProperties.Value("Custom", "Part Name") = ""
End Try
 
oDoc.Update&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My intended use would be to embed the rule into a template file and trigger it when iProperties are changed.&lt;/P&gt;&lt;P&gt;When a user creates a new document, fills out the iProperites (rule trigger), saves and checks the file into Vault the Displayname should be filled like &lt;STRONG&gt;Part number (Part name)&lt;/STRONG&gt; (picture).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="alex_hiis6PJP6_1-1762935143674.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1588625i47599164FDFABC46/image-size/medium?v=v2&amp;amp;px=400" role="button" title="alex_hiis6PJP6_1-1762935143674.png" alt="alex_hiis6PJP6_1-1762935143674.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Nov 2025 08:14:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/displayname-code-issue/m-p/13892695#M178048</guid>
      <dc:creator>alex_hiis6PJP6</dc:creator>
      <dc:date>2025-11-12T08:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: Displayname code issue</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/displayname-code-issue/m-p/13896755#M178060</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15549864"&gt;@alex_hiis6PJP6&lt;/a&gt;, I think you can use one of these examples to catch the situation where a file has not been saved yet, so that your code does not cause issues due to information that is not yet present.&lt;BR /&gt;&lt;BR /&gt;Hope that helps, Curtis&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt; = &lt;SPAN&gt;Nothing&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
&lt;SPAN&gt;'do something, or don't do something&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;FileSaveCounter&lt;/SPAN&gt; = 0 &lt;SPAN&gt;Then&lt;/SPAN&gt; 
 &lt;SPAN&gt;'do something, or don't do something&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Nov 2025 15:43:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/displayname-code-issue/m-p/13896755#M178060</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2025-11-12T15:43:09Z</dc:date>
    </item>
  </channel>
</rss>

