<?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: Rule to suppress Component Patterns with zero value in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-to-suppress-component-patterns-with-zero-value/m-p/10480436#M126662</link>
    <description>&lt;P&gt;Thanks for the reply. Right, it's not possible to make patterns with zero components. I have some component patterns in an assembly that are driven by parameters which, depending on certain dimensions, may cause the number of elements to be reduced to zero, resulting in an error ("out of range", see below, &lt;STRONG&gt;Fig. 1&lt;/STRONG&gt;, circled in red*). I wish to automatically suppress the errored "zero-element" component patterns. I hope that makes more sense now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was hoping that the the Count property that &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;suggested would catch the value of my parameter as being zero (see example in &lt;STRONG&gt;Fig. 2&lt;/STRONG&gt;) and the rule would then suppress all "zero-element" patterns. Perhaps an error trigger could be used if the zero Count wouldn't work? Thanks for considering.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Figure 1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mgreen7W3EF_0-1626724968420.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/942995iE783E0339B69949D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mgreen7W3EF_0-1626724968420.png" alt="mgreen7W3EF_0-1626724968420.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;*"Out of range"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Figure 2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mgreen7W3EF_0-1626726125819.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/943003i2D3C0437F40DB654/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mgreen7W3EF_0-1626726125819.png" alt="mgreen7W3EF_0-1626726125819.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Example of zero-valued parameter driving component pattern.&lt;/P&gt;</description>
    <pubDate>Mon, 19 Jul 2021 20:22:34 GMT</pubDate>
    <dc:creator>mgreenmachine</dc:creator>
    <dc:date>2021-07-19T20:22:34Z</dc:date>
    <item>
      <title>Rule to suppress Component Patterns with zero value</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-to-suppress-component-patterns-with-zero-value/m-p/10479702#M126633</link>
      <description>&lt;P&gt;I am trying to write a rule that automatically suppresses any and all component patterns in an assembly which have an instance value of zero. I would like to somehow scan the active assembly for any component patterns with a zero value, but I'm not sure how to do that (I've put my attempt to do so in &lt;STRONG&gt;bold&lt;/STRONG&gt; below). I'm quite inexperienced with iLogic/coding. Below is the best I could come up with. Any help would be greatly appreciated!&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyComponentDefinition&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPattern&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;OccurrencePattern&lt;/SPAN&gt; 

&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oPattern&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oDef&lt;/SPAN&gt;.&lt;SPAN&gt;OccurrencePatterns&lt;/SPAN&gt;
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;STRONG&gt;oPattern.value = 0&lt;/STRONG&gt;
		&lt;SPAN&gt;oPattern&lt;/SPAN&gt;.&lt;SPAN&gt;Suppressed&lt;/SPAN&gt; = &lt;SPAN&gt;True&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>Mon, 19 Jul 2021 15:01:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-to-suppress-component-patterns-with-zero-value/m-p/10479702#M126633</guid>
      <dc:creator>mgreenmachine</dc:creator>
      <dc:date>2021-07-19T15:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: Rule to suppress Component Patterns with zero value</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-to-suppress-component-patterns-with-zero-value/m-p/10479968#M126642</link>
      <description>&lt;P&gt;The &lt;A href="https://help.autodesk.com/view/INVNTOR/2021/ENU/?guid=GUID-70F241E5-0CA9-4090-8A0B-19A8D55F68B7" target="_blank" rel="noopener"&gt;OccurrencePattern&lt;/A&gt; object has a property called &lt;A href="https://help.autodesk.com/view/INVNTOR/2021/ENU/?guid=GUID-70F241E5-0CA9-4090-8A0B-19A8D55F68B7" target="_blank" rel="noopener"&gt;OccurrencePatternElements&lt;/A&gt; that you can get a &lt;A href="https://help.autodesk.com/view/INVNTOR/2021/ENU/?guid=GUID-98971858-25FB-4652-AA2A-8DBF7235848C" target="_blank" rel="noopener"&gt;Count&lt;/A&gt; from.&amp;nbsp; Give that a try.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN style="background-color: green; color: white;"&gt;&lt;STRONG&gt;ACCEPT SOLUTION&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;SPAN&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@7401B55A0A518861312A0F851CD29320/emoticons/1f44d.png" alt=":thumbs_up:" title=":thumbs_up:" /&gt;&lt;/SPAN&gt;.&lt;/P&gt;
