rlx 发表于 2022-7-5 15:43:04

圣诞快乐,新年快乐

祝福大家!
 

; added rescaling to account for Santa's scroll wheel
(defun C:RLXmas (/ inp x- x+ y- y+ ip th x y mtrx mobj dx dy doc title body)
(vl-load-com)(defun *error* (m) (if mobj (vla-delete mobj))(redraw))
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
(alert "\nPress ok to start and any key or Esc to exit")
(setq title "Merry Christmas" body (list "And a happy new year" "\nGrtz RLX"))
(count_calcula)(create_message ip title th body 1 5)
(vla-Regen doc acActiveViewport)
(while (and (not (vl-catch-all-error-p (setq inp (vl-catch-all-apply 'grread (list t)))))
      (not (member (car inp) '(2 3 25))))
   (next_xy) (setq mtrx (vlax-tmatrix (list (list 1 0 0 dx) (list 0 1 0 dy) (list 0 0 1 0) (list 0 0 0 1))))
   (vla-TransformBy mobj mtrx) (vla-Regen doc acActiveViewport)
   (if (/= (getvar "VIEWSIZE") vs)(count_re-calcula) (wait 0.005) )
)
(if mobj (vla-delete mobj))
(vla-Regen doc acActiveViewport)
(princ)
)
(defun count_calcula ()
(setq vc (getvar "VIEWCTR") vs (getvar "VIEWSIZE") ss (getvar "SCREENSIZE") dx (* vs (/ (car ss) (cadr ss)) 0.5) dy (* vs 0.5)
x- (- (car vc) dx) y- (- (cadr vc) dy) x+ (+ (car vc) dx) y+ (+ (cadr vc) dy) ip (getvar "viewctr")
x (car ip) y (cadr ip) th (/ (getvar "VIEWSIZE") 100.0) dx th dy th ))
; in case Santa has used the scroll-wheel
(defun count_re-calcula () (count_calcula)(if mobj (vla-delete mobj))(create_message ip title th body 1 5))
(defun next_xy ()
(setq x (+ x dx))(cond ((> x x+) (setq dx (- 0 (abs dx))))((< x x-) (setq dx (+ 0 (abs dx)))))
(setq y (+ y dy))(cond ((> y y+) (setq dy (- 0 (abs dy))))((< y y-) (setq dy (+ 0 (abs dy))))))
(defun wait ( sec / stop )(setq stop (+ (getvar "DATE") (/ sec 86400.0)))(while (> stop (getvar "DATE"))))
(defun create_message ( %pnt $tts #th %bsl #bgc atc / msg str fnt elist)
(setq msg (strcat "{\\fArial|b0|i0|c0|p0;\\C3;" $tts "\\C7")) ; greentitle, white body
(foreach str %bsl (setq msg (strcat msg "\n" str)))(setq msg (strcat msg "}"))
(setq elist (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText") (cons 10 %pnt) (cons 1 msg) '(90 . 1)
      (cons 63 #bgc) (cons 40 (/ (getvar "VIEWSIZE") 30.0)) (cons 71 atc) '(72 . 5) '(441 . 0) ))
(setq mobj (vlax-ename->vla-object (entmakex elist)))
)


(C:RLXmas)

RLX级

Aftertouch 发表于 2022-7-5 16:07:41

圣诞快乐!:-)

SLW210 发表于 2022-7-5 16:28:13

美好的圣诞快乐!

Grrr 发表于 2022-7-5 17:01:46

圣诞快乐!
 
(
(lambda ( sL / o )
   (vl-catch-all-apply
   '(lambda nil
       (setq o (vlax-create-object "Sapi.SpVoice"))
       (vlax-put o 'SynchronousSpeakTimeout 1)
       (vlax-invoke-method o 'WaitUntilDone 0)
       (foreach s sL (vlax-invoke o "Speak" s 0))
   )
   )
   (vl-catch-all-apply 'vlax-release-object (list o))
)
'("Merry Christmas!" "And a happy new year!")
)
页: [1]
查看完整版本: 圣诞快乐,新年快乐