<?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 Check Feature Suppression in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/check-feature-suppression/m-p/8666756#M77731</link>
    <description>&lt;P&gt;I have an iLogic code to change the direction of a rectangular pattern as shown here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument

Dim oDef As PartComponentDefinition
oDef = oDoc.ComponentDefinition

	If zeroCorner = "LEFT" Then
	oDef.Features.RectangularPatternFeatures("Rectangular Pattern1").Definition.NaturalXDirection = True
	oDef.Features.RectangularPatternFeatures("Rectangular Pattern2").Definition.NaturalXDirection = True
	oDef.Features.RectangularPatternFeatures("Rectangular Pattern3").Definition.NaturalXDirection = True
		Else 
			oDef.Features.RectangularPatternFeatures("Rectangular Pattern1").Definition.NaturalXDirection = False
			oDef.Features.RectangularPatternFeatures("Rectangular Pattern2").Definition.NaturalXDirection = False
			oDef.Features.RectangularPatternFeatures("Rectangular Pattern3").Definition.NaturalXDirection = False

	End If
&lt;/PRE&gt;
&lt;P&gt;Subsequently, I have rules in place to suppress the rectangular patterns within the part.&amp;nbsp; When the code given above is ran while the patterns are suppressed Inventor immediately crashes, losing all work.&amp;nbsp; I would like to add a try/catch to check the suppression of the patterns before the change in direction takes place, but am having trouble finding an answer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm assuming something like this will work, but have not had any luck:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Try
	oDef.Features.RectangularPatternFeatures("Rectangular Pattern1").GetSuppressionCondition

	Catch
	MessageBox.Show("Make pattern active before executing change.", "Error")
	End Try
&lt;/PRE&gt;
&lt;P&gt;How can I check that the rectangular pattern is active before changing the direction of the pattern?&amp;nbsp; Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 18 Mar 2019 18:47:59 GMT</pubDate>
    <dc:creator>jfenter</dc:creator>
    <dc:date>2019-03-18T18:47:59Z</dc:date>
    <item>
      <title>Check Feature Suppression</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/check-feature-suppression/m-p/8666756#M77731</link>
      <description>&lt;P&gt;I have an iLogic code to change the direction of a rectangular pattern as shown here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument

Dim oDef As PartComponentDefinition
oDef = oDoc.ComponentDefinition

	If zeroCorner = "LEFT" Then
	oDef.Features.RectangularPatternFeatures("Rectangular Pattern1").Definition.NaturalXDirection = True
	oDef.Features.RectangularPatternFeatures("Rectangular Pattern2").Definition.NaturalXDirection = True
	oDef.Features.RectangularPatternFeatures("Rectangular Pattern3").Definition.NaturalXDirection = True
		Else 
			oDef.Features.RectangularPatternFeatures("Rectangular Pattern1").Definition.NaturalXDirection = False
			oDef.Features.RectangularPatternFeatures("Rectangular Pattern2").Definition.NaturalXDirection = False
			oDef.Features.RectangularPatternFeatures("Rectangular Pattern3").Definition.NaturalXDirection = False

	End If
&lt;/PRE&gt;
&lt;P&gt;Subsequently, I have rules in place to suppress the rectangular patterns within the part.&amp;nbsp; When the code given above is ran while the patterns are suppressed Inventor immediately crashes, losing all work.&amp;nbsp; I would like to add a try/catch to check the suppression of the patterns before the change in direction takes place, but am having trouble finding an answer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm assuming something like this will work, but have not had any luck:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Try
	oDef.Features.RectangularPatternFeatures("Rectangular Pattern1").GetSuppressionCondition

	Catch
	MessageBox.Show("Make pattern active before executing change.", "Error")
	End Try
&lt;/PRE&gt;
&lt;P&gt;How can I check that the rectangular pattern is active before changing the direction of the pattern?&amp;nbsp; Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2019 18:47:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/check-feature-suppression/m-p/8666756#M77731</guid>
      <dc:creator>jfenter</dc:creator>
      <dc:date>2019-03-18T18:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: Check Feature Suppression</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/check-feature-suppression/m-p/8668000#M77732</link>
      <description>&lt;P&gt;You could just set it to active if its not already like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN style="color: #ff0000;"&gt;If&lt;/SPAN&gt; &lt;SPAN style="color: #800080;"&gt;Feature&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"Rectangular Pattern1"&lt;/SPAN&gt;) = &lt;SPAN style="color: #ff0000;"&gt;False&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;Then&lt;/SPAN&gt; &lt;SPAN style="color: #800080;"&gt;Feature&lt;/SPAN&gt;.&lt;SPAN style="color: #800080;"&gt;IsActive&lt;/SPAN&gt;(&lt;SPAN style="color: #008080;"&gt;"Rectangular Pattern1"&lt;/SPAN&gt;) = &lt;SPAN style="color: #ff0000;"&gt;True&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;Would that work for you? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2019 09:45:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/check-feature-suppression/m-p/8668000#M77732</guid>
      <dc:creator>JhoelForshav</dc:creator>
      <dc:date>2019-03-19T09:45:09Z</dc:date>
    </item>
  </channel>
</rss>

