<?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: Determine if Parameter Exists in Each Document in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/determine-if-parameter-exists-in-each-document/m-p/11480645#M31710</link>
    <description>&lt;P&gt;&lt;BR /&gt;Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; Very frustrating.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Oct 2022 16:43:02 GMT</pubDate>
    <dc:creator>C_Haines_ENG</dc:creator>
    <dc:date>2022-10-13T16:43:02Z</dc:date>
    <item>
      <title>Determine if Parameter Exists in Each Document</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/determine-if-parameter-exists-in-each-document/m-p/11480461#M31708</link>
      <description>&lt;P&gt;I have seen very similar questions posted everywhere, however I keep getting a "ComponentDefinition" error whenever i run the below code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;Main&lt;/SPAN&gt;()
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oOpenDocs&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DocumentsEnumerator&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;Documents&lt;/SPAN&gt;.&lt;SPAN&gt;VisibleDocuments&lt;/SPAN&gt;
	&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oOpenDocs&lt;/SPAN&gt;
		
		&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;DocumentType&lt;/SPAN&gt; = &lt;SPAN&gt;Inventor&lt;/SPAN&gt;.&lt;SPAN&gt;DocumentTypeEnum&lt;/SPAN&gt;.&lt;SPAN&gt;kDrawingDocumentObject&lt;/SPAN&gt;
			
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oParas&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;UserParameters&lt;/SPAN&gt; = &lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;Parameters&lt;/SPAN&gt;.&lt;SPAN&gt;UserParameters&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPara&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;UserParameter&lt;/SPAN&gt;

		&lt;SPAN&gt;Try&lt;/SPAN&gt;
   	 		&lt;SPAN&gt;oPara&lt;/SPAN&gt; = &lt;SPAN&gt;oParas&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Drawing Type"&lt;/SPAN&gt;)
		&lt;SPAN&gt;Catch&lt;/SPAN&gt;
    		&lt;SPAN&gt;oPara&lt;/SPAN&gt; = &lt;SPAN&gt;oParas&lt;/SPAN&gt;.&lt;SPAN&gt;AddByValue&lt;/SPAN&gt;(&lt;SPAN&gt;"Drawing Type"&lt;/SPAN&gt;, &lt;SPAN&gt;"Part"&lt;/SPAN&gt;, &lt;SPAN&gt;UnitsTypeEnum&lt;/SPAN&gt;.&lt;SPAN&gt;kTextUnits&lt;/SPAN&gt;)
		&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Try&lt;/SPAN&gt;
			
		&lt;SPAN&gt;iLogicVb&lt;/SPAN&gt;.&lt;SPAN&gt;RunExternalRule&lt;/SPAN&gt;(&lt;SPAN&gt;"AutoCAD Export.iLogicVb"&lt;/SPAN&gt;)
		&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
	&lt;SPAN&gt;Next&lt;/SPAN&gt;
	
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I understand the external rule command line required the full directory I have removed it just for this post, the AutoCAD Export vb code will read a parameter called "Drawing Type" to determine if its a part or assembly drawing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However on older iterations of my templates I have used different parameters.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Id like to check each drawing file thats open if "Drawing Type" paramter exists and if not create it, however everytime I run the rule it gives me this error:&amp;nbsp;Public member 'Document' on type '_DocumentClass' not found.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Other posts suggest changing the command to ThisDoc.ActiveDocument but I fear this will just take the value of the first page and will not continuously do it for each drawing missing this parameter.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 15:27:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/determine-if-parameter-exists-in-each-document/m-p/11480461#M31708</guid>
      <dc:creator>C_Haines_ENG</dc:creator>
      <dc:date>2022-10-13T15:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if Parameter Exists in Each Document</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/determine-if-parameter-exists-in-each-document/m-p/11480620#M31709</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12191678"&gt;@C_Haines_ENG&lt;/a&gt;.&amp;nbsp; Since you are inspecting a drawing, there is no "ComponentDefinition" in the path of getting to its Parameters.&amp;nbsp; Just remove that from your line of code which is getting the parameters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim oParas As UserParameters = oDoc.Parameters.UserParameters&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 16:33:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/determine-if-parameter-exists-in-each-document/m-p/11480620#M31709</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-10-13T16:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if Parameter Exists in Each Document</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/determine-if-parameter-exists-in-each-document/m-p/11480645#M31710</link>
      <description>&lt;P&gt;&lt;BR /&gt;Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; Very frustrating.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 16:43:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/determine-if-parameter-exists-in-each-document/m-p/11480645#M31710</guid>
      <dc:creator>C_Haines_ENG</dc:creator>
      <dc:date>2022-10-13T16:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if Parameter Exists in Each Document</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/determine-if-parameter-exists-in-each-document/m-p/11480657#M31711</link>
      <description>&lt;P&gt;I think I see something else that would be problematic, now that I give it another look.&amp;nbsp; Parameter names can not have spaces in them.&amp;nbsp; I usually put an underscore ("_") where I would normally have a space in my parameter names.&amp;nbsp; So try changing &lt;SPAN&gt;"Drawing Type" to "Drawing_Type".&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 16:51:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/determine-if-parameter-exists-in-each-document/m-p/11480657#M31711</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-10-13T16:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if Parameter Exists in Each Document</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/determine-if-parameter-exists-in-each-document/m-p/11480662#M31712</link>
      <description>&lt;P&gt;Ah youre right im dumb, the Parameter doesnt even have an underscore in it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2022 16:53:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/determine-if-parameter-exists-in-each-document/m-p/11480662#M31712</guid>
      <dc:creator>C_Haines_ENG</dc:creator>
      <dc:date>2022-10-13T16:53:52Z</dc:date>
    </item>
  </channel>
</rss>

