rlx Posted December 20, 2017 Share Posted December 20, 2017 (edited) Best wishes for everyone! ; 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 "[url="file://\\C7"]\\C7[/url]")) ; green title, 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) Gr. RLX Edited December 20, 2017 by rlx Quote Link to comment Share on other sites More sharing options...
Aftertouch Posted December 20, 2017 Share Posted December 20, 2017 Merry X-Mas! :-) Quote Link to comment Share on other sites More sharing options...
SLW210 Posted December 20, 2017 Share Posted December 20, 2017 Nice! Merry Christmas! Quote Link to comment Share on other sites More sharing options...
Grrr Posted December 20, 2017 Share Posted December 20, 2017 Merry X-Mas! ( (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!") ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.