从基于 AutoCAD 2017 的产品开始,CDATE 和 DATE 系统变量返回的时间不再包括毫秒。如果需要计算小于一秒的时间差,将需要使用 MILLISECS。
- ; Returns a CDATE value that includes milliseconds based on release
- ; Usage: (CDate)
- ; Replaces (rtos (getvar "CDATE") 2 8)
- (defun CDate ( / ms)
- ; Check to see which AutoCAD release is being used
- (if (<= (atof (getvar "ACADVER")) 22.0)
- (rtos (getvar "CDATE") 2 8)
- (progn
- ; Get the current milliseconds and append it to the CDATE value
- (setq ms (itoa (getvar "MILLISECS")))
- (strcat (rtos (getvar "CDATE") 2 6)(substr ms (- (strlen ms) 2)))
- )
- )
- )
AutoCAD 2019 帮助 关于 AutoLISP 兼容性 |