PDA

View Full Version : Diesel command in AutoLisp



David Bethel
2nd May 2004, 02:04 pm
Here's a bit of code that makes using Diesel expressions easier in a plain AutoLisp routine:

Predefine the main call:


(defun Diesel (c) (menucmd (strcat "M=" c)))


Now you can call edtime:



(prin1

(Diesel "$(edtime,$(getvar,date),MON\"-\"DD\"-\"YYYY HH\":\"MM\":\"SSam/pm)")
)


Here's a little diity for testing the speed of a call:


(defun c:timetest (/ st ft)

;| Set Any Variables Here |;
(setq st (getvar "DATE"))

;;; Preform all tests in this section

(repeat 100 ;|Vary repeat parameter with complexity of test call|;

(command "_.ZOOM" "_C" "" "")

);End Repeat

;| Have all functions tested ended by here |;

(setq ft (getvar "DATE"))
(setvar "USERR1" (- ft st))
(princ (diesel (strcat "$(edtime,$(getvar,userr1),MM\":\"SS\".\"MSEC)")))
(princ 1))



-David