Tuesday, January 17, 2012

Area Calculate and Writing AutoLisp

AutoCAD AutoLisp.
Calculate the area and write any where in drawing by just 1 click.
Procedure:

Copy highlighted
(defun c:Q()
(COMMAND "ORTHO" "OFF")
(COMMAND "F3")
(setq d1 (getpoint "\nClick inside the object"))
(COMMAND "-boundary" d1 "")
(COMMAND "area" "o" "l" "")
(setq p2 (getpoint "\npoint1"))
(setq str (getvar "area"))
(setq str2 (rtos str 2 3))
(command "text" "M" p2 ".25" "0" str2)
)
(COMMAND "OSNAP" "ON")


Open Notepad --> paste into notepad --> File --> Saveas --> Qty.lsp (in the file type, select All Files)
From Autocad --> Tools --> Load Application --> select this file --> Close

Tip: if required this application in every drawing, contents --> Add --> Select file --> Add -- Close --> Close.

At Autocad command line
q--> click inside the object --> than click where like to write calculated area. ok

No comments:

Post a Comment