Add calculator function to AutoCAD

Add calculator function to AutoCAD

When drawing with AutoCAD, it is often necessary to perform some necessary calculations. Although Autodesk provided a LISP program CALC.LSP that can be used for simple calculations with AutoCAD, the program was developed earlier and used under the COMMAND command. The interface is not intuitive and is not convenient to use. In this paper, through the study of the dialog box structure and AutoLISP in AutoCAD, a method of using the dialog box structure to implement the calculator function is proposed, and the program flow chart is also provided for your reference. This procedure has been applied to the actual work of our hospital.
1 Principles and methods AutoCAD dialog structure contains a variety of components, such as edit_box (edit box), text (text), button (button) and so on. Using these tools, a user-friendly utility can be developed. Figure 1 is implemented in this way. Arrange the numbers and various operation symbols in the calculator into 5 rows and 5 columns in the form of buttons, and display the calculation results in a dialog box as a text component to obtain the dialog box structure shown in Figure 1 (dialog box File # CAL.DCL). Finally, a driver program for displaying and completing various calculation functions in the dialog box can be prepared (driver program # CAL.LSP), and the program flowchart is shown in FIG. 2.
Various numerical calculation and variable conversion functions provided by AutoLISP are used in the # CAL.LSP program. It should be noted that during the debugging process, the author found that some functions have some special requirements on variables, which are now introduced as follows, to discuss with the reader:
1. In expt base power, the requirements for variables base (base) and power (power) are different from the power operation requirements in algebra. The requirements for variables base and power in algebra are as follows:
When base> 0, power can be any real number;
When base = 0, power must be greater than 0;
When base <0, power can be an integer, if it is a decimal or fraction, it is required that the denominator cannot be an even number when it is reduced to the simplest fraction.
However, when the variable base <0 in AutoLISP, power is only required to be an integer or a real number that is 0 after the decimal point, such as 2, -2.0, etc., otherwise you will get an error message or return an error result (depending on the power value and set). In addition, when the calculation result is too large and overflows, the FOR DOS version of AutoCAD will return 1.67e + 308, while the WINDOWS version will return 1.79769e + 308.
2. The sine and cosine functions (sin x) and (cos x) require that the variable x must be less than or equal to 9.223372e + 18 (of course, the number of decimal places can be extended), otherwise the correct result cannot be obtained. For example, when the variable is 9.223373e + 18, the FOR DOS version of AutoCAD returns NAN, while the WINDOWS version returns the variable value itself.
3. When using the function (rtos) to convert the data into a string, the author found that when the data is greater than 1e + 100 (that is, the 100th power of 10), the index 100 is automatically changed to 99. For example, after executing (rtos 6e + 100 2 6), you get "6.000000E + 99" instead of the expected "6.000000E + 100". Therefore, this procedure specifies that the maximum data cannot be greater than 1e + 99, otherwise an overflow error will be displayed. Of course, by compiling another conversion program, the maximum data can be increased to the maximum data that AutoCAD can accept (after testing, the maximum value can be 1.79769e + 308). Due to space limitations, this conversion function is no longer provided in this article, and the comrades in need can contact the author.
2 How to use the program Copy the program # CAL.LSP and dialog file # CAL.DCL to the directory that AutoCAD can find, and type (LOAD "#CAL") under the Command: command to load the program, just like other #CAL is also used for AutoCAD internal commands. You can also add the following line to the drop-down menu or on-screen menu part of the menu file used (such as ACAD.MNU): [calculator] ^ C ^ C ^ P (if (null c: #cal) (load " #cal ")) #cal Later you can drive the program directly from the menu.
The icons in the dialog box are similar to ordinary calculators, "C" means to clear, "M +" means to store the result, "MR" means to pop up the stored result, "sqrt" means to prescribe, "X ** y" means to ask power. When the input data is inappropriate or the calculation result overflows, an error message will be displayed in the dialog box.
This program has been debugged on AutoCAD R12.0 FOR DOS and FOR WINDOWS versions, but the graphics displayed in the WINDOWS version are slightly different from Figure 1.

ZGAR GenkiIppai Pods 5.0

ZGAR GenkiIppai Pods 5.0

ZGAR electronic cigarette uses high-tech R&D, food grade disposable pod device and high-quality raw material. All package designs are Original IP. Our designer team is from Hong Kong. We have very high requirements for product quality, flavors taste and packaging design. The E-liquid is imported, materials are food grade, and assembly plant is medical-grade dust-free workshops.

From production to packaging, the whole system of tracking, efficient and orderly process, achieving daily efficient output. WEIKA pays attention to the details of each process control. The first class dust-free production workshop has passed the GMP food and drug production standard certification, ensuring quality and safety. We choose the products with a traceability system, which can not only effectively track and trace all kinds of data, but also ensure good product quality.



We offer best price, high quality Pods, Pods Touch Screen, Empty Pod System, Pod Vape, Disposable Pod device, E-cigar, Vape Pods to all over the world.

Much Better Vaping Experience!



ZGAR GenkiIppai 5.0 Pods,ZGAR GenkiIppai Pods 5.0,ZGAR GenkiIppai Pods 5.0 Pod System Vape,ZGAR GenkiIppai Pods 5.0 Disposable Pod Vape Systems, Japanese culture style

ZGAR INTERNATIONAL(HK)CO., LIMITED , https://www.oemvape-pen.com