Written By Dave Martin
• 5/18/2022
• Read Time : 2 min.

# Four Uses for Combo Boxes

In PTC Mathcad Prime, a Combo Box is a control that allows you to define multiple potential values for variables. The user can select which group of values to use, updating subsequent calculations with those selected values. Combo Boxes provide the user with control over allowable values for sets of variables to ensure the worksheet provides useful results.

Let’s look at how to set up a Combo Box and four use cases you should consider.

## How to Create a Combo Box

To start a new Combo Box, first create a vector in which each element is a variable that you want to be assigned a value based on a user’s selection. As an engineer, I have used Combo Boxes for setting up different materials I want to select. Therefore, my vector might contain variables for density, Young’s modulus, Poisson’s ratio, yield strength, ultimate tensile strength, and more.

Then use the Definition operator and the Combo Box tool from the Input/Output tab to set that vector as being driven by a table of values.

In the upper left cell, you will define the group name for the potential choices. In this case, I will call it “Material.” The left cell of each row will contain the name of the material, such as steel, aluminum, titanium, magnesium, and ABS (a common 3D printing polymer).

The top row can contain optional units for the corresponding element in the vector. For example, density could be in grams per cubic centimeter, whereas Poisson’s ratio is unitless.

Then fill in the values for each of the elements in the Combo Box. When finished editing, the Combo Box becomes a drop-down list for the potential choices. After picking a choice from the drop-down list, the variables in the input vector take on the values of the choice from the Combo Box.

## Uses for Combo Boxes

Here are four uses for Combo Boxes that can deepen the flexibility of your worksheets:

Materials. As in the example above, my biggest use case for Combo Boxes is material selection in engineering calculations.

Inputs for functions and programs. Often when performing calculations, we want to limit inputs for functions and programs to pre-defined values, which subsequent users of the worksheet may be unaware of. For example, engines may be available in specific settings for volumetric displacement, number of cylinders, or speed (revolutions per minute). Financial worksheets might have a limited number of interest rates or periods.

Modeling complex systems. We had a Mathcad Community challenge on creating worksheets for planetary gear systems. These are found everywhere from rotary pencil sharpeners to automatic transmissions, anywhere you need high transmission ratios in a small space and low weight. Planetary gear systems can result in different motions like reduction, overdrive, reversal, and more, depending on which part of the gear system (sun, planet carrier, or ring) are used as the input, output, or stationary element. You can use Combo Boxes for setting up different pre-defined configurations of this complex mechanism for calculation of gear ratios and sizing of components.

Driving CAD geometry. Creo Parametric models can be driven by embedded Mathcad worksheets. People are always looking for ways to manage different geometry configurations without Family Tables, Notebooks, or Pro/Program. A Combo Box can contain pre-defined part model dimension combinations. Combo Boxes can also drive assemblies via the special PTC_CONSTRAINT_SET parameter. A Mathcad worksheet with a Combo Box can avoid data management issues, information inadvertently obscured from users, and programming errors.

## Latest Enhancements

Mathcad Prime 8 added the ability to copy and paste multiple values from a matrix into a Combo Box, increasing your ability to leverage data from existing worksheets into this functionality. Is there anything you would like to see added to Combo Boxes or other areas in Mathcad? If so, submit your idea to PTC Community.