<?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: Custom Sort Error at Top Level Assembly in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/custom-sort-error-at-top-level-assembly/m-p/12413605#M16143</link>
    <description>&lt;P&gt;Below is the More Info tab:&lt;/P&gt;&lt;P&gt;System.Runtime.InteropServices.COMException (0x80004005): Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))&lt;BR /&gt;at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&amp;amp; msgData)&lt;BR /&gt;at Inventor.BOMView.Renumber(Int32 StartValue, Int32 Increment, Object BOMRowsToRenumber)&lt;BR /&gt;at ThisRule.Main()&lt;BR /&gt;at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)&lt;BR /&gt;at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The number and sort seems to be working for every sub-assembly within the top level.&amp;nbsp; But the confusing part is if I open one of the more complex sub-assemblies within the top level and run the same rule it still sorts and numbers the sub-assemblies, does not sort or renumber itself and does not pop up that same error.&lt;/P&gt;</description>
    <pubDate>Fri, 01 Dec 2023 16:26:12 GMT</pubDate>
    <dc:creator>Zackery.Breeland</dc:creator>
    <dc:date>2023-12-01T16:26:12Z</dc:date>
    <item>
      <title>Custom Sort Error at Top Level Assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/custom-sort-error-at-top-level-assembly/m-p/12408560#M16141</link>
      <description>&lt;P&gt;So I made a code to run at the top level assembly which would parse through all sub-assemblies and set BOMs based on a template and then Sort and Renumber.&amp;nbsp; I keep getting an unspecified error when I run it at the top level, but it seems to work fine when run at any of the sub-assy levels.&amp;nbsp; The code is below, and it seems like the issue is caused from the Renumber function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;'Define top level assembly as active document&lt;/SPAN&gt;
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oADoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;
	&lt;SPAN&gt;oADocDef&lt;/SPAN&gt; = &lt;SPAN&gt;oADoc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
	&lt;SPAN&gt;'Creating List of all Sub-Assy within Assembly&lt;/SPAN&gt;
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAssy&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt;
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAssyList&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;New&lt;/SPAN&gt; &lt;SPAN&gt;List&lt;/SPAN&gt;(&lt;SPAN&gt;Of&lt;/SPAN&gt; &lt;SPAN&gt;Document&lt;/SPAN&gt;)
	&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oAssy&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oADoc&lt;/SPAN&gt;.&lt;SPAN&gt;AllReferencedDocuments&lt;/SPAN&gt;
		&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oAssy&lt;/SPAN&gt;.&lt;SPAN&gt;DocumentType&lt;/SPAN&gt;.&lt;SPAN&gt;Equals&lt;/SPAN&gt;(&lt;SPAN&gt;kAssemblyDocumentObject&lt;/SPAN&gt;)
			&lt;SPAN&gt;'Confirm the assembly is a Job Specific assembly&lt;/SPAN&gt;
			&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;Left&lt;/SPAN&gt;(&lt;SPAN&gt;oAssy&lt;/SPAN&gt;.&lt;SPAN&gt;PropertySets&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(3).&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Part Number"&lt;/SPAN&gt;).&lt;SPAN&gt;Value&lt;/SPAN&gt;, 1) = &lt;SPAN&gt;"H"&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
				&lt;SPAN&gt;oAssyList&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;oAssy&lt;/SPAN&gt;)
			&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&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;' Set a reference to the BOM&lt;/SPAN&gt;
	&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oAssy&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oAssyList&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oBOM&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;BOM&lt;/SPAN&gt; = &lt;SPAN&gt;oAssy&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN&gt;BOM&lt;/SPAN&gt;
		&lt;SPAN&gt;'Import BOM Order Template to Match GP BOM Required Columns&lt;/SPAN&gt;
		&lt;SPAN&gt;oBOM&lt;/SPAN&gt;.&lt;SPAN&gt;ImportBOMCustomization&lt;/SPAN&gt;(&lt;SPAN&gt;"\\revginc.net\FIRE-GRP\FIRE-HL_Company_Engineering_Docs\Inventor 2013 Files\Templates\Body BOM Order Template.xml"&lt;/SPAN&gt;)
		&lt;SPAN&gt;oBOM&lt;/SPAN&gt;.&lt;SPAN&gt;StructuredViewEnabled&lt;/SPAN&gt; = &lt;SPAN&gt;True&lt;/SPAN&gt;
		&lt;SPAN&gt;oBOM&lt;/SPAN&gt;.&lt;SPAN&gt;StructuredViewFirstLevelOnly&lt;/SPAN&gt; = &lt;SPAN&gt;False&lt;/SPAN&gt;
		&lt;SPAN&gt;'Sort BOMs for Vee Drawings (Decription &amp;amp; Length Ascending)&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oStructuredBOMView&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;BOMView&lt;/SPAN&gt;
    	&lt;SPAN&gt;oStructuredBOMView&lt;/SPAN&gt; = &lt;SPAN&gt;oBOM&lt;/SPAN&gt;.&lt;SPAN&gt;BOMViews&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Structured"&lt;/SPAN&gt;)
		&lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;oStructuredBOMView&lt;/SPAN&gt;.&lt;SPAN&gt;Sort&lt;/SPAN&gt;(&lt;SPAN&gt;"Description"&lt;/SPAN&gt;, &lt;SPAN&gt;True&lt;/SPAN&gt;, &lt;SPAN&gt;"LENGTH"&lt;/SPAN&gt;, &lt;SPAN&gt;True&lt;/SPAN&gt;)
		&lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;oStructuredBOMView&lt;/SPAN&gt;.&lt;SPAN&gt;Renumber&lt;/SPAN&gt;(1,1)
	&lt;SPAN&gt;Next&lt;/SPAN&gt;
		&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Nov 2023 15:38:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/custom-sort-error-at-top-level-assembly/m-p/12408560#M16141</guid>
      <dc:creator>Zackery.Breeland</dc:creator>
      <dc:date>2023-11-29T15:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Sort Error at Top Level Assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/custom-sort-error-at-top-level-assembly/m-p/12413529#M16142</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12266315"&gt;@Zackery.Breeland&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you share the error message more Info tab? Is the renumbering partually working? As a work around you could wrap the renumbered process in a try catch and setup an indicater document name or row to identify where it fails.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 15:54:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/custom-sort-error-at-top-level-assembly/m-p/12413529#M16142</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-12-01T15:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Sort Error at Top Level Assembly</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/custom-sort-error-at-top-level-assembly/m-p/12413605#M16143</link>
      <description>&lt;P&gt;Below is the More Info tab:&lt;/P&gt;&lt;P&gt;System.Runtime.InteropServices.COMException (0x80004005): Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))&lt;BR /&gt;at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&amp;amp; msgData)&lt;BR /&gt;at Inventor.BOMView.Renumber(Int32 StartValue, Int32 Increment, Object BOMRowsToRenumber)&lt;BR /&gt;at ThisRule.Main()&lt;BR /&gt;at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)&lt;BR /&gt;at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The number and sort seems to be working for every sub-assembly within the top level.&amp;nbsp; But the confusing part is if I open one of the more complex sub-assemblies within the top level and run the same rule it still sorts and numbers the sub-assemblies, does not sort or renumber itself and does not pop up that same error.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 16:26:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/custom-sort-error-at-top-level-assembly/m-p/12413605#M16143</guid>
      <dc:creator>Zackery.Breeland</dc:creator>
      <dc:date>2023-12-01T16:26:12Z</dc:date>
    </item>
  </channel>
</rss>

