Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
JhoelForshav
in reply to: amarcoc

Hi @amarcoc 

Thank you. Now I see the problem.

Try this as the first rule :slightly_smiling_face:

Dim oDoc As PartDocument = ThisDoc.Document
Dim oSuppress As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
For Each oFeature As PartFeature In oDoc.ComponentDefinition.Features
	If oFeature.Name.Contains("DXF") = False Then
		Dim oAttributeSet As AttributeSet
		Dim oAttribute As Inventor.Attribute
		If oFeature.AttributeSets.NameIsUsed("SuppressedInfo")
			oAttributeSet = oFeature.AttributeSets.Item("SuppressedInfo")
			Try
				oAttribute = oAttributeSet.Item("Suppressed")
				oAttribute.Value = If (oFeature.Suppressed, "True", "False")
			Catch
				oAttribute = oAttributeSet.Add("Suppressed", ValueTypeEnum.kStringType, If (oFeature.Suppressed, "True", "False"))
			End Try
		Else
			oAttributeSet = oFeature.AttributeSets.Add("SuppressedInfo")
			oAttribute = oAttributeSet.Add("Suppressed", ValueTypeEnum.kStringType, If (oFeature.Suppressed, "True", "False"))
		End If
		If oFeature.Suppressed = False Then oSuppress.Add(oFeature)
	End If
Next
oDoc.ComponentDefinition.SuppressFeatures(oSuppress)

The thing is that because of relationships. Suppressing one feature resulted in another feature being suppressed before the code had the chance to check it. Therefore the attribute was set to suppressed.