Suppress feature if it has no effect instead of using equations.

Suppress feature if it has no effect instead of using equations.

Brian.Price
Advocate Advocate
1,404 Views
5 Replies
Message 1 of 6

Suppress feature if it has no effect instead of using equations.

Brian.Price
Advocate
Advocate

I read another post on this topic but I don't believe it is what I am looking for. https://forums.autodesk.com/t5/inventor-customization/supress-if-no-effect/td-p/5612616

 

I have two cylinders made from a contour flange feature. These two halves make up a complete cylinder and share identical parameters.

 

Currently I use the cut normal features to put holes in the cylinder using height, degrees, hole size. The parameters are fed from the main assembly so there are multiple cylinders stacked on top of one another. The holes vary in height and some cylinder's will have a hole and others won't. These holes are already modeled in the cylinder and are turned off and on depending on if the equations says the hole is in the range of the cylinders model height.

 

Because these two cylinders are halves of a hole the hole may only go in one side and not the other. I can make a rule that uses the degrees in an equation for the cylinder half to turn it off and on depending on the input.

 

After looking around I think it would be much more simpler to just turn the features off and on depending if they have an effect.

 

This is all being used to make a template that can generate multiple assemblies and models depending on the inputs.

 

1. How can I turn a feature on and off (cut normal) depending on whether or not it has an effect?

0 Likes
Accepted solutions (2)
1,405 Views
5 Replies
Replies (5)
Message 2 of 6

johnsonshiue
Community Manager
Community Manager

Hi Brian,

 

I am not sure if you are aware of the conditional suppression available in feature properties (right-click on a feature -> Properties -> select a parameter and set the condition to suppress). Would it work?

Many thanks!

 



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
Message 3 of 6

Brian.Price
Advocate
Advocate

Wow to be honest no I didn't know that was available, thanks for that, always learning something new. However no it won't help as the rules I am using for suppression currently do the same thing but with more parameters. I have to use a couple equations to generate a range that the feature is able to be active in.

 

I am looking for a simple rule that says:

If this feature has no effect = suppress feature

if this feature has an effect = activate feature

0 Likes
Message 4 of 6

MechMachineMan
Advisor
Advisor
Accepted solution

Something like this might work:

 

Sub Main()
	Dim oDoc As Document
	oDoc = ThisDoc.Document
	
	For Each oFeature In oDoc.ComponentDefinition.Features
		oFeature.Suppressed = False
	Next
	
	For Each oFeature In oDoc.ComponentDefinition.Features
		If oFeature.RangeBox Is Nothing Then
			oFeature.Suppressed = True
		End If
	Next
End Sub

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 5 of 6

Brian.Price
Advocate
Advocate
Accepted solution

That worked really well, Thanks.

0 Likes
Message 6 of 6

Brian.Price
Advocate
Advocate

Had an issue, figured it out.

0 Likes