<?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: Inventor Throwing Error set by Invocation Help in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-throwing-error-set-by-invocation-help/m-p/9626873#M113068</link>
    <description>&lt;P&gt;I went ahead and adjusted the format. The sub feature of the set up was what was throwing null exceptions. Now I am getting a similar error but for the Dictionary Definition.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am wondering if you know how to set objects either as NULL or set the dictionary to am empty dictionary. I am hoping after that it should be fixed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But to answer your other point, yes it is an excel file. The path for xlsm is just a type of excel sheet with macros that I programmed into that myself. I haven't had issues with that before.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Jul 2020 18:12:14 GMT</pubDate>
    <dc:creator>ABoaro</dc:creator>
    <dc:date>2020-07-09T18:12:14Z</dc:date>
    <item>
      <title>Inventor Throwing Error set by Invocation Help</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-throwing-error-set-by-invocation-help/m-p/9620331#M112931</link>
      <description>&lt;P&gt;The follow error gets thrown immediately when I try to run the rule.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---&amp;gt; System.NullReferenceException: Object reference not set to an instance of an object.
   at ThisRule..ctor()
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean&amp;amp; canBeCached, RuntimeMethodHandleInternal&amp;amp; ctor, Boolean&amp;amp; bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark&amp;amp; stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark&amp;amp; stackMark)
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.Reflection.Assembly.CreateInstance(String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at Autodesk.iLogic.Exec.AppDomExec.CreateObjectWithInterface(Assembly a, String interfaceName)
   at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
   at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code I try to run is as follows. Can someone help to debug this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;'Sub Routing to Define Sub Run Order
Sub Main()
	CreateEmptyDictionary()
	CreateFastenerDictionary()
	CreateVirtualParts()
End Sub

'Public Declarations for use in all functions
Public Dim PartPropertiesFileAddr As String = "04_Part_iProperties.xlsm"
Public Dim FastenerPropertyFileAddr As String = "C:\Downloads\Fastener_Project_Properties.xlsm"
Public Dim oPartDictionary As New Dictionary(Of String, Dictionary(Of String, Integer))
Public Dim oAssy As AssemblyDocument = ThisDoc.Document
Public Dim oAsmCompDef As AssemblyComponentDefinition = oAssy.ComponentDefinition

'Prepopulates the oPartDictionary from an Excel Sheet master
Sub CreateEmptyDictionary
'Find Max Iterations in Parts Sheet
GoExcel.Open(PartPropertiesFileAddr,"Parts")
Dim PartsMaxIterations As Integer = GoExcel.CellValue("F1")

For Rows = 4 To PartsMaxIterations
	'Compare the Material Setting to weed out non-screwed/fastened pieces
	If GoExcel.CellValue("D" &amp;amp; Rows) = "Aluminum" Then
		Dim PartName As String = GoExcel.CellValue("A" &amp;amp; Rows)
		Dim EmptyDictionary As New Dictionary(Of String, Integer)
		oPartDictionary.Add(PartName, EmptyDictionary)
	End If
Next
GoExcel.Close
End Sub

Public Dim oFastDictionary As New Dictionary(Of String, Integer)
Sub CreateFastenerDictionary()
	GoExcel.Open(FastenerPropertyFileAddr, "Fasteners")
	oNumFast = GoExcel.CellValue("J" &amp;amp; 1)
	oNumExtr = GoExcel.CellValue("F" &amp;amp; 1)
	For extrusionID = 4 To NumExtr
		' Holds name of Extrusion in Each Iteration
		UnitExtrusion = GoExcel.CellValue("A" &amp;amp; extrusionID)
		' If the unit has the extrusion checked in excel sheet, then fill out fastener dictionary
		If oPartDictionary.Contains(UnitExtrusion) Then
			For fastenerID = 2 To oNumFast
				'Changes the Character for Clumn
				FastenerCol = "A" + fastenerID - 1
				FastQuantity = GoExcel.CellValue(FastenerCol &amp;amp; fastenerID)
				If FastQuantity &amp;lt;&amp;gt; 0 Then
					' Grab ID of every Fastener that does have a # of parts
					Dim ofastenerName As String = GoExcel.CellValue(FastenerCol &amp;amp; 3)
					oFastDictionary.Add(ofastenerName,FastQuantity)
				End If
			Next
			'Skip to next fastener 
		End If
		'End searching for the part
	Next
	GoExcel.Close
End Sub


'Loop through the assembly to check how many virtual parts are to be made
Sub CreateVirtualParts
'Once the Level 1 Dictionary is created, the FastenerDictionary needs to be generated
Dim i As Integer = 0 ' Holding Index Variable
Dim identity As Matrix = ThisApplication.TransientGeometry.CreateMatrix

' Loop through all the Parts
For Each oOcc As ComponentOccurrence In oAsmCompDef.Occurrences
	'Only look to check if the part itself is not already virtual 
	If Not TypeOf oOcc.Definition Is VirtualComponentDefinition Then
		On Error Resume Next
		oDocFile = oOcc.Definition.Document
		oDocFileName = oDocFile.displayname
		'Set your delimiter
		Delimiter = InStr(oDocFileName, "-")
		Description = Left(oDocFileName, Delimiter - 1)
		' Check if Part Dictionary contains the part for the model
		If oPartDictionary.ContainsKey(Description) Then
			' If it does have the Part, then get the Fastener dictionary and create the number of virtual parts
			' This for loop uses the oOcc to find keys in the map instead of looping through the map
			For Each oFastenerType As String In oPartDictionary(Description).Keys
				For i = 1 To oPartDictionary(Description)(oFastenerType)
				' Loop through each fastener type within the Fastener dictionary ^
				' Virtual Part Parameters
				FastenerName = oFastenerType &amp;amp; ":" &amp;amp; i
				'oProp1 = oFastenerType
				
				'Create a new component occurrence
				Dim oNewOcc As ComponentOccurrence = oAsmCompDef.Occurences	 
				virtOcc = oNewOcc.AddVirtual(FastenerName, identity)
				
				'Create Virtual Component Definition
				Dim oCVirtualCompDef As VirtualComponentDefinition 
				oCVirtualCompDef = oNewOcc.Definition
		        'iProperties.Value(FastenerName &amp;amp; ":1", "Project", "Description") = oProp1
				i = i + 1
				Next
			Next
		End If
	End If
Next
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The excel document has the following template:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Fastener_Project_Properties Excel.PNG" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/792330i2980C3CD54501EE4/image-size/large?v=v2&amp;amp;px=999" role="button" title="Fastener_Project_Properties Excel.PNG" alt="Fastener_Project_Properties Excel.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2020 17:07:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-throwing-error-set-by-invocation-help/m-p/9620331#M112931</guid>
      <dc:creator>ABoaro</dc:creator>
      <dc:date>2020-07-06T17:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: Inventor Throwing Error set by Invocation Help</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-throwing-error-set-by-invocation-help/m-p/9621913#M112950</link>
      <description>&lt;P&gt;At first glance; Public Dim PartPropertiesFileAddr As String = "04_Part_iProperties.xlsm"&lt;/P&gt;&lt;P&gt;looks suspicious is this the correct file you want to use? Also when you are assigning objects to variables it is good to check for null before using them. this will help with debugging or you can use try/catch blocks with a messageBox for these assignment to know exactly where it is failing&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2020 12:52:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-throwing-error-set-by-invocation-help/m-p/9621913#M112950</guid>
      <dc:creator>omartin</dc:creator>
      <dc:date>2020-07-07T12:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: Inventor Throwing Error set by Invocation Help</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-throwing-error-set-by-invocation-help/m-p/9622127#M112955</link>
      <description>&lt;P&gt;I will try the null approach. I am coming from C++ and I am wondering how is NULL checked in VBA.Net specifically.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And yes, the Parts Properties excel file is a macro enabled sheet that has code within the sheet to feed information to iLogic. Could it be that iLogic only likes .xls style files?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for a point in a debugging direction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2020 14:10:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-throwing-error-set-by-invocation-help/m-p/9622127#M112955</guid>
      <dc:creator>ABoaro</dc:creator>
      <dc:date>2020-07-07T14:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: Inventor Throwing Error set by Invocation Help</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-throwing-error-set-by-invocation-help/m-p/9622164#M112957</link>
      <description>&lt;P&gt;I have not used goExcel myself, but I read it has a lot of finickey behaviour. you can do a small test to ensure that file is being loaded properly with xlsm, otherwise it is some other object that is failng on assignment, you can use is the, "is nothing" to check for null objects&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2020 14:26:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-throwing-error-set-by-invocation-help/m-p/9622164#M112957</guid>
      <dc:creator>omartin</dc:creator>
      <dc:date>2020-07-07T14:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: Inventor Throwing Error set by Invocation Help</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-throwing-error-set-by-invocation-help/m-p/9626873#M113068</link>
      <description>&lt;P&gt;I went ahead and adjusted the format. The sub feature of the set up was what was throwing null exceptions. Now I am getting a similar error but for the Dictionary Definition.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am wondering if you know how to set objects either as NULL or set the dictionary to am empty dictionary. I am hoping after that it should be fixed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But to answer your other point, yes it is an excel file. The path for xlsm is just a type of excel sheet with macros that I programmed into that myself. I haven't had issues with that before.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 18:12:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-throwing-error-set-by-invocation-help/m-p/9626873#M113068</guid>
      <dc:creator>ABoaro</dc:creator>
      <dc:date>2020-07-09T18:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: Inventor Throwing Error set by Invocation Help</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-throwing-error-set-by-invocation-help/m-p/9627292#M113078</link>
      <description>&lt;P&gt;As soon as you new up the dictionary, it wont be null, it will be empty and you will be able to add to it, as long as the key you are adding is not null or duplicate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You do not want to set it to null or nothing after it has been new'd up other wise you wont be able to add to it and you will get a null excepton, you just want to clear() it out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im just looking at the CreateEmptyDictionary() is this where it is failing, what was the error message it may leave some clues&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 21:52:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-throwing-error-set-by-invocation-help/m-p/9627292#M113078</guid>
      <dc:creator>omartin</dc:creator>
      <dc:date>2020-07-09T21:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: Inventor Throwing Error set by Invocation Help</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-throwing-error-set-by-invocation-help/m-p/9627369#M113079</link>
      <description>&lt;P&gt;After tediously going line by line and commenting out and determining what works, I found that the invocation error was fixed when I did the following change:&lt;/P&gt;&lt;PRE&gt;Dim EmptyDictionary As New Dictionary(Of String, Integer)&lt;/PRE&gt;&lt;P&gt;to this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;EmptyDictionary&lt;/SPAN&gt; = &lt;SPAN&gt;New&lt;/SPAN&gt; &lt;SPAN&gt;Dictionary&lt;/SPAN&gt;(&lt;SPAN&gt;Of&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;, &lt;SPAN&gt;Integer&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;The null error appeared to have gone away with this fix. Unsure how this differs from the first declaration of the empty dictionary.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My next error occurs when I am looping through the excel columns. GoExcel seems to only like character indices when getting a specific value. I get an error message about looping through the columns:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;System.ArgumentException: Argument 'Limit' is Nothing.&lt;BR /&gt;at Microsoft.VisualBasic.CompilerServices.ObjectFlowControl.ForLoopControl.ForLoopInitObj(Object Counter, Object Start, Object Limit, Object StepValue, Object&amp;amp; LoopForResult, Object&amp;amp; CounterResult)&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;Not sure if you can help with that at least. I know you are weary of Excel.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 22:42:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-throwing-error-set-by-invocation-help/m-p/9627369#M113079</guid>
      <dc:creator>ABoaro</dc:creator>
      <dc:date>2020-07-09T22:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: Inventor Throwing Error set by Invocation Help</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-throwing-error-set-by-invocation-help/m-p/9627440#M113081</link>
      <description>I pretty sure the 'limit' is what your for loop is counting to, seems like it is not being set, if you are getting a value from the f1 column it may need to be converted to integer first. I dont have access to inventor right now so im just going off the top</description>
      <pubDate>Thu, 09 Jul 2020 23:25:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-throwing-error-set-by-invocation-help/m-p/9627440#M113081</guid>
      <dc:creator>omartin</dc:creator>
      <dc:date>2020-07-09T23:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: Inventor Throwing Error set by Invocation Help</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-throwing-error-set-by-invocation-help/m-p/9628994#M113107</link>
      <description>&lt;P&gt;I have provided the updated code below that has fixed all the bugs I was having. I needed to convert some of the cell types from Excel to strings and others to numbers to ensure my looping worked.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Although, taking you suggestion, I may steer away from Excel come the future.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;'Public Declarations for use in all functions&lt;/SPAN&gt;
 &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;PartPropertiesFileAddr&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;"W:\Projects-Walters-Wolf\2019\19-04_MSCM_Samm\4-Production_Drawings\19-04_Part_iProperties.xlsm"&lt;/SPAN&gt;
 &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;FastenerPropertyFileAddr&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;"C:\Users\aboaro\Downloads\Fastener_Project_Properties.xlsm"&lt;/SPAN&gt;
 &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPartDictionary&lt;/SPAN&gt; = &lt;SPAN&gt;New&lt;/SPAN&gt; &lt;SPAN&gt;Dictionary&lt;/SPAN&gt;(&lt;SPAN&gt;Of&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;, &lt;SPAN&gt;Dictionary&lt;/SPAN&gt;(&lt;SPAN&gt;Of&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;, &lt;SPAN&gt;Integer&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;AssemblyDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;
 &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAsmCompDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyComponentDefinition&lt;/SPAN&gt; = &lt;SPAN&gt;oAssy&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;
 &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;List&lt;/SPAN&gt; = &lt;SPAN&gt;New&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;(){&lt;SPAN&gt;"B"&lt;/SPAN&gt;, &lt;SPAN&gt;"C"&lt;/SPAN&gt;, &lt;SPAN&gt;"D"&lt;/SPAN&gt;, &lt;SPAN&gt;"E"&lt;/SPAN&gt;, &lt;SPAN&gt;"F"&lt;/SPAN&gt;, &lt;SPAN&gt;"G"&lt;/SPAN&gt;, &lt;SPAN&gt;"H"&lt;/SPAN&gt;, &lt;SPAN&gt;"I"&lt;/SPAN&gt;, &lt;SPAN&gt;"J"&lt;/SPAN&gt;, &lt;SPAN&gt;"K"&lt;/SPAN&gt;, &lt;SPAN&gt;"L"&lt;/SPAN&gt;, &lt;SPAN&gt;"M"&lt;/SPAN&gt;, &lt;SPAN&gt;"N"&lt;/SPAN&gt;, &lt;SPAN&gt;"O"&lt;/SPAN&gt;, &lt;SPAN&gt;"P"&lt;/SPAN&gt;, &lt;SPAN&gt;"Q"&lt;/SPAN&gt;, &lt;SPAN&gt;"R"&lt;/SPAN&gt;, &lt;SPAN&gt;"S"&lt;/SPAN&gt;, &lt;SPAN&gt;"T"&lt;/SPAN&gt;,&lt;SPAN&gt;"U"&lt;/SPAN&gt;, &lt;SPAN&gt;"V"&lt;/SPAN&gt;, &lt;SPAN&gt;"W"&lt;/SPAN&gt;, &lt;SPAN&gt;"X"&lt;/SPAN&gt;, &lt;SPAN&gt;"Y"&lt;/SPAN&gt;, &lt;SPAN&gt;"Z"&lt;/SPAN&gt;, &lt;SPAN&gt;"AA"&lt;/SPAN&gt;, &lt;SPAN&gt;"AB"&lt;/SPAN&gt;, &lt;SPAN&gt;"AC"&lt;/SPAN&gt;, &lt;SPAN&gt;"AD"&lt;/SPAN&gt;, &lt;SPAN&gt;"AE"&lt;/SPAN&gt;, &lt;SPAN&gt;"AF"&lt;/SPAN&gt;, &lt;SPAN&gt;"AG"&lt;/SPAN&gt;, &lt;SPAN&gt;"AH"&lt;/SPAN&gt;, &lt;SPAN&gt;"AI"&lt;/SPAN&gt;, &lt;SPAN&gt;"AJ"&lt;/SPAN&gt;, &lt;SPAN&gt;"AK"&lt;/SPAN&gt;, &lt;SPAN&gt;"AL"&lt;/SPAN&gt;, &lt;SPAN&gt;"AM"&lt;/SPAN&gt;}
 
&lt;SPAN&gt;'Find Max Iterations in Parts Sheet&lt;/SPAN&gt;
&lt;SPAN&gt;GoExcel&lt;/SPAN&gt;.&lt;SPAN&gt;Open&lt;/SPAN&gt;(&lt;SPAN&gt;PartPropertiesFileAddr&lt;/SPAN&gt;,&lt;SPAN&gt;"Parts"&lt;/SPAN&gt;)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;PartsMaxIterations&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Integer&lt;/SPAN&gt; = &lt;SPAN&gt;GoExcel&lt;/SPAN&gt;.&lt;SPAN&gt;CellValue&lt;/SPAN&gt;(&lt;SPAN&gt;"F1"&lt;/SPAN&gt;)
&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Rows&lt;/SPAN&gt; = 4 &lt;SPAN&gt;To&lt;/SPAN&gt; &lt;SPAN&gt;PartsMaxIterations&lt;/SPAN&gt;
	&lt;SPAN&gt;'Compare the Material Setting to weed out non-screwed/fastened pieces&lt;/SPAN&gt;
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;GoExcel&lt;/SPAN&gt;.&lt;SPAN&gt;CellValue&lt;/SPAN&gt;(&lt;SPAN&gt;"D"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Rows&lt;/SPAN&gt;) = &lt;SPAN&gt;"Aluminum"&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;PartName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;GoExcel&lt;/SPAN&gt;.&lt;SPAN&gt;CellValue&lt;/SPAN&gt;(&lt;SPAN&gt;"A"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Rows&lt;/SPAN&gt;)
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;EmptyDictionary&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;New&lt;/SPAN&gt; &lt;SPAN&gt;Dictionary&lt;/SPAN&gt;(&lt;SPAN&gt;Of&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;, &lt;SPAN&gt;Integer&lt;/SPAN&gt;)
		&lt;SPAN&gt;oPartDictionary&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;PartName&lt;/SPAN&gt;, &lt;SPAN&gt;EmptyDictionary&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;GoExcel&lt;/SPAN&gt;.&lt;SPAN&gt;Close&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oFastDictionary&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;New&lt;/SPAN&gt; &lt;SPAN&gt;Dictionary&lt;/SPAN&gt;(&lt;SPAN&gt;Of&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;, &lt;SPAN&gt;Integer&lt;/SPAN&gt;)
&lt;SPAN&gt;GoExcel&lt;/SPAN&gt;.&lt;SPAN&gt;Open&lt;/SPAN&gt;(&lt;SPAN&gt;FastenerPropertyFileAddr&lt;/SPAN&gt;, &lt;SPAN&gt;"Fasteners"&lt;/SPAN&gt;)
	
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oNumFast&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Integer&lt;/SPAN&gt; = &lt;SPAN&gt;GoExcel&lt;/SPAN&gt;.&lt;SPAN&gt;CellValue&lt;/SPAN&gt;(&lt;SPAN&gt;"J"&lt;/SPAN&gt; &amp;amp; 1)
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oNumExtr&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Integer&lt;/SPAN&gt; = &lt;SPAN&gt;GoExcel&lt;/SPAN&gt;.&lt;SPAN&gt;CellValue&lt;/SPAN&gt;(&lt;SPAN&gt;"K"&lt;/SPAN&gt; &amp;amp; 1)
	&lt;SPAN&gt;'Row number matched to specific Extrusion&lt;/SPAN&gt;
	&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;extrusionID&lt;/SPAN&gt; = 4 &lt;SPAN&gt;To&lt;/SPAN&gt; &lt;SPAN&gt;oNumExtr&lt;/SPAN&gt;
		&lt;SPAN&gt;' Holds name of Extrusion in Each Iteration&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oUnitExtrusion&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;GoExcel&lt;/SPAN&gt;.&lt;SPAN&gt;CellValue&lt;/SPAN&gt;(&lt;SPAN&gt;"A"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;extrusionID&lt;/SPAN&gt;)
		&lt;SPAN&gt;' If the unit has the extrusion checked in excel sheet, then fill out fastener dictionary&lt;/SPAN&gt;
		&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oPartDictionary&lt;/SPAN&gt;.&lt;SPAN&gt;Keys&lt;/SPAN&gt;.&lt;SPAN&gt;Contains&lt;/SPAN&gt;(&lt;SPAN&gt;oUnitExtrusion&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt;
			&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;fastenerID&lt;/SPAN&gt; = 2 &lt;SPAN&gt;To&lt;/SPAN&gt; &lt;SPAN&gt;List&lt;/SPAN&gt;.&lt;SPAN&gt;Length&lt;/SPAN&gt;
				&lt;SPAN&gt;' Selects Column Letter&lt;/SPAN&gt;
				&lt;SPAN&gt;FastenerCol&lt;/SPAN&gt; = &lt;SPAN&gt;List&lt;/SPAN&gt;(&lt;SPAN&gt;fastenerID&lt;/SPAN&gt; - 2)
				&lt;SPAN&gt;'Number of Fasteners&lt;/SPAN&gt;
				&lt;SPAN&gt;FastQuantity&lt;/SPAN&gt; = &lt;SPAN&gt;GoExcel&lt;/SPAN&gt;.&lt;SPAN&gt;CellValue&lt;/SPAN&gt;(&lt;SPAN&gt;FastenerCol&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;extrusionID&lt;/SPAN&gt;)
				
				&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;FastQuantity&lt;/SPAN&gt; &amp;lt;&amp;gt; 0 &lt;SPAN&gt;Then&lt;/SPAN&gt;
					&lt;SPAN&gt;' Grab ID of every Fastener that does have a # of parts&lt;/SPAN&gt;
					&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;ofastenerName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; = &lt;SPAN&gt;CStr&lt;/SPAN&gt;(&lt;SPAN&gt;GoExcel&lt;/SPAN&gt;.&lt;SPAN&gt;CellValue&lt;/SPAN&gt;(&lt;SPAN&gt;FastenerCol&lt;/SPAN&gt; &amp;amp; 3))
					&lt;SPAN&gt;'MsgBox(ofastenerName) -&amp;gt; show fastener name&lt;/SPAN&gt;
					&lt;SPAN&gt;'MsgBox(FastQuantity) -&amp;gt; show Fastener Quantity&lt;/SPAN&gt;
					&lt;SPAN&gt;'Add fastener to the fastener dictionary for specific part&lt;/SPAN&gt;
					&lt;SPAN&gt;oFastDictionary&lt;/SPAN&gt;.&lt;SPAN&gt;Add&lt;/SPAN&gt;(&lt;SPAN&gt;ofastenerName&lt;/SPAN&gt;, &lt;SPAN&gt;FastQuantity&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 Fastener Check&lt;/SPAN&gt;
			&lt;SPAN&gt;oPartDictionary&lt;/SPAN&gt;(&lt;SPAN&gt;oUnitExtrusion&lt;/SPAN&gt;) = &lt;SPAN&gt;oFastDictionary&lt;/SPAN&gt;
			&lt;SPAN&gt;oFastDictionary&lt;/SPAN&gt; = &lt;SPAN&gt;New&lt;/SPAN&gt; &lt;SPAN&gt;Dictionary&lt;/SPAN&gt;(&lt;SPAN&gt;Of&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;, &lt;SPAN&gt;Integer&lt;/SPAN&gt;)
		&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
		&lt;SPAN&gt;'End searching for the part&lt;/SPAN&gt;
	&lt;SPAN&gt;Next&lt;/SPAN&gt;
	&lt;SPAN&gt;GoExcel&lt;/SPAN&gt;.&lt;SPAN&gt;Close&lt;/SPAN&gt;



&lt;SPAN&gt;'Loop through the assembly to check how many virtual parts are to be made&lt;/SPAN&gt;
&lt;SPAN&gt;'Once the Level 1 Dictionary is created, the FastenerDictionary needs to be generated&lt;/SPAN&gt;
&lt;SPAN&gt;'Dim i As Integer = 0 ' Holding Index Variable&lt;/SPAN&gt;


&lt;SPAN&gt;'' Loop through all the Parts&lt;/SPAN&gt;
&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oOcc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oAsmCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;Occurrences&lt;/SPAN&gt;
	&lt;SPAN&gt;'Only look to check if the part itself is not already virtual &lt;/SPAN&gt;
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;Not&lt;/SPAN&gt; &lt;SPAN&gt;TypeOf&lt;/SPAN&gt; &lt;SPAN&gt;oOcc&lt;/SPAN&gt;.&lt;SPAN&gt;Definition&lt;/SPAN&gt; &lt;SPAN&gt;Is&lt;/SPAN&gt; &lt;SPAN&gt;VirtualComponentDefinition&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
		&lt;SPAN&gt;On&lt;/SPAN&gt; &lt;SPAN&gt;Error&lt;/SPAN&gt; &lt;SPAN&gt;Resume&lt;/SPAN&gt; &lt;SPAN&gt;Next&lt;/SPAN&gt;
		&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;identity&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Matrix&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientGeometry&lt;/SPAN&gt;.&lt;SPAN&gt;CreateMatrix&lt;/SPAN&gt;
		&lt;SPAN&gt;oDocFile&lt;/SPAN&gt; = &lt;SPAN&gt;oOcc&lt;/SPAN&gt;.&lt;SPAN&gt;Definition&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;
		&lt;SPAN&gt;oDocFileName&lt;/SPAN&gt; = &lt;SPAN&gt;oDocFile&lt;/SPAN&gt;.&lt;SPAN&gt;displayname&lt;/SPAN&gt;
		&lt;SPAN&gt;'Set your delimiter&lt;/SPAN&gt;
		&lt;SPAN&gt;Delimiter&lt;/SPAN&gt; = &lt;SPAN&gt;InStr&lt;/SPAN&gt;(&lt;SPAN&gt;oDocFileName&lt;/SPAN&gt;, &lt;SPAN&gt;"-"&lt;/SPAN&gt;)
		&lt;SPAN&gt;Description&lt;/SPAN&gt; = &lt;SPAN&gt;Left&lt;/SPAN&gt;(&lt;SPAN&gt;oDocFileName&lt;/SPAN&gt;, &lt;SPAN&gt;Delimiter&lt;/SPAN&gt; - 1)
		&lt;SPAN&gt;MsgBox&lt;/SPAN&gt;(&lt;SPAN&gt;Description&lt;/SPAN&gt;)
		&lt;SPAN&gt;' Check if Part Dictionary contains the part for the model&lt;/SPAN&gt;
		&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oPartDictionary&lt;/SPAN&gt;.&lt;SPAN&gt;ContainsKey&lt;/SPAN&gt;(&lt;SPAN&gt;Description&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt;
			&lt;SPAN&gt;' If it does have the Part, then get the Fastener dictionary and create the number of virtual parts&lt;/SPAN&gt;
			&lt;SPAN&gt;' This for loop uses the oOcc to find keys in the map instead of looping through the map&lt;/SPAN&gt;
			&lt;SPAN&gt;MsgBox&lt;/SPAN&gt;(&lt;SPAN&gt;oPartDictionary&lt;/SPAN&gt;(&lt;SPAN&gt;Description&lt;/SPAN&gt;).&lt;SPAN&gt;Keys&lt;/SPAN&gt;.&lt;SPAN&gt;Count&lt;/SPAN&gt;)
			&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oFastenerType&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oPartDictionary&lt;/SPAN&gt;(&lt;SPAN&gt;Description&lt;/SPAN&gt;).&lt;SPAN&gt;Keys&lt;/SPAN&gt;
				&lt;SPAN&gt;'MsgBox(oPartDictionary(Description)(oFastenerType))&lt;/SPAN&gt;
				&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;i&lt;/SPAN&gt; = 0 &lt;SPAN&gt;To&lt;/SPAN&gt; &lt;SPAN&gt;oPartDictionary&lt;/SPAN&gt;(&lt;SPAN&gt;Description&lt;/SPAN&gt;)(&lt;SPAN&gt;oFastenerType&lt;/SPAN&gt;)
&lt;SPAN&gt;'				' Loop through each fastener type within the Fastener dictionary ^&lt;/SPAN&gt;
&lt;SPAN&gt;'				' Virtual Part Parameters&lt;/SPAN&gt;
				&lt;SPAN&gt;FastenerName&lt;/SPAN&gt; = &lt;SPAN&gt;oFastenerType&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;":"&lt;/SPAN&gt; &amp;amp; (&lt;SPAN&gt;i&lt;/SPAN&gt; + 1)
				&lt;SPAN&gt;'oProp1 = oFastenerType&lt;/SPAN&gt;
				
&lt;SPAN&gt;'				'Create a new component occurrence&lt;/SPAN&gt;
				&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oNewOcc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt; 
				&lt;SPAN&gt;oNewOcc&lt;/SPAN&gt; = &lt;SPAN&gt;oAsmCompDef&lt;/SPAN&gt;.&lt;SPAN&gt;Occurrences&lt;/SPAN&gt;.&lt;SPAN&gt;AddVirtual&lt;/SPAN&gt;(&lt;SPAN&gt;FastenerName&lt;/SPAN&gt;, &lt;SPAN&gt;identity&lt;/SPAN&gt;) 
				&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oCVirtualCompDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;VirtualComponentDefinition&lt;/SPAN&gt; 
				&lt;SPAN&gt;oCVirtualCompDef&lt;/SPAN&gt; = &lt;SPAN&gt;oNewOcc&lt;/SPAN&gt;.&lt;SPAN&gt;Definition&lt;/SPAN&gt; 
				
				&lt;SPAN&gt;'Create Virtual Component Definition&lt;/SPAN&gt;
				&lt;SPAN&gt;'Dim oCVirtualCompDef As VirtualComponentDefinition &lt;/SPAN&gt;
				&lt;SPAN&gt;'oCVirtualCompDef = oNewOcc.Definition&lt;/SPAN&gt;
		        &lt;SPAN&gt;'iProperties.Value(FastenerName &amp;amp; ":1", "Project", "Description") = oProp1&lt;/SPAN&gt;
&lt;SPAN&gt;'				i = i + 1&lt;/SPAN&gt;
				&lt;SPAN&gt;Next&lt;/SPAN&gt;
			&lt;SPAN&gt;Next&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;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jul 2020 16:40:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-throwing-error-set-by-invocation-help/m-p/9628994#M113107</guid>
      <dc:creator>ABoaro</dc:creator>
      <dc:date>2020-07-10T16:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: Inventor Throwing Error set by Invocation Help</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-throwing-error-set-by-invocation-help/m-p/9629045#M113108</link>
      <description>&lt;P&gt;Glad to hear it all worked out!&amp;nbsp; some times you got to do what ya got to do and now you know more things to look out for.&lt;/P&gt;&lt;P&gt;you can look in to creating excel as an object and then using the native excel commands, I find this more predictable.&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jul 2020 17:09:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/inventor-throwing-error-set-by-invocation-help/m-p/9629045#M113108</guid>
      <dc:creator>omartin</dc:creator>
      <dc:date>2020-07-10T17:09:54Z</dc:date>
    </item>
  </channel>
</rss>

