Ilogic feature counting

Ilogic feature counting

tim.kindtKA284
Participant Participant
1,230 Views
2 Replies
Message 1 of 3

Ilogic feature counting

tim.kindtKA284
Participant
Participant

Hey all,
I have a template of a part that I need to use a lot in my assemblies.
This template part only contains 1 extrude feature. (it's basically a wooden panel)

From time to time I need to add some modifications to the part. (a cutout, a hole, ...)

I would like to know if there is a way to set a custom property from "NO" to "YES" if I add extra features to the part.
The type of modifications differ greatly so having premade features suppressed is harldy an option.

So to break it down:
If the part contains 1 feature: Value is "NO"
If the part contains more than 1 features: Value is "YES"

Thanks in advance.

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

jtylerbc
Mentor
Mentor
Accepted solution

Yes, that is possible.  I have something similar included as part of some rules I already have.  Note that I hacked this very quickly out of an existing rule I had, so it may not be perfect as-is.  Should be enough to help get you started though.

 

' If a feature is Active (not suppressed), it is added the FeatureList array
For Each oFeature In oDoc.ComponentDefinition.Features
	If Feature.IsActive(oFeature.Name) Then
		FeatureList.Add(oFeature.Name)

	End If
Next


' Count the number of items in the FeatureList array
FeatureCount = FeatureList.count


' If more than one feature is detected, the "SPECIAL" custom iProperty will be filled out as "YES".
'Otherwise it will be changed to "NO", to indicate that it is the standard version of the part.

If FeatureCount > 1 Then
	iProperties.Value("Custom", "SPECIAL") = "YES"
	
Else
	iProperties.Value("Custom", "SPECIAL") = "NO"	
	
End If
Message 3 of 3

tim.kindtKA284
Participant
Participant

Great!

That looks like it'll do the trick, i'll have a go at that.
Thanks

0 Likes