ilogic to count features without including those that are below end of part.

ilogic to count features without including those that are below end of part.

Anonymous
Not applicable
1,105 Views
2 Replies
Message 1 of 3

ilogic to count features without including those that are below end of part.

Anonymous
Not applicable

The following snippit of iLogic code will count the number of features in a part that are active (not suppressed).  I'm wondering how to tweak it so that it doesn't include features that are below the end of part mark.

 

SyntaxEditor Code Snippet

' This looks at the number of features in the part' It then sets a shared variable "Feature_Count" equal to the number of features found

Dim openDoc As Document
openDoc = ThisDoc.Document
Dim FeatureList As New ArrayList

' If a feature is Active (not suppressed), it is added the FeatureList array
For Each oFeature In openDoc.ComponentDefinition.Features
    If Feature.IsActive(oFeature.Name) Then    
    FeatureList.add(oFeature.Name)
    End If
Next
' Count the number of items in the FeatureList array
SharedVariable("Feature_Count") = FeatureList.count

 

0 Likes
Accepted solutions (1)
1,106 Views
2 Replies
Replies (2)
Message 2 of 3

Mike.Wohletz
Collaborator
Collaborator
Accepted solution

I think this is what you are looking to do!

 

' This looks at the number of features in the part' It then sets a shared variable "Feature_Count" equal to the number of features found
Dim FeatureList As New ArrayList

    For Each oFeature As PartFeature In ThisDoc.Document.ComponentDefinition.Features
        If Not oFeature.HealthStatus = HealthStatusEnum.kBeyondStopNodeHealth And Not oFeature.Suppressed = True  Then
                FeatureList.Add(oFeature.Name)
            End If
			
        Next

SharedVariable("Feature_Count") = FeatureList.count
Message 3 of 3

Anonymous
Not applicable

That works great.  Thanks!

0 Likes