Check Feature Suppression

Check Feature Suppression

jfenter
Enthusiast Enthusiast
369 Views
1 Reply
Message 1 of 2

Check Feature Suppression

jfenter
Enthusiast
Enthusiast

I have an iLogic code to change the direction of a rectangular pattern as shown here:

 

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

Subsequently, I have rules in place to suppress the rectangular patterns within the part.  When the code given above is ran while the patterns are suppressed Inventor immediately crashes, losing all work.  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.

 

I'm assuming something like this will work, but have not had any luck:

 

Try
	oDef.Features.RectangularPatternFeatures("Rectangular Pattern1").GetSuppressionCondition

	Catch
	MessageBox.Show("Make pattern active before executing change.", "Error")
	End Try

How can I check that the rectangular pattern is active before changing the direction of the pattern?  Thanks!

0 Likes
370 Views
1 Reply
Reply (1)
Message 2 of 2

JhoelForshav
Mentor
Mentor

You could just set it to active if its not already like this

 

If Feature.IsActive("Rectangular Pattern1") = False Then Feature.IsActive("Rectangular Pattern1") = True

Would that work for you? 🙂