Author Topic: clock  (Read 4947 times)

0 Members and 1 Guest are viewing this topic.

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1544
  • Moscow (Russia)
clock
« on: March 07, 2006, 05:59:19 PM »
clock in AutoCad.
Stay home. Stay safe. Save lives.

Slimİ

  • Needs a day job
  • Posts: 6566
  • The Dude Abides...
Re: clock
« Reply #1 on: March 07, 2006, 06:03:09 PM »
I like it!!! Very, nice.  :-)

THX
I drink beer and I know things....

uncoolperson

  • King Gator
  • Posts: 4430
  • Doing everything in metric inches!
Re: clock
« Reply #2 on: March 07, 2006, 06:17:46 PM »
neato burrito

when you going to incorporate big loud annoying beeps and animation?
when all else fails On Error Resume Next
-----------------------
Livin like I'm on borrowed time
-----------------------
Searching for the Ballmer Peak

snoopychen

  • Guest
Re: clock
« Reply #3 on: March 08, 2006, 02:36:04 AM »
This is my another clock lisp, can run in R14, but certainly, EL's clock is much more beautiful~
Code: [Select]
;;by qjchen, China, 2005
;;a clock that show time in the screen
(defun c:sz ()
  (setq 123err *error*
*error* abcderr
  )
  (command "redraw")
  (setq vc (getvar "viewctr"))
  (setq vs (getvar "viewsize"))
  (setq r (* 0.5 vs))
  (setq color1 20)
  (draw12)
  (draw3)
  (draw6)
  (draw9)
  (drawcircleandline)
  (setq i 0)
  (setq p2 vc
pfz2 p2
psz2 p2
  )
  (setq temp (cadr (grread 5)))
  (while (< i 10000)
    (setq time (menucmd "m=$(edtime,$(getvar,date),hh:mm:ss)"))
    (setq timelen (strlen time))
    (setq stime (atof (substr time 1 2)))
    (if (>= stime 12)
      (setq stime (- stime 12))
    )
    (setq ftime (atof (substr time 4 2)))
    (setq mtime (atof (substr time (- timelen 1) 2)))
    (setq p0 vc)
    (setq ang (- (* 0.5 pi) (/ (* mtime pi) 30)))
    (setq angfz (- (* 0.5 pi) (/ (* ftime pi) 30)))
    (setq angsz (- (* 0.5 pi) (/ (* stime pi) 6)))
    (setq angsz (- angsz (/ (* ftime pi) 360)))
    (grdraw p0 p2 0)
    (grdraw p0 pfz2 0)
    (grdraw p0 psz2 0)
    (setq p1 (polar p0 ang (* r 0.68)))
    (setq pfz1 (polar p0 angfz (* r 0.58)))
    (setq psz1 (polar p0 angsz (* r 0.50)))
    (grdraw p0 p1 1)
    (grdraw p0 pfz1 4)
    (grdraw p0 psz1 3)
    (setq p2 p1)
    (setq pfz2 pfz1)
    (setq psz2 psz1)
    (princ)
    (std-sleep 1)
    (setq i (1+ i))
  )
  (setq *error* 123err)
)

(defun draw12 (/ pa p12-1 p12-2 p12-3 p12-4 p12-5 p12-6 p12-7 p12-8)
  (setq pa (polar vc (* 0.5 pi) (* vs 0.4)))
  (setq p12-1 (polar pa pi (* 0.05 r)))
  (setq p12-2 (polar p12-1 (* 1.5 pi) (* 0.2 r)))
  (setq p12-3 (polar pa 0 (* 0.01 r)))
  (setq p12-4 (polar p12-3 0 (* 0.1 r)))
  (setq p12-5 (polar p12-4 (* 1.5 pi) (* 0.1 r)))
  (setq p12-6 (polar p12-5 pi (* 0.1 r)))
  (setq p12-7 (polar p12-6 (* 1.5 pi) (* 0.1 r)))
  (setq p12-8 (polar p12-7 0 (* 0.1 r)))
  (grdraw p12-1 p12-2 color1)
  (grdraw p12-3 p12-4 color1)
  (grdraw p12-4 p12-5 color1)
  (grdraw p12-5 p12-6 color1)
  (grdraw p12-6 p12-7 color1)
  (grdraw p12-7 p12-8 color1)
)

