Editor’s Note: This blog is based on a PTC Mathcad Prime 10 worksheet. Download the accompanying Radio Button worksheet here. If you do not have a Mathcad Prime 10 worksheet viewer, download our free 30-day trial here.
In modern engineering calculations and design workflows, user interface elements play a crucial role in ensuring efficiency, accuracy, and ease of use. One such versatile element is the radio button, which allows users to select one option from a predefined set. This blog post delves into the application of radio buttons within a Mathcad Prime worksheet, illustrating their uses, benefits, and functionalities through a practical scenario.
To create a radio button in Mathcad Prime 10:
The default radio button script includes four main events:
The script can be written in either JScript or VBScript. However, please note that VBScript will be deprecated in a future Mathcad Prime release. Therefore, all the scripting in this worksheet has been implemented using JScript.
By understanding and utilizing these events, user can create a highly interactive and user-friendly interface in Mathcad Prime worksheets, ensuring that all user selections are accurately processed and reflected in real-time calculations.
Attached at the top of this article is the worksheet designed to calculate various mechanical properties related to screws or bolts. The interface includes several radio buttons, sliders, and text boxes, each serving a specific purpose. This scenario will highlight how these elements can be configured to streamline the user's workflow. You may also watch the embedded video about this same worksheet to follow along.
Step 0 is enclosed in an area where you can choose the alignment (left to right) and orientation (horizontal or vertical) of the rest of step 1 and step 2’s radio buttons.
This radio button serves the purpose of selecting from two conditions, labelled Condition 1 and Condition 2. Based on the selection of the first radio button, it will change available selections of the second radio button.
Various features have been utilized for this radio button. See below for a list:
Methods | Formatting properties | State Properties |
---|---|---|
AddButton | LeftText | ButtonID |
SelectedButton | Orientation |
As part of Step 1, this slider allows the user to fine-tune the applied force. This real-time adjustment capability helps in dynamically seeing the effect of varying forces on the calculations.
Another slider to vary the coefficient of friction, providing immediate feedback on how friction influences the mechanical properties being calculated.
This radio button will change as per your condition selection from step 1. In this step, you must choose the term you want to calculate the value for, simplifying the decision-making process.
Condition 1 will showcase the two options Calculate Tangential Force and Calculate Torque, wherein Condition 2 will show the options Thread Angle or Thread are self-lock or not.
This is achieved by linking the first radio button to other. You need to pass the variable as an input to the other radio button.
Depending on the selected condition, the worksheet will present further options to either compute the tangential force or torque, thus guiding the user through a focused and relevant set of inputs.
Notice how the possible selections in Step 2's radio button change depending on which option is picked in Step 1's radio button.
The left side of the controls is hidden in the above screenshot, and this can be done by going to the Input / Output tab, navigating to the Controls group, and clicking on Hide Left Side.
Here are the features utilized to construct the Step 2 Radio Button:
Methods | Formatting properties | Events |
---|---|---|
AddButton | LeftText | SelectionChange |
SelectedButton | Orientation | |
ResetContent |
This set of options allows users to specify the type of thread, which is crucial for accurate mechanical property calculations. It has utilized State Properties i.e. Button ID through which user can manipulate the output of the selection apart from 1, 2, 3, etc. to the desired values. This radio button has three selection options with different values which will be utilized later in calculations. This radio button is set to the variable "l".
Identifying what type of operation needs to be performed on bolt; this selection determines the operational context, as the forces and torques involved in tightening versus loosening can differ significantly.
This option lets users specify the thread count of the bolt, namely whether it is single-, double-, or triple-threaded. This is directly dependent on step 3 (thread type), and the value will vary with the type of bolt being selected, affecting the calculation. “l”, the output of third radio button, is utilized as input. The operation of multiplication is carried out within script and will be updated as per the selection.
Users can add a different desired size of bolt that will be dynamically added to the following radio button in STEP 6.1. To achieve this, create a text box advanced control and use it as input to the following radio button with Methods as ResetContent, AddButton, and GetText.
This radio button is linked with Step 6's text box where users can input a custom bolt size. It provides a predefined list of sizes and allows for custom entries, enhancing flexibility while displaying that multiple objects can be linked with ease. You can add M20 dynamically by entering it from the text box, displaying it in the radio button and allowing it to be readily chosen for further calculations. M10, M12, M16 are pre-built entries in this radio button.
Methods | Events |
---|---|
AddButton | Click |
GetText | |
ResetContent |
With a change in selection of any radio button; all permutations and combinations have been considered in the final Mathcad program which will take any change in selection and update the result accordingly.
Left side selections: Condition 1 ➜ 1750 Tensile & 0.35 Co-efficient of Friction ➜ Torque (T) ➜ Super Fine ➜ Double ➜ Loosened ➜ M10 ➜ -2535.562
Right side selections: Condition 2 ➜ 1500 Tensile & 0.25 Co-efficient of Friction ➜ Thread Angle ➜ Coarse ➜ Triple ➜ Tightened ➜ M20 ➜ 0.095
Simplicity and Clarity: Radio buttons offer a clear and straightforward way to present mutually exclusive options, reducing user confusion and errors.
Streamlined Workflow: By guiding users through a step-by-step selection process, radio buttons ensure that all necessary inputs are gathered before calculations begin.
Dynamic Interactivity: Changes in selections immediately update the results, providing real-time feedback and allowing users to explore different scenarios effortlessly.
Customization: The combination of radio buttons with other elements like sliders and text boxes allows for a highly customizable and user-friendly interface.
Radio buttons, when used effectively, can significantly enhance the usability of engineering tools in Mathcad Prime. By structuring the user interface to guide inputs and provide dynamic feedback, they make complex calculations more accessible and intuitive. This scenario demonstrates the power of well-designed interactive elements in creating efficient and user-friendly computational tools.
Incorporating radio buttons and other interactive elements in worksheets can transform how users interact with calculations, leading to more faster results and a more enjoyable user experience. Try implementing these elements in your next Mathcad Prime project and experience the benefits firsthand!
If you’re interested in learning more about the Advanced Control Radio Button Class, Radio Button Format Properties, Radio Button Methods, Radio Button Events, and Radio Button State Properties, then you may consult the Help documentation provided online and also inside the software.
Learn more about use cases for all of the Advanced Controls by attending our free, on-demand training event: the Advanced Controls Crash Course!