Ðề: Visual Lisp
Tặng đồng chí nhé viết làm gì cho mệt óc thử xem có ra gì khổng
(Defun c:aer ()
(setvar "cmdecho" 0)
(command "osnap" "none")
(setq tl (getreal "\n Scale for Drawing : "))
(setq r 50 )
(repeat r
(setq pt (getpoint "\n Pick point : "))
(setq am (* tl tl))
(setq s 0)
(progn
(while pt
(setq entold (cdr (assoc 5 (entget (entlast)))))
(command "boundary" pt "")
(setq entnew (cdr (assoc 5 (entget (entlast)))))
(if (/= entold entnew)
(progn
(setq entnew (entget (entlast)))
(if (assoc 62 entnew)
(setq
entnew (subst (cons 62 (+ 3 (cdr (assoc 62 entnew))))
(assoc 62 entnew)
entnew
)
)
(setq entnew
(append
entnew
(list
(cons
62
(+ 3
(cdr
(assoc 62
(tblsearch "layer"
(cdr (assoc 8 entnew))
)
)
)
)
)
)
)
)
)
(entmod entnew)
(Command "area" "o" (entlast))
(setq s (+ s (getvar "area")))
(setq pt (getpoint "\n Pick point: "))
(entdel (entlast))
)
(progn
(princ "Error Wrong Point")
(setq pt (getpoint "\n Pick point: "))
)
)
)
)
(setq pt1 (getpoint "\nPick any point to draw area : "))
(setq dt (/ (* s am) 1000000))
(setq dt (strcat (rtos dt 2 2) " m²."))
(Setq ldt (Getstring t "\n Kind of area : "))
(cond
((= ldt "dx") (setq ldt "SÐáxây="))
((= ldt "bt") (setq ldt "SBêtông="))
((= ldt "d" ) (setq ldt "SÐào="))
((= ldt "dd") (setq ldt "SÐ?p="))
((= ldt "ph") (setq ldt "SP.hoá="))
((= ldt "ck") (setq ldt "SC.khay="))
((= ldt "dl") (setq ldt "SDam l?c="))
((= ldt "cl") (setq ldt "SCát l?c="))
((= ldt "tc") (setq ldt "SÐàoTC="))
((= ldt "tcc") (setq ldt "SÐ?p TC="))
((= ldt "lk") (setq ldt "SÐálkhan= "))
((= ldt "cp") (setq ldt "SC.ph?i= "))
((= ldt "dm") (setq ldt "Fdm = "))
)
(command "text" pt1 3.0 0 (strcat ldt dt))
(ALERT (strcat "\t\t
DiÖn tÝch = " dt))
))
Nguyên văn bởi HOÀNG TRUNG HẬU-00X3C
(Defun c:aer ()
(setvar "cmdecho" 0)
(command "osnap" "none")
(setq tl (getreal "\n Scale for Drawing : "))
(setq r 50 )
(repeat r
(setq pt (getpoint "\n Pick point : "))
(setq am (* tl tl))
(setq s 0)
(progn
(while pt
(setq entold (cdr (assoc 5 (entget (entlast)))))
(command "boundary" pt "")
(setq entnew (cdr (assoc 5 (entget (entlast)))))
(if (/= entold entnew)
(progn
(setq entnew (entget (entlast)))
(if (assoc 62 entnew)
(setq
entnew (subst (cons 62 (+ 3 (cdr (assoc 62 entnew))))
(assoc 62 entnew)
entnew
)
)
(setq entnew
(append
entnew
(list
(cons
62
(+ 3
(cdr
(assoc 62
(tblsearch "layer"
(cdr (assoc 8 entnew))
)
)
)
)
)
)
)
)
)
(entmod entnew)
(Command "area" "o" (entlast))
(setq s (+ s (getvar "area")))
(setq pt (getpoint "\n Pick point: "))
(entdel (entlast))
)
(progn
(princ "Error Wrong Point")
(setq pt (getpoint "\n Pick point: "))
)
)
)
)
(setq pt1 (getpoint "\nPick any point to draw area : "))
(setq dt (/ (* s am) 1000000))
(setq dt (strcat (rtos dt 2 2) " m²."))
(Setq ldt (Getstring t "\n Kind of area : "))
(cond
((= ldt "dx") (setq ldt "SÐáxây="))
((= ldt "bt") (setq ldt "SBêtông="))
((= ldt "d" ) (setq ldt "SÐào="))
((= ldt "dd") (setq ldt "SÐ?p="))
((= ldt "ph") (setq ldt "SP.hoá="))
((= ldt "ck") (setq ldt "SC.khay="))
((= ldt "dl") (setq ldt "SDam l?c="))
((= ldt "cl") (setq ldt "SCát l?c="))
((= ldt "tc") (setq ldt "SÐàoTC="))
((= ldt "tcc") (setq ldt "SÐ?p TC="))
((= ldt "lk") (setq ldt "SÐálkhan= "))
((= ldt "cp") (setq ldt "SC.ph?i= "))
((= ldt "dm") (setq ldt "Fdm = "))
)
(command "text" pt1 3.0 0 (strcat ldt dt))
(ALERT (strcat "\t\t
DiÖn tÝch = " dt))
))
Ghi chú