Suppress Feature if it has no effect

Suppress Feature if it has no effect

Josh_Hudson97
Advocate Advocate
226 Views
2 Replies
Message 1 of 3

Suppress Feature if it has no effect

Josh_Hudson97
Advocate
Advocate

Hi, I am after some code that will suppress a feature if it takes no effect after the rest of my logic has run....

 

I have a square box section post and users can choose to add drilling on each of the 4 face independently. If a user picks to have 3 drillings in a face then picks the opposite face to also have 3 drillings in I want to suppress any features that have no effect. i.e if Drilling positions are the same in opposite face suppress one of them.

 

I could do this long hand with logic, but hoping someone knows a way I could solve this with a few lines easily 😆

If I've helped you out drop the post a like, if I've given you a solution mark as solved. It's us, 'The community' that makes this place work 😄
0 Likes
Accepted solutions (1)
227 Views
2 Replies
Replies (2)
Message 2 of 3

FINET_Laurent
Advisor
Advisor
Accepted solution

Hi @Josh_Hudson97,

 

Here a part with an extrusion (Extrusion1) (removing material) which has no effect : 

FINET_Laurent_0-1695988346344.png

You could use the folowing code to suppress it : 

Dim doc As Inventor.PartDocument = ThisApplication.ActiveDocument
Dim pcd As Inventor.PartComponentDefinition = doc.ComponentDefinition

For Each f As Inventor.PartFeature In pcd.Features
	If f.HealthStatus = HealthStatusEnum.kDriverLostHealth Then f.Suppressed = True
		
Next

Does this suits your needs ?

 

Kind regards,

FINET L.

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

Message 3 of 3

Josh_Hudson97
Advocate
Advocate

Hi @FINET_Laurent,

 

Perfect thank you!

 

Funny enough I'd just found the solution on another post and was about to link it in here.

 

https://forums.autodesk.com/t5/inventor-forum/ilogic-to-detect-features-with-errors/td-p/6297950

If I've helped you out drop the post a like, if I've given you a solution mark as solved. It's us, 'The community' that makes this place work 😄