Tech Tip: Multi-Value Parameters and Select Case Logic


Multi-Value parameters paired with a simple select case in an iLogic rule can be a very powerful tool for simple configurations inside parts. Below are steps to switch from different shapes of holes at a click of a button. This can be expanded upon to create more complex and adaptive parts.

Step 1

The first step is to make a multi-value parameter.  Simply make a user parameter (in this case a text parameter), right click and select “Make Multi-Value”. This will launch a dialog where you can add all the values you want selectable in your multi-value parameter then click the add button to add them.

Step 2

With your Multi-Value parameters set up you can now change which value is selected.  Now to use this parameter, make some features in your part and then suppress them.  Below we’ll write some very simple code to unsuppress one of them based on your multi-value selection.

Step 3

This code is what is called a select case.  It checks one parameter’s value and runs some code based on that value.  Here we are just looking at the value of HoleType and then setting features as active or inactive.  You’ll want to name your features that will be suppressed or unsuppressed so that you can refer to them easily here.

Select Case HoleType
Case "Circle"

Feature.IsActive("CircleHoles") = True
Feature.IsActive("SquareHoles") = False
Feature.IsActive("TriangleHoles") = False

Case "Square"

Feature.IsActive("CircleHoles") = False
Feature.IsActive("SquareHoles") = True
Feature.IsActive("TriangleHoles") = False

Case "Triangle"

Feature.IsActive("SquareHoles") = False
Feature.IsActive("CircleHoles") = False
Feature.IsActive("TriangleHoles") = True

End Select

In Conclusion

With that done, you can switch between your multi-value parameter’s values and see your model switch between your designs.

Check out my latest Autodesk Virtual Academy session, Get Started with Visual Studio and Inventor API for more tricks and tips! 

Leave a Reply

Your email address will not be published. Required fields are marked *

Check out more posts from KETIV

A Marketing Intern’s Experience at KETIV
My name is Zoe Walschots and in May 2022, I started as a Marketing Intern at KETIV. At the end of my summer, I wrote an article describing my experience in this position so far. Now that I have finished my year with KETIV, I wanted to revisit my experiences and elaborate on all the […]
5 Ways to Boost SOLIDWORKS® Outcomes with Quote, CAD, and BOM Automation
Why Automation for SOLIDWORKS? Configuring and customizing complex products can be time-consuming and error-prone. But with the right tools, you can streamline your SOLIDWORKS® workflows, improve accuracy, and create better and more numerous designs in less time. 1. Supercharge Your Designs Rule-based configuration, automated parts lists, 3D visualization, and CAD file generation can make a […]