&lt;P&gt;If you want and have time, I would appreciate your Vote(s) for &lt;A href="https://forums.autodesk.com/t5/forums/recentpostspage/post-type/message/interaction-style/idea/user-id/7812054/" target="_blank"&gt;My IDEAS &lt;SPAN&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B166FEBB95D67CFA84899D32D8E17FC1/emoticons/1f4a1.png" alt=":light_bulb:" title=":light_bulb:" /&gt;&lt;/SPAN&gt;&lt;/A&gt;or you can Explore &lt;A href="https://knowledge.autodesk.com/profile/LTSUSR7HXMSAE/articles" target="_blank"&gt;My CONTRIBUTIONS &lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 16:23:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-to-suppress-component-patterns-with-zero-value/m-p/10479968#M126642</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2021-07-19T16:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: Rule to suppress Component Patterns with zero value</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-to-suppress-component-patterns-with-zero-value/m-p/10480015#M126644</link>
      <description>&lt;P&gt;Thanks for the reply. I tried this. Nothing is happening, so I suspect I am messing up on referencing things correctly or the syntax....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDef&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyComponentDefinition&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;.&lt;SPAN&gt;ComponentDefinition&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPattern&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;OccurrencePattern&lt;/SPAN&gt; 

&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oPattern&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oDef&lt;/SPAN&gt;.&lt;SPAN&gt;OccurrencePatterns&lt;/SPAN&gt;
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oPattern&lt;/SPAN&gt;.&lt;SPAN&gt;OccurrencePatternElements&lt;/SPAN&gt;.&lt;SPAN&gt;Count&lt;/SPAN&gt; = 0 &lt;SPAN&gt;Then&lt;/SPAN&gt;
		&lt;SPAN&gt;oPattern&lt;/SPAN&gt;.&lt;SPAN&gt;OccurencePatterns&lt;/SPAN&gt;.&lt;SPAN&gt;Suppressed&lt;/SPAN&gt; = &lt;SPAN&gt;True&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>Mon, 19 Jul 2021 16:44:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-to-suppress-component-patterns-with-zero-value/m-p/10480015#M126644</guid>
      <dc:creator>mgreenmachine</dc:creator>
      <dc:date>2021-07-19T16:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: Rule to suppress Component Patterns with zero value</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-to-suppress-component-patterns-with-zero-value/m-p/10480363#M126658</link>
      <description>&lt;P&gt;I'm not sure what you mean with: "&lt;EM&gt;component patterns in an assembly which have an instance value of zero.&lt;/EM&gt;" As far I know it's not possible to make patterns with zero components in each element. Also, I can't make a pattern with zero elements.&lt;/P&gt;&lt;P&gt;So I guess that some thing else is going on. Can you share some more information about what you are trying to do.&amp;nbsp; For example a screen shot, from a browser view, or some thing that, wich shows what you like to detect?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 19:40:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-to-suppress-component-patterns-with-zero-value/m-p/10480363#M126658</guid>
      <dc:creator>JelteDeJong</dc:creator>
      <dc:date>2021-07-19T19:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: Rule to suppress Component Patterns with zero value</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-to-suppress-component-patterns-with-zero-value/m-p/10480436#M126662</link>
      <description>&lt;P&gt;Thanks for the reply. Right, it's not possible to make patterns with zero components. I have some component patterns in an assembly that are driven by parameters which, depending on certain dimensions, may cause the number of elements to be reduced to zero, resulting in an error ("out of range", see below, &lt;STRONG&gt;Fig. 1&lt;/STRONG&gt;, circled in red*). I wish to automatically suppress the errored "zero-element" component patterns. I hope that makes more sense now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was hoping that the the Count property that &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;suggested would catch the value of my parameter as being zero (see example in &lt;STRONG&gt;Fig. 2&lt;/STRONG&gt;) and the rule would then suppress all "zero-element" patterns. Perhaps an error trigger could be used if the zero Count wouldn't work? Thanks for considering.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Figure 1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mgreen7W3EF_0-1626724968420.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/942995iE783E0339B69949D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mgreen7W3EF_0-1626724968420.png" alt="mgreen7W3EF_0-1626724968420.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;*"Out of range"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Figure 2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mgreen7W3EF_0-1626726125819.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/943003i2D3C0437F40DB654/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mgreen7W3EF_0-1626726125819.png" alt="mgreen7W3EF_0-1626726125819.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Example of zero-valued parameter driving component pattern.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 20:22:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-to-suppress-component-patterns-with-zero-value/m-p/10480436#M126662</guid>
      <dc:creator>mgreenmachine</dc:creator>
      <dc:date>2021-07-19T20:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: Rule to suppress Component Patterns with zero value</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-to-suppress-component-patterns-with-zero-value/m-p/10480564#M126670</link>
      <description>&lt;P&gt;oke that makes more sense ;-). But even if your parameter is zero the pattern will remember the last correct value. Therefore counting the number of elements will not help you. Instead, you can check the health status of the pattern. (I discovered that you need to update your assembly before checking or it will not give a correct value.)&lt;/P&gt;&lt;P&gt;Also suppressing the pattern is not as easy as I would like. but anyway try this.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN style="color: #ff0000;"&gt;Dim&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;doc&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;AssemblyDocument&lt;/SPAN&gt; = &lt;SPAN style="color: #800080;"&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;Document&lt;/SPAN&gt;