(defun draw3 (/ pb p12-1 p12-2 p12-3 p12-4 p12-5 p12-6)
  (setq pb (polar vc 0 (* vs 0.37)))
  (setq p12-6 pb)
  (setq p12-3 (polar pb pi (* 0.1 r)))
  (setq p12-4 (polar pb (* 1.5 pi) (* 0.1 r)))
  (setq p12-1 (polar pb (* 0.5 pi) (* 0.1 r)))
  (setq p12-2 (polar p12-1 pi (* 0.1 r)))
  (setq p12-5 (polar p12-4 pi (* 0.1 r)))
  (grdraw p12-6 p12-3 color1)
  (grdraw p12-1 p12-2 color1)
  (grdraw p12-4 p12-5 color1)
  (grdraw p12-1 p12-6 color1)
  (grdraw p12-6 p12-4 color1)
)

(defun draw6 (/ pb p12-1 p12-2 p12-3 p12-4 p12-5 p12-6)
  (setq pc (polar vc (* 1.5 pi) (* vs 0.4)))
  (setq p12-1 (polar pc 0 (* 0.05 r)))
  (setq p12-2 (polar p12-1 (* 0.5 pi) (* 0.1 r)))
  (setq p12-3 (polar p12-2 pi (* 0.1 r)))
  (setq p12-4 (polar p12-3 (* 1.5 pi) (* 0.1 r)))
  (setq p12-5 (polar p12-3 (* 0.5 pi) (* 0.1 r)))
  (setq p12-6 (polar p12-5 0 (* 0.1 r)))
  (grdraw p12-1 p12-2 color1)
  (grdraw p12-2 p12-3 color1)
  (grdraw p12-4 p12-1 color1)
  (grdraw p12-4 p12-5 color1)
  (grdraw p12-5 p12-6 color1)
)

(defun draw9 (/ pb p12-1 p12-2 p12-3 p12-4 p12-5 p12-6)
  (setq pd (polar vc pi (* vs 0.37)))
  (setq p12-1 pd)
  (setq p12-2 (polar p12-1 (* 0.5 pi) (* 0.1 r)))
  (setq p12-3 (polar p12-2 0 (* 0.1 r)))
  (setq p12-4 (polar p12-3 (* 1.5 pi) (* 0.1 r)))
  (setq p12-5 (polar p12-4 (* 1.5 pi) (* 0.1 r)))
  (setq p12-6 (polar p12-5 pi (* 0.1 r)))
  (grdraw p12-1 p12-2 color1)
  (grdraw p12-2 p12-3 color1)
  (grdraw p12-4 p12-1 color1)
  (grdraw p12-3 p12-5 color1)
  (grdraw p12-5 p12-6 color1)
)

(defun drawcircleandline (/ i pe pf p1 p2)
  (setq i 1)
  (repeat 11
    (setq pe (polar vc (* i (/ pi 6)) (* vs 0.38)))
    (setq pf (polar vc (* i (/ pi 6)) (* vs 0.35)))
    (if (and
  (/= i 3)
  (/= i 6)
  (/= i 9)
)
      (grdraw pe pf 31)
    )
    (setq i (1+ i))
  )        
 
  (cc (* r 0.86) 42)
  (cc (* r 0.9) 31)
 
  )


(defun cc(a b)
  (setq i 0)
 
  (while (< i (* 2 pi))
    (setq p1 (polar vc i a))
    (setq i (+ i (/ (* 2 pi) 180)))
    (setq p2 (polar vc i a))
    (grdraw p1 p2 b)
    )
)


(defun abcderr (st)
  (if (/= st "Function cancelled")
    (princ (strcat "\nerror:" s))
  )
)


(defun STD-SLEEP (secs / endt)
  (setq endt (+ (getvar "DATE") (/ secs 86400.0))) ; fixed
  (while (< (getvar "DATE") endt)
    T
  )
)
« Last Edit: March 08, 2006, 02:40:20 AM by snoopychen »

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1544
  • Moscow (Russia)
Re: clock
« Reply #4 on: March 08, 2006, 04:04:39 AM »
Very nice clock!
You used grdraw, "viewctr" and "viewsize"...
I was too lazy   :-(
Stay home. Stay safe. Save lives.

GDF

  • Water Moccasin
  • Posts: 2059
Re: clock
« Reply #5 on: March 08, 2006, 09:06:36 AM »
Some people just have way too much time on their hands...
I can't think of anythingelse timely to say. Good clocks.

Tick Tick
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1544
  • Moscow (Russia)
Re: clock
« Reply #6 on: September 08, 2006, 07:12:49 AM »
With usage of a matrix 4x4
For any coordinate system
 :-)

