Here’s another great example of how it’s easier to use DriveWorks to automate SolidWorks than to write your own Visual Basic or similar programming code: Measurement Text Box Controls. This special form element, found only in DriveWorks, allows you to capture a value from the user in his or her choice of feet, inches, meters, or millimeters. The user can input the value in the preferred type of units, and DriveWorks automatically converts it into the type of units used for the Project rules.
Without such a handy form element, you would either have to force your users into a single choice for units (most likely), or write your own extra formulas and pull-down menus to process the unit options for every single input! (who has the time or patience for programming that?!)
Here’s how you add this special input type to your DriveWorks user forms:
1. Launch DriveWorks Administrator and open your Project.
2. Go to Form Design.
3. Click the “More…” icon that looks like a mailbox, and choose “Measurement Text Box”.
4. Place the control on the form as desired. You can adjust its caption, font, size, and so on just like a regular Numeric Text Box Control.
5. The magic is found in the “Behavior” section of the control’s properties. Here is where you decide the “Native Units” that will be returned by the control for use in your rules later on.
The “Display Units” and “Display Value” echo back what the user has selected and input in the form.
Then, for example, if you write your design rules based on inches, a user can easily input “150 mm” and the form control will return “5.90551181102362”, and your rules can easily check to see that it is less than 6 inches, without you having to code any other math! And even better, if the user changes his or her mind from “mm” to “m”, the form automatically updates the displayed value to be “0.15”. Just like inside SolidWorks itself!
Finally, just like a regular Numeric Text Box Control, you can enforce a Maximum and Minimum allowable value (in addition to DriveWorks validating the text as being numeric).