Author Topic: Animation of Arrow Rotating  (Read 840 times)

0 Members and 1 Guest are viewing this topic.

Adesu

  • Guest
Animation of Arrow Rotating
« on: September 19, 2007, 09:08:36 PM »
Hi Alls,
This code is for display arrow rotating when you load a program.
load 2 codes and type asar.
Code: [Select]
; sar is stand for Symbol Arrow Rotation
;        Design by  : Adesu <Ade Suharna>
;        Email      : mteybid@yuasabattery.co.id
;        Homepage   : http://www.yuasa-battery.co.id
;        Website    : http://cadesu.multiply.com
;        Create     : 14 September 2007
;        Program no.: 0654/09/2007
;        Edit by    : Adesu    19/09/2007    1).

(defun dtr (a)   
 (* pi (/ a 180.0))
  )

(defun c:sar (/ ang1 ang2 el1 el2 el4 el5 el6 el7 p1 p10 p11
       p12 p2 p3 p4 p5 p6 p7 p8 p9 pt rad1 rad2 ss)
  (setq pt '(0 0 0))
  (setq rad1 4)
  (command "_circle" pt rad1 "")
  (setq el1 (entlast))
  (setq rad2 6)
  (command "_circle" pt rad2 "")
  (setq el2 (entlast))
  (setq ang1 160)
  (setq p1 (polar pt (dtr ang1) 3))
  (setq p2 (polar pt (dtr ang1) 7))
  (command "_line" p1 p2 "")
  (setq el4 (entlast))
  (setq p3 (polar pt 0 4))
  (setq p4 (polar pt 0 6))
  (command "_line" p3 p4 "")
  (setq el5 (entlast)) 
  (setq p5 (polar pt pi rad1))
  (setq p6 (polar pt pi rad2))
  (command "_trim" el4 el5 "" p5 p6 "")
  (setq ang2 350)
  (setq p7 (polar pt (dtr ang2) 4))
  (setq p8 (polar pt (dtr ang2) 6)) 
  (command "_trim" el5 "" p7 p8 "")
  (setq p9 (polar pt (dtr ang1) 5))
  (command "_trim" el1 el2 "" p9 "")
  (setq p10 (polar pt pi 5))
  (command "_line" p1 p10 p2 "") 
  (setq ss (ssget "x" '((0 . "ARC,LINE"))))
  (command "_pedit" "l" "j" ss "" "")
  (setq el6 (entlast))
  (command "_mirror" el6 "" p4 p6 "")
  (setq el7 (entlast))
  (setq p11 (polar pt (* pi 0.5) rad1))
  (setq p12 (polar pt (* pi 1.5) rad1))
  (command "_mirror" el7 "" p11 p12 "y" "")
  (command "_zoom" "e")   ; 1).
  (princ)
  )  ; defun

; asar is stand for Animation Symbol Arrow Rotation
;        Design by  : Adesu <Ade Suharna>
;        Email      : mteybid@yuasabattery.co.id
;        Homepage   : http://www.yuasa-battery.co.id
;        Website    : http://cadesu.multiply.com
;        Create     : 19 September 2007
;        Program no.: 0655/09/2007
;        Edit by    : Adesu 20/09/2007   1). all format

(defun dtr (a)   
 (* pi (/ a 180.0))
  )

(defun *line* (lst) 
  (foreach x lst
    (setq pt1 (polar pt (dtr x) 4))
    (setq pt2 (polar pt (dtr x) 6))
    (command "_line" pt1 pt2 "")
    )  ; foreach
  )    ; defun

(defun *hatch* (lst) 
  (foreach x lst
    (setq pt3 (polar pt (dtr x) 5))
    (command "_bhatch" "p" "ansi31" 0.25 0 pt3 "")
    (setq el (entlast))
    (setq lsth (append lsth (list el)))
    )  ; foreach
  )    ; defun

(defun *erase* (lsth)
  (foreach x lsth
    (command "_erase" x "")
    )  ; foreach
  )    ; defun

(defun c:asar (/ pt pt1 pt2 el lsth pt3 lst1 lst2
       lst3 lst4 lsth pt rad1 rad2)
  (c:sar)
  (setq pt '(0 0 0))
  (setq rad1 4)
  (setq rad2 6)
  (setq lst1 '(0 20 40 60 80 100 120 140 160))
  (*line* lst1)
  (setq lst2 '(180 200 220 240 260 280 300 320 340))
  (*line* lst2)
  (setq lst3 '(10 30 50 70 90 110 130 150 170))
  (setq lst4 '(190 210 230 250 270 290 310 330 350))
  (repeat
    10   
    (*hatch* lst3)
    (*erase* lsth)
    (*hatch* lst4)
    (*erase* lsth)
    )  ; repeat
  )    ; defun