<?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 on iLogic code  - not obvious how to fix in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-on-ilogic-code-not-obvious-how-to-fix/m-p/9358646#M106643</link>
    <description>&lt;P&gt;That looks like it. I had inadvertantly suppressed a part in a pattern. Thanks for the help&lt;/P&gt;</description>
    <pubDate>Wed, 04 Mar 2020 18:15:30 GMT</pubDate>
    <dc:creator>RNDinov8r</dc:creator>
    <dc:date>2020-03-04T18:15:30Z</dc:date>
    <item>
      <title>Error on iLogic code  - not obvious how to fix</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-on-ilogic-code-not-obvious-how-to-fix/m-p/9358122#M106631</link>
      <description>&lt;P&gt;Here is the code i have. I have commented out the error that I get when I go to run it. The intent is to run some iLogic to delete suppressed parts and assembly after running a form where the user would choose which options to include. Those options not used, would be suppressed, and then ultimately deleted.&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;doc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyDocument&lt;/SPAN&gt;
  &lt;SPAN&gt;doc&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;

  &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;acd&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyComponentDefinition&lt;/SPAN&gt;
  &lt;SPAN&gt;acd&lt;/SPAN&gt; = &lt;SPAN&gt;doc&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;

  &lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;DeleteSuppressedComponent&lt;/SPAN&gt;(&lt;SPAN&gt;acd&lt;/SPAN&gt;.&lt;SPAN&gt;Occurrences&lt;/SPAN&gt;)
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;

&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;DeleteSuppressedComponent&lt;/SPAN&gt;(&lt;SPAN&gt;occs&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrences&lt;/SPAN&gt;)
  &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;occ&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ComponentOccurrence&lt;/SPAN&gt;
  &lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;occ&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;occs&lt;/SPAN&gt;
     &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;occ&lt;/SPAN&gt;.&lt;SPAN&gt;Suppressed&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
         &lt;SPAN&gt;occ&lt;/SPAN&gt;.&lt;SPAN&gt;Delete&lt;/SPAN&gt;
     &lt;SPAN&gt;Else&lt;/SPAN&gt;
         &lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;DeleteSuppressedComponent&lt;/SPAN&gt;(&lt;SPAN&gt;occ&lt;/SPAN&gt;.&lt;SPAN&gt;SubOccurrences&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;SPAN&gt;'System.ArgumentException: The Parameter Is incorrect. (Exception From HRESULT: 0x80070057 (E_INVALIDARG))&lt;/SPAN&gt;
   &lt;SPAN&gt;'at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&amp;amp; msgData)&lt;/SPAN&gt;
   &lt;SPAN&gt;'at Inventor.ComponentOccurrence.Delete()&lt;/SPAN&gt;
   &lt;SPAN&gt;'at ThisRule.DeleteSuppressedComponent(ComponentOccurrences occs)&lt;/SPAN&gt;
   &lt;SPAN&gt;'at ThisRule.Main()&lt;/SPAN&gt;
   &lt;SPAN&gt;'at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)&lt;/SPAN&gt;
   &lt;SPAN&gt;'at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Mar 2020 15:09:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-on-ilogic-code-not-obvious-how-to-fix/m-p/9358122#M106631</guid>
      <dc:creator>RNDinov8r</dc:creator>
      <dc:date>2020-03-04T15:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: Error on iLogic code  - not obvious how to fix</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-on-ilogic-code-not-obvious-how-to-fix/m-p/9358332#M106636</link>
      <description>&lt;P&gt;I was able to get this error by running your code on an assembly where an occurrence&amp;nbsp;&lt;STRONG&gt;within a component pattern&lt;/STRONG&gt; was suppressed. Could that be the issue for you?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If so, you could solve the issue by making sure the suppressed occurrence is not part of a pattern, and if it is, leave it alone. This tweak will do that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;occ&lt;/SPAN&gt;.&lt;SPAN&gt;Suppressed&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
	&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;Not&lt;/SPAN&gt; &lt;SPAN&gt;occ&lt;/SPAN&gt;.&lt;SPAN&gt;IsPatternElement&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;&lt;/FONT&gt;
		&lt;SPAN&gt;occ&lt;/SPAN&gt;.&lt;SPAN&gt;Delete&lt;/SPAN&gt;
	&lt;FONT color="#0000FF"&gt;&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;&lt;/FONT&gt;
&lt;SPAN&gt;Else&lt;/SPAN&gt;
	&lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;DeleteSuppressedComponent&lt;/SPAN&gt;(&lt;SPAN&gt;occ&lt;/SPAN&gt;.&lt;SPAN&gt;SubOccurrences&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, 04 Mar 2020 16:20:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-on-ilogic-code-not-obvious-how-to-fix/m-p/9358332#M106636</guid>
      <dc:creator>DRoam</dc:creator>
      <dc:date>2020-03-04T16:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: Error on iLogic code  - not obvious how to fix</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-on-ilogic-code-not-obvious-how-to-fix/m-p/9358646#M106643</link>
      <description>&lt;P&gt;That looks like it. I had inadvertantly suppressed a part in a pattern. Thanks for the help&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 18:15:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-on-ilogic-code-not-obvious-how-to-fix/m-p/9358646#M106643</guid>
      <dc:creator>RNDinov8r</dc:creator>
      <dc:date>2020-03-04T18:15:30Z</dc:date>
    </item>
  </channel>
</rss>

