About This File
Hi guys,
Here I present a program that allows you to perform a mathematical operation between a list of numbers parsed from a string, and a user-input number. This program references two different other LISP authors (Lee Mac with "Parse Numbers" and Alan H with "MultipleToggles.lsp") for their great contribution to the community, and I thought it'd be splendid to see how their programs blossom very well in this program. However, I tweaked both functions slightly in order to suit the needs of this program.
Upon invoking the TOP command, the user is prompted for a single object selection. It can be anything that has an editable Text property (except blocks). Using Lee's Parse Numbers, it parses numbers found within that string. These list of numbers are then passed onto the MultipleToggles.lsp dialog by Alan H to prompt for the numbers the user wishes to include for calculation. This process is repeated until the user is satisfied and presses Enter or types "End".
The user is then prompted the operation to perform. I've included 7 operations (built-in AutoLISP functions): Add (+), Subtract (-), Multiply (*), Divide (/), Exponential (expt), Minimum (min), and Maximum (max). After the user selects the logical operation to perform, the user is then prompted for a second number associated with this operation. The program will proceed to evaluate every number that is checked and performs the operation. The original object will then be modified with the new result.
If you are familiar with how to use AutoLISP and defining functions, you can create your own user-defined functions to perform your own logical operation. For example, you can replace the numbers with another, or round down the numbers to some multiple.
I welcome all feedback, criticisms, opinions, and insults that you have and I'll have a look at them. Enjoy.
Recommended Comments
There are no comments to display.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.