Code: [Select]
(defun c:clo (/ A1 GR I S)
  ;;  ElpanovEvgeniy, Russia, Moscow, 2006
  ;;  Clock that show time in the screen
  (setq a1 (/ pi 30))
  (while (= (car (setq gr (grread 5))) 5)
    (setq s  (/ (getvar "viewsize") 12.)
          gr (trans (cadr gr) 1 3)
          i  0
    ) ;_  setq
    (redraw)
    (grvecs ;SS
      '(2 (-0.01 0.) (1. 0.))
      ((lambda (a)
         ((lambda (c s x y sc)
            (list (list c (- s) 0. x) (list s c 0. y) (list 0. 0. sc 0.) '(0. 0. 0. 1.))
          ) ;_  lambda
           (* (cos a) s)
           (* (sin a) s)
           (car gr)
           (+ (* s 1.5) (cadr gr))
           s
         )
       ) ;_  lambda
        (- (/ pi 2.) (* (/ pi 30.) (atof (menucmd "M=$(edtime,$(getvar,date),SS.MSEC)"))))
      )
    ) ;_  grvecs
    (grvecs ;MM
      '(3(-0.01 0.)(0.8 0.)3(-0.01 -0.01)(0.6 -0.01)3(-0.01 0.01)(0.6 0.01)3(-0.01 -0.02)(0.4 -0.02)3(-0.01 0.02)(0.4 0.02))
      ((lambda (a)
         ((lambda (c s x y sc)
            (list (list c (- s) 0. x) (list s c 0. y) (list 0. 0. sc 0.) '(0. 0. 0. 1.))
          ) ;_  lambda
           (* (cos a) s)
           (* (sin a) s)
           (car gr)
           (+ (* s 1.5) (cadr gr))
           s
         )
       ) ;_  lambda
        (- (/ pi 2.) (* (/ pi 30.) (atoi (menucmd "M=$(edtime,$(getvar,date),MM)"))))
      )
    ) ;_  grvecs
    (grvecs ;H
      '(3(-0.01 0.)(0.5 0.)3(-0.01 -0.01)(0.4 -0.01)3(-0.01 0.01)(0.4 0.01)3(-0.01 -0.02)(0.3 -0.02)
        3(-0.01 0.02)(0.3 0.02)3(-0.01 -0.03)(0.2 -0.03)3(-0.01 0.03)(0.2 0.03)
       )
      ((lambda (a)
         ((lambda (c s x y sc)
            (list (list c (- s) 0. x) (list s c 0. y) (list 0. 0. sc 0.) '(0. 0. 0. 1.))
          ) ;_  lambda
           (* (cos a) s)
           (* (sin a) s)
           (car gr)
           (+ (* s 1.5) (cadr gr))
           s
         )
       ) ;_  lambda
        (- (/ pi 2.)
           (* (/ pi 6.)
              (+ (atoi (menucmd "M=$(edtime,$(getvar,date),H)"))
                 (/ (atoi (menucmd "M=$(edtime,$(getvar,date),MM)")) 60.)
              ) ;_  +
           ) ;_  *
        ) ;_  -
      )
    ) ;_  grvecs
    (repeat 4
      (grvecs
        '(5(0.8 0.)(0.82 0.02)5(0.82 0.02)(1. 0.02)5(1. 0.02)(1. -0.02)5(1. -0.02)(0.82 -0.02)5(0.82 -0.02)(0.8 0.))
        ((lambda (c s x y sc)
           (list (list c (- s) 0. x) (list s c 0. y) (list 0. 0. sc 0.) '(0. 0. 0. 1.))
         ) ;_  lambda
          (* (cos (* a1 i)) s)
          (* (sin (* a1 i)) s)
          (car gr)
          (+ (* s 1.5) (cadr gr))
          s
        )
      ) ;_  grvecs
      (repeat 3
        (grvecs
          '(5(1. 0.01)(0.92 0.01)5(1. -0.01)(0.92 -0.01))
          ((lambda (c s x y sc)
             (list (list c (- s) 0. x) (list s c 0. y) (list 0. 0. sc 0.) '(0. 0. 0. 1.))
           ) ;_  lambda
            (* (cos (* a1 i)) s)
            (* (sin (* a1 i)) s)
            (car gr)
            (+ (* s 1.5) (cadr gr))
            s
          )
        ) ;_  grvecs
        (repeat 5
          (grvecs
            '(5 (0.9 0) (1 0))
            ((lambda (c s x y sc)
               (list (list c (- s) 0. x) (list s c 0. y) (list 0. 0. sc 0.) '(0. 0. 0. 1.))
             ) ;_  lambda
              (* (cos (* a1 i)) s)
              (* (sin (* a1 i)) s)
              (car gr)
              (+ (* s 1.5) (cadr gr))
              s
            )
          ) ;_  grvecs
          (setq i (1+ i))
        ) ;_  repeat
      ) ;_  repeat
    ) ;_  repeat
  ) ;_  while
  (redraw)
)
Stay home. Stay safe. Save lives.

qjchen

  • Bull Frog
  • Posts: 285
  • Best wishes to all
Re: clock
« Reply #7 on: September 08, 2006, 08:54:31 AM »
dear Evgeniy

It seems that the clock pointer couldnt animate that just like the up two rountine does, only when the mouse move, then the time change.

could the clock a little more bigger?

I like your code:)





http://qjchen.mjtd.com
My blog http://chenqj.blogspot.com (Chinese, can be translate into English)

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1544
  • Moscow (Russia)
Re: clock
« Reply #8 on: September 08, 2006, 09:14:11 AM »
dear Evgeniy

It seems that the clock pointer couldnt animate that just like the up two rountine does, only when the mouse move, then the time change.

could the clock a little more bigger?

I like your code:)



(defun c:clo (/ A1 GR I S)
  ;;  ElpanovEvgeniy, Russia, Moscow, 2006
  ;;  Clock that show time in the screen
  (setq a1 (/ pi 30))
  (while (= (car (setq gr (grread 5))) 5)
    (setq s  (/ (getvar "viewsize") 12.); Replace on 2. - 100.
          gr (trans (cadr gr) 1 3)
          i  0
    ) ;_  setq
    (redraw)
.............................Is cut off......................................
Stay home. Stay safe. Save lives.

nivuahc

  • Guest
Re: clock
« Reply #9 on: September 08, 2006, 09:37:48 AM »
very nice  :kewl:

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1544
  • Moscow (Russia)
Re: clock
« Reply #10 on: September 09, 2006, 03:28:31 AM »
It is probable, so it is better...
Code: [Select]
(defun c:clo (/ A1 GR I S)
  ;;  ElpanovEvgeniy, Russia, Moscow, 2006
  ;;  Clock that show time in the screen
  (setq a1 (/ pi 30))
  (while (= (car (setq gr (grread nil 5 1))) 5)
    (setq s  (/ (getvar "viewsize") 8.)
          gr (trans (cadr gr) 1 3)
          i  0
    ) ;_  setq
    (redraw)
    (grvecs ;SS
      '(2 (-0.01 0.) (1. 0.))
      ((lambda (a)
         ((lambda (c s x y sc)
            (list (list c (- s) 0. x) (list s c 0. y) (list 0. 0. sc 0.) '(0. 0. 0. 1.))
          ) ;_  lambda
           (* (cos a) s)
           (* (sin a) s)
           (car gr)
           (cadr gr)
           s
         )
       ) ;_  lambda
        (- (/ pi 2.) (* (/ pi 30.) (atof (menucmd "M=$(edtime,$(getvar,date),SS.MSEC)"))))
      )
    ) ;_  grvecs
    (grvecs ;MM
      '(3 (-0.01 0.)    (0.8 0.)
        3 (-0.01 -0.01) (0.6 -0.01)
        3 (-0.01 0.01)  (0.6 0.01)
        3 (-0.01 -0.02) (0.4 -0.02)
        3 (-0.01 0.02)  (0.4 0.02)
        3 (0.4 -0.02)   (0.8 0.)
        3 (0.4 0.02)    (0.8 0.)
       )
      ((lambda (a)
         ((lambda (c s x y sc)
            (list (list c (- s) 0. x) (list s c 0. y) (list 0. 0. sc 0.) '(0. 0. 0. 1.))
          ) ;_  lambda
           (* (cos a) s)
           (* (sin a) s)
           (car gr)
           (cadr gr)
           s
         )
       ) ;_  lambda
        (- (/ pi 2.) (* (/ pi 30.) (atoi (menucmd "M=$(edtime,$(getvar,date),MM)"))))
      )
    ) ;_  grvecs
    (grvecs ;H
      '(1 (-0.01 0.)    (0.5 0.)
        1 (-0.01 -0.01) (0.4 -0.01)
        1 (-0.01 0.01)  (0.4 0.01)
        1 (-0.01 -0.02) (0.3 -0.02)
        1 (-0.01 0.02)  (0.3 0.02)
        1 (-0.01 -0.03) (0.2 -0.03)
        1 (-0.01 0.03)  (0.2 0.03)
        1 (0.2 -0.03)   (0.5 0.)
        1 (0.2 0.03)    (0.5 0.)
       )
      ((lambda (a)
         ((lambda (c s x y sc)
            (list (list c (- s) 0. x) (list s c 0. y) (list 0. 0. sc 0.) '(0. 0. 0. 1.))
          ) ;_  lambda
           (* (cos a) s)
           (* (sin a) s)
           (car gr)
           (cadr gr)
           s
         )
       ) ;_  lambda
        (- (/ pi 2.)
           (* (/ pi 6.)
              (+ (atoi (menucmd "M=$(edtime,$(getvar,date),H)"))
                 (/ (atoi (menucmd "M=$(edtime,$(getvar,date),MM)")) 60.)
              ) ;_  +
           ) ;_  *
        ) ;_  -
      )
    ) ;_  grvecs
    (repeat 4
      (grvecs
        '(6 (0.8 0.)     (0.82 0.02)
          6 (0.82 0.02)  (1. 0.02)
          6 (1. 0.02)    (1. -0.02)
          6 (1. -0.02)   (0.82 -0.02)
          6 (0.82 -0.02) (0.8 0.)
         )
        ((lambda (c s x y sc)
           (list (list c (- s) 0. x) (list s c 0. y) (list 0. 0. sc 0.) '(0. 0. 0. 1.))
         ) ;_  lambda
          (* (cos (* a1 i)) s)
          (* (sin (* a1 i)) s)
          (car gr)
          (cadr gr)
          s
        )
      ) ;_  grvecs
      (repeat 3
        (grvecs
          '(5 (1. 0.01) (0.92 0.01) 5 (1. -0.01) (0.92 -0.01)5 (0.92 0.01)(0.89 0.) 5 (0.92 -0.01)(0.89 0.))
          ((lambda (c s x y sc)
             (list (list c (- s) 0. x) (list s c 0. y) (list 0. 0. sc 0.) '(0. 0. 0. 1.))
           ) ;_  lambda
            (* (cos (* a1 i)) s)
            (* (sin (* a1 i)) s)
            (car gr)
            (cadr gr)
            s
          )
        ) ;_  grvecs
        (repeat 5
          (grvecs
            '(3 (-0.25 1.2) (0 1.3) 3 (0 1.3) (0.25 1.2) 3 (0.25 1.2) (0 1.1) 3 (0 1.1) (-0.25 1.2))
            ((lambda (c s x y sc)
               (list (list c (- s) 0. (+ s s (* s 0.5) x))
                     (list s c 0. y)
                     (list 0. 0. sc 0.)
                     '(0. 0. 0. 1.)
               ) ;_  list
             ) ;_  lambda
              (* (cos (* a1 i 1)) s)
              (* (sin (* a1 i 1)) s)
              (car gr)
              (cadr gr)
              s
            )
          ) ;_  grvecs
          (grvecs
            '(5 (0.9 0) (1 0)); 5 (1.05 -0.9) (1.05 0.9)
            ((lambda (c s x y sc)
               (list (list c (- s) 0. x) (list s c 0. y) (list 0. 0. sc 0.) '(0. 0. 0. 1.))
             ) ;_  lambda
              (* (cos (* a1 i)) s)
              (* (sin (* a1 i)) s)
              (car gr)
              (cadr gr)
              s
            )
          ) ;_  grvecs
          (setq i (1+ i))
        ) ;_  repeat
      ) ;_  repeat
    ) ;_  repeat
  ) ;_  while
  (redraw)
)
Stay home. Stay safe. Save lives.

Mark

  • Custom Title
  • Seagull
  • Posts: 28716
Re: clock
« Reply #11 on: September 09, 2006, 08:15:13 AM »
It is probable, so it is better...

Evgeniy that is amazing! :-)
TheSwamp.org  (serving the CAD community since 2003)