<?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: Error in iLogic Code: Unspecified error (Exception from HRESULT: 0x80004005. in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic-code-unspecified-error-exception-from-hresult/m-p/8305927#M89501</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Scott.Hallmark,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's difficult to know without seeing the whole picture, but try something like this, maybe... it runs without issue for my testing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Edit:&lt;/STRONG&gt; &lt;/FONT&gt;Also my guess would be that one or more occurrence name is too short or something, and so the Left or Mid lines are returning an error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too:&lt;BR /&gt;&lt;A href="http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120" target="_blank"&gt;http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;BR /&gt;Best of luck to you in all of your Inventor pursuits,&lt;BR /&gt;Curtis&lt;BR /&gt;&lt;A href="http://inventortrenches.blogspot.com" target="_blank"&gt;http://inventortrenches.blogspot.com&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

FilePrefix = "Test_"
'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
   	Dim oName As String 
   	oName = oOccurrence.Name
	oName2 = Left(oName, 1)
	oName3 = Left(oName, 3)
	oName4 = Mid(oName, 4)
	If oName2 = "-" Then 
		oOccurrence.Name = FilePrefix &amp;amp; oName
	Else If oName3 &amp;lt;&amp;gt; FilePrefix Then
		oOccurrence.Name = FilePrefix &amp;amp; oName4
	End If
Next
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 01 Oct 2018 22:37:55 GMT</pubDate>
    <dc:creator>Curtis_Waguespack</dc:creator>
    <dc:date>2018-10-01T22:37:55Z</dc:date>
    <item>
      <title>Error in iLogic Code: Unspecified error (Exception from HRESULT: 0x80004005...)</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic-code-unspecified-error-exception-from-hresult/m-p/8305526#M89500</link>
      <description>&lt;P&gt;I have this code in an Occurrence_Rule that I have that updates the occurrence names of all parts in the assembly and it works perfectly in the assembly.&amp;nbsp; This is just part of the code and if I comment this part out, I do not get the error in the master assembly:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;STRONG&gt;&lt;EM&gt;'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
   	Dim oName As String 
   	oName = oOccurrence.Name
	oName2 = Left(oName, 1)
	oName3 = Left(oName, 3)
	oName4 = Mid(oName, 4)
	If oName2 = "-" Then 
		oOccurrence.Name = FilePrefix &amp;amp; oName
	Else If oName3 &amp;lt;&amp;gt; FilePrefix Then
		oOccurrence.Name = FilePrefix &amp;amp; oName4
	End If&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;Next&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;The scenario is that this code belongs to a single assembly that then gets put into a master assembly.  While the single assembly is open, it functions as I need it to, updating the occurrence names. Once it is placed into a master assembly, it brings up the following error:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;DIV&gt;&lt;EM&gt;&lt;STRONG&gt;Error in rule: OccurrenceName_Rule, in document: 404-Unit_Assembly.iam&lt;/STRONG&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&lt;STRONG&gt;Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))&lt;/STRONG&gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;It is not corrupting the assembly or causing it to function improperly.  It is just annoying because it does it for every subassembly containing that rule, which could be anywhere from 2 to 500+ of them.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Oct 2018 19:41:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic-code-unspecified-error-exception-from-hresult/m-p/8305526#M89500</guid>
      <dc:creator>Scott.Hallmark</dc:creator>
      <dc:date>2018-10-01T19:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: Error in iLogic Code: Unspecified error (Exception from HRESULT: 0x80004005.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic-code-unspecified-error-exception-from-hresult/m-p/8305927#M89501</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Scott.Hallmark,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's difficult to know without seeing the whole picture, but try something like this, maybe... it runs without issue for my testing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Edit:&lt;/STRONG&gt; &lt;/FONT&gt;Also my guess would be that one or more occurrence name is too short or something, and so the Left or Mid lines are returning an error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too:&lt;BR /&gt;&lt;A href="http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120" target="_blank"&gt;http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;BR /&gt;Best of luck to you in all of your Inventor pursuits,&lt;BR /&gt;Curtis&lt;BR /&gt;&lt;A href="http://inventortrenches.blogspot.com" target="_blank"&gt;http://inventortrenches.blogspot.com&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

FilePrefix = "Test_"
'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
   	Dim oName As String 
   	oName = oOccurrence.Name
	oName2 = Left(oName, 1)
	oName3 = Left(oName, 3)
	oName4 = Mid(oName, 4)
	If oName2 = "-" Then 
		oOccurrence.Name = FilePrefix &amp;amp; oName
	Else If oName3 &amp;lt;&amp;gt; FilePrefix Then
		oOccurrence.Name = FilePrefix &amp;amp; oName4
	End If
Next
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Oct 2018 22:37:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic-code-unspecified-error-exception-from-hresult/m-p/8305927#M89501</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2018-10-01T22:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: Error in iLogic Code: Unspecified error (Exception from HRESULT: 0x80004005.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic-code-unspecified-error-exception-from-hresult/m-p/8305956#M89504</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or maybe the issue is the code is attempting to rename an occurrence the same name as another occurrence... maybe something like this to catch that case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
i=1
FilePrefix = "Test_"
'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
   	Dim oName As String 
   	oName = oOccurrence.Name
	oName2 = Left(oName, 1)
	oName3 = Left(oName, 3)
	oName4 = Mid(oName, 4)
	
	If oName2 = "-" Then 
		oOccurrence.Name = FilePrefix &amp;amp; oName
	Else If oName3 &amp;lt;&amp;gt; FilePrefix Then
		Try
		oOccurrence.Name = FilePrefix &amp;amp; oName4
		Catch 'error when name exists already
		oOccurrence.Name = FilePrefix &amp;amp; oName4 &amp;amp; ":" &amp;amp; i
		i=i+1 'increment counter
		End Try
	End If

Next&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Oct 2018 22:46:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic-code-unspecified-error-exception-from-hresult/m-p/8305956#M89504</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2018-10-01T22:46:03Z</dc:date>
    </item>
    <item>
      <title>Re: Error in iLogic Code: Unspecified error (Exception from HRESULT: 0x80004005.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic-code-unspecified-error-exception-from-hresult/m-p/8307071#M89543</link>
      <description>&lt;P&gt;This is what is happening - I have a Curtain Wall Unit Template that has several parts in it, all with filenames beginning with "-" (i.e. "-MM.ipt" for Male Mullion) and when I do a copy design, I copy it to a folder such as "101".&amp;nbsp; I open the new assembly and the Occurrences_Rule iLogic code then goes in a renames all of the occurrences to "101-xx" for example.&amp;nbsp; This part is working great.&amp;nbsp; Then I complete the customizations to that unit and drop it in a new Master Assembly.&amp;nbsp; Still, all is working great.&amp;nbsp; I go to Vault and Copy Design "102" and make the custom changes to it and drop it into the Master Assembly.&amp;nbsp; It works fine too.&amp;nbsp; If I close the Master Assembly and reopen it, that is when I get the error.&amp;nbsp; If there is one Subassembly in the Master, I never get the error, but as soon as I add the 2nd unit subassembly in, that is when the errors start.&amp;nbsp; Again, the units are fine and nothing breaks, but the error message is annoying because it keeps popping up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have added a screencast to demonstrate the issue.&amp;nbsp; I have left out the copy design process as I don't believe it is relevant to the issue.&amp;nbsp; So I have 2 units that I will open, configure, and then place into the master assembly and then you will see the error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;iLogic Error when adding to Master Assembly&lt;BR /&gt;&lt;A href="https://knowledge.autodesk.com/community/screencast/0a7faa95-6718-4613-8af9-81c98b9f7cae" target="_blank"&gt;https://knowledge.autodesk.com/community/screencast/0a7faa95-6718-4613-8af9-81c98b9f7cae&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 12:53:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic-code-unspecified-error-exception-from-hresult/m-p/8307071#M89543</guid>
      <dc:creator>Scott.Hallmark</dc:creator>
      <dc:date>2018-10-02T12:53:12Z</dc:date>
    </item>
    <item>
      <title>Re: Error in iLogic Code: Unspecified error (Exception from HRESULT: 0x80004005.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic-code-unspecified-error-exception-from-hresult/m-p/8307430#M89559</link>
      <description>&lt;P&gt;I fixed it.&amp;nbsp; I pulled out part of the rule and put it in it's own rule, then changed the order of my rules and it is working as it should.&amp;nbsp; Thanks for looking into this.&amp;nbsp; Hope to see everyone at AU 2018!&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 14:33:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-in-ilogic-code-unspecified-error-exception-from-hresult/m-p/8307430#M89559</guid>
      <dc:creator>Scott.Hallmark</dc:creator>
      <dc:date>2018-10-02T14:33:29Z</dc:date>
    </item>
  </channel>
</rss>

