iLogic to check for features.

iLogic to check for features.

BDCollett
Advisor Advisor
308 Views
2 Replies
Message 1 of 3

iLogic to check for features.

BDCollett
Advisor
Advisor

Hi guys.

 

Can anyone help me with some code that would check a part and write a custom iProperty if any features exist or features > 1.

I have found samples that check for feature names but not if they just exist in general.

 

This would be for a derived part and I assume the derived part is counted as a feature as well?

 

Thank you

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

theo.bot
Collaborator
Collaborator
Accepted solution

You can find derived features as "referencedfeatures" in the the features collection. So if you just want a general check, you can do a simple check on based on the count value. here's a sample. in my case i created a true and false parameter called "check".

 

Dim oDoc As PartDocument
oDoc = ThisDoc.Document

Dim oComp As PartComponentDefinition
oComp = oDoc.ComponentDefinition

If oComp.Features.ReferenceFeatures.Count <> 0 Then
	Logger.Info("this part has derived solids or surfaces")
	check = True
Else
	Logger.Info("this part has no derived solids or surfaces")
	check = False
End If

The referenced features will only be available if you derive solids or surfaces from your other part. if you want to check if there is a derived part you could use this line: 

oComp.ReferenceComponents.DerivedPartComponents.Count

 

 

 

Message 3 of 3

BDCollett
Advisor
Advisor

Thanks for your effort on that Theo. I didn't really explain what I was after correctly but I did end up figuring out what was required. It was not to check for the derived feature, but to check if any additional features were added after it being derived (to tell it was no longer identical to the original)

0 Likes