![]() ![]() If the variable has not been defined yet or has no value, then a value of nil is returned.Īt the Command prompt, enter (setq dRadius 1.25).ĪutoLISP creates a user-defined variable named dRadius and assigns it the value of 1.25. Working with AutoLISP Expressions at the AutoCAD Command PromptĪutoLISP returns the value stored in the dRadius user-defined variable. The value returned by the strcat function is then passed to the alert function and displayed in a message box. The strcat function combines all the strings into a single string value. (alert (strcat "Welcome " "to " "AutoLISP!")) The value provided is then passed to the setq function and assigned to the nDist user-defined variable. The getreal function prompts the user for a real numeric value. The following are other examples of nested expressions: (setq nDist (getreal "\nEnter a distance: ")) After the two numbers are added together, AutoLISP returns a final value of 1.76. AutoLISP then evaluates the outer expression as (+ 0.01 1.75). The two numbers are multiplied together, and the * (product or multiplication) function returns a value of 1.75. In this example, the innermost expression (* 2 0.875) is evaluated first. The following is an example of a nested mathematical expression in AutoLISP: (+ 0.01 (* 2 0.875)) ![]() The evaluation process of AutoLISP expressions is similar to the order of operations in mathematics. When expressions are nested, they are always evaluated from the innermost expression to the outermost. ![]() AutoLISP expressions can be nested inside of each other. The following are some examples of AutoLISP expressions:Īs an AutoLISP program grows in complexity, so will the expressions that you create. The ! (exclamation point) character can only be used at the AutoCAD Command prompt and is used to return the current value of an AutoLISP variable. In addition to an AutoLISP expression starting with a ( (open parenthesis), an expression can also start with the ! character. Most function topics also include example code to help you get started with that function.Īt first glance, the syntax used by AutoLISP expressions in a program can be intimidating but with a little bit of practice and time you will get used to it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |