06-04-2020
04:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
06-04-2020
04:00 AM
Hi @amarcoc
Thank you. Now I see the problem.
Try this as the first rule ![]()
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.
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website