&lt;SPAN style="color: #800000;"&gt;doc&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Update&lt;/SPAN&gt;()
&lt;SPAN style="color: #ff0000;"&gt;For&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;Each&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;pat&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;OccurrencePattern&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;In&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;doc&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;ComponentDefinition&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;OccurrencePatterns&lt;/SPAN&gt;
    &lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt; (&lt;SPAN style="color: #800000;"&gt;pat&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;HealthStatus&lt;/SPAN&gt; &amp;lt;&amp;gt; &lt;SPAN style="color: #800000;"&gt;HealthStatusEnum&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;kUpToDateHealth&lt;/SPAN&gt;) &lt;SPAN style="color: #ff0000;"&gt;Then&lt;/SPAN&gt;
        &lt;SPAN style="color: #ff0000;"&gt;For&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;Each&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;occElement&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;OccurrencePatternElement&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;In&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;pat&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;OccurrencePatternElements&lt;/SPAN&gt;
            &lt;SPAN style="color: #ff0000;"&gt;For&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;Each&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;occ&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;As&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;ComponentOccurrence&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;In&lt;/SPAN&gt; &lt;SPAN style="color: #800000;"&gt;occElement&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Occurrences&lt;/SPAN&gt;
                &lt;SPAN style="color: #800000;"&gt;occ&lt;/SPAN&gt;.&lt;SPAN style="color: #800000;"&gt;Suppress&lt;/SPAN&gt;()
            &lt;SPAN style="color: #ff0000;"&gt;Next&lt;/SPAN&gt;
        &lt;SPAN style="color: #ff0000;"&gt;Next&lt;/SPAN&gt;
    &lt;SPAN style="color: #ff0000;"&gt;End&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt;
&lt;SPAN style="color: #ff0000;"&gt;Next&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Jul 2021 21:09:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-to-suppress-component-patterns-with-zero-value/m-p/10480564#M126670</guid>
      <dc:creator>JelteDeJong</dc:creator>
      <dc:date>2021-07-19T21:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: Rule to suppress Component Patterns with zero value</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-to-suppress-component-patterns-with-zero-value/m-p/10480604#M126671</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5011186"&gt;@JelteDeJong&lt;/a&gt;, thanks for explaining, I did not know that it would only consider the last correct value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your code worked perfectly! Too perfectly for my uses, in fact &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@4384DE21BEC9E5A7841E0AE0A3B180DF/emoticons/1f61c.png" alt=":winking_face_with_tongue:" title=":winking_face_with_tongue:" /&gt; The patterns I wished to suppress were nested under parent patterns, which were infected with errors up to the top level because their children patterns had errored, so the code suppressed all of them, as it should &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@9E6C021AF25E3AB87C9F241086322408/emoticons/1f602.png" alt=":face_with_tears_of_joy:" title=":face_with_tears_of_joy:" /&gt; I suppose I will try reworking how I modeled that section so that the patterns I don't want suppressed won't be thrown in with the ones I do. Thank you so much for your time, I really appreciate the help.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 21:32:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-to-suppress-component-patterns-with-zero-value/m-p/10480604#M126671</guid>
      <dc:creator>mgreenmachine</dc:creator>
      <dc:date>2021-07-19T21:32:16Z</dc:date>
    </item>
  </channel>
</rss>

