Hello,
A few improvments to the demo lsp files
gear.lsp
(defun c:gear(/ R cp np t h a0 aoff tmpecho)
(setq tmpecho (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq cp (getpoint "Specify gear center: ")
R (getdist "Specify radius: ")
t (getint "Enter number of teeths: ")
h (getdist "Specify teeth height: ")
)
(command "circle" cp R)
(setq R (+ R h ))
(command "circle" cp R)
(setq R (+ R (* 2 h)))
(print R)
(setq aoff (/ (* pi 2) t)
a0 0
np (polar cp a0 R)
)
(print np)
(repeat t
(command "pline" cp np "")
(setq a0 (+ a0 aoff)
np (polar cp a0 R)
)
(print "")
)
(setvar "cmdecho" tmpecho)
(princ)
)
(princ "Gear.lsp by Mirza Coralic. Type GEAR to start.")
cmdecho seems not to be supported really.
DrawExtent.lsp
(defun c:drawextent(/ en ext)
(setq en (car (entsel))
ext (bc-entext en)
)
(command "rectangle" (list (car ext) (cadr ext)) (list (nth 2 ext)(nth 3 ext)))
(print "Entity extent: ")
(princ ext)
(princ)
)
(princ "DrawExtent.lsp by Mirza Coralic. Type DRAWEXTENT to start.")
chcolor.lsp
(defun c:chcolor (/ colr ss en ind)
(setq colr (getint "Enter color index number (0-255): ")
ss (ssget)
ind 0
)
(while (setq en (entget (ssname ss ind)))
(setq en (append en (list (cons 62 colr))))
(entmod en)
(setq ind (+ ind 1))
)
(princ)
)
(princ "chcolor.lsp by Mirza Coralic. Type chcolor to start.")
Joining multiple setq to one should increase performance.