Hippe013

23rd Jul 2010, 08:28 pm

I recieved a lisp from Lee Mac. Bored.lsp

Code is as follows:

(defun c:bored ( / cir cnt gr lst n d )

;; © Lee Mac 2010

(setq lst (list (getvar 'viewctr) (getvar 'viewctr)) cnt 0)

(while (eq 5 (car (setq gr (grread nil 13 0))))

(redraw)

(setq cir nil n 0 lst (append lst (list (last lst) (cadr gr)))

cnt (1+ cnt))

(if (< 100 cnt) (setq lst (cddr lst)))

(repeat 50

(setq d (/ (distance (car lst) (last lst)) 4.))

(repeat 4

(setq cir (cons (polar (car lst) (* (setq n (1+ n)) (/ (* pi 2) 50)) d) cir))

(setq d (/ d 2.))

)

)

(grvecs (append (list (rem (/ cnt 100) 255)) lst cir))

)

(redraw)

(princ)

)

Now, I have edited it to drag around an object, code as follows:

(defun c:bored2 ( / )

;; © Lee Mac 2010

;Edit by Hippe 2010

(setq obj (vlax-ename->vla-object (car (entsel))))

(setq ins (vlax-get-property obj 'InsertionPoint))

(setq lst (list (getvar 'viewctr) (getvar 'viewctr)) cnt 0)

(while (eq 5 (car (setq gr (grread nil 13 0))))

(redraw)

(setq cir nil n 0 lst (append lst (list (last lst) (cadr gr)))

cnt (1+ cnt))

(if (< 100 cnt) (setq lst (cddr lst)))

;(repeat 50

; (setq d (/ (distance (car lst) (last lst)) 4.))

;(repeat 4

; (setq cir (cons (polar (car lst) (* (setq n (1+ n)) (/ (* pi 2) 50)) d) cir))

; (setq d (/ d 2.))

; )

;)

(grvecs (append (list (rem (/ cnt 100) 255)) lst cir))

(vlax-put-property obj 'InsertionPoint (vlax-3d-point (nth 0 lst)))

(vla-update obj)

)

(redraw)

(vlax-put-property obj 'InsertionPoint ins)

(vlax-release-object obj)

(princ)

)

This code should work with any object that has an Insertion Point Property.

Now my question is: This works with a piece of single line text with a left justification, but doesn't seem to work with a Middle Center Justification. Can anyone see why it doesn't work?

Thanks in advance.

hippe013

P.S. Lee Mac... thanx again, fun stuff! :P

Code is as follows:

(defun c:bored ( / cir cnt gr lst n d )

;; © Lee Mac 2010

(setq lst (list (getvar 'viewctr) (getvar 'viewctr)) cnt 0)

(while (eq 5 (car (setq gr (grread nil 13 0))))

(redraw)

(setq cir nil n 0 lst (append lst (list (last lst) (cadr gr)))

cnt (1+ cnt))

(if (< 100 cnt) (setq lst (cddr lst)))

(repeat 50

(setq d (/ (distance (car lst) (last lst)) 4.))

(repeat 4

(setq cir (cons (polar (car lst) (* (setq n (1+ n)) (/ (* pi 2) 50)) d) cir))

(setq d (/ d 2.))

)

)

(grvecs (append (list (rem (/ cnt 100) 255)) lst cir))

)

(redraw)

(princ)

)

Now, I have edited it to drag around an object, code as follows:

(defun c:bored2 ( / )

;; © Lee Mac 2010

;Edit by Hippe 2010

(setq obj (vlax-ename->vla-object (car (entsel))))

(setq ins (vlax-get-property obj 'InsertionPoint))

(setq lst (list (getvar 'viewctr) (getvar 'viewctr)) cnt 0)

(while (eq 5 (car (setq gr (grread nil 13 0))))

(redraw)

(setq cir nil n 0 lst (append lst (list (last lst) (cadr gr)))

cnt (1+ cnt))

(if (< 100 cnt) (setq lst (cddr lst)))

;(repeat 50

; (setq d (/ (distance (car lst) (last lst)) 4.))

;(repeat 4

; (setq cir (cons (polar (car lst) (* (setq n (1+ n)) (/ (* pi 2) 50)) d) cir))

; (setq d (/ d 2.))

; )

;)

(grvecs (append (list (rem (/ cnt 100) 255)) lst cir))

(vlax-put-property obj 'InsertionPoint (vlax-3d-point (nth 0 lst)))

(vla-update obj)

)

(redraw)

(vlax-put-property obj 'InsertionPoint ins)

(vlax-release-object obj)

(princ)

)

This code should work with any object that has an Insertion Point Property.

Now my question is: This works with a piece of single line text with a left justification, but doesn't seem to work with a Middle Center Justification. Can anyone see why it doesn't work?

Thanks in advance.

hippe013

P.S. Lee Mac... thanx again, fun stuff! :P