Author Topic: Show Loading In Picture  (Read 2545 times)

0 Members and 1 Guest are viewing this topic.

Adesu

  • Guest
Show Loading In Picture
« on: January 02, 2007, 10:27:21 PM »
Hi Alls,
here my code to create a show loading in picture,that code would create
1). create a circle with line from center to circumfence line of circle,first line create from center to top of circle,then create as counter clock wise.
2). create a text from 0.00 to 100 %
From poin no.1 and no.2 should be same display,but this fact my code got trouble to display both,especially line in inner circle and display of value string over from 100 %.
Code: [Select]
; slip is stand for Show Loading In Picture
(defun c:slip (/ % ang cnt ed len len_pro loc num num_pre
num_real p1 p2 p3 pro rad sse ssn sst str
txt xstr)
  (command "_viewres" "y" 10000 "")               
  (setq loc '(0 0 0))
  (setq rad 5)
  (command "_circle" loc rad "")
  (setq p2 (polar loc (* pi 1.5) 7.5))
  (setq p3 (polar p2 pi 5))
  (setq str "Progress : 0.00 %")
  (command "_text" p3 1 "" str 0 "")
  (command "_zoom" "e")
  (setq ang 0)
  (repeat
    6300
    (setq p1 (polar loc (+ (* pi 0.5) ang) rad))
    (command "_line" loc p1 "")
    (setq ang (+ ang 0.001))   
    (setq sst (ssget "x" '((0 . "TEXT"))))       
    (setq ssn (ssname sst 0))                   
    (setq sse (entget ssn))
    (setq txt (cdr (assoc 1 sse)))                            ; "Progress : 0.00 %"
    (setq len (strlen txt))                                   ; 17
    (setq len_pro 12)                                         ; 12
    (if
      (= len 17)                                              ; T
      (progn
(setq num_pre (- len (+ len_pro 1)))                  ; 4
(setq num_real (- len 5))                             ; 12
(setq pro (substr txt 1 (- len 6)))                   ; "Progress : "
(setq num (substr txt num_real num_pre))              ; "0.00"
(setq % (substr txt len 1))                           ; "%"
)                                                     ; progn
      )                                                       ; if
    (if
      (= len 18)                                              ; T
      (progn
(setq num_pre (- len (+ len_pro 1)))                  ; 4
(setq num_real (- len 6))                             ; 12
(setq pro (substr txt 1 (- len 7)))                   ; "Progress : "
(setq num (substr txt num_real num_pre))              ; "10.0"
(setq % (substr txt len 1))                           ; "%"
)                                                     ; progn
      )                                                       ; if
    (if
      (= len 19)                                              ; T
      (progn
(setq num_pre (- len (+ len_pro 1)))                  ; 3
(setq num_real (- len 7))                             ; 12
(setq pro (substr txt 1 (- len 8)))                   ; "Progress : "
(setq num (substr txt num_real num_pre))              ; "100"
(setq % (substr txt len 1))                           ; "%"
)                                                     ; progn
      )                                                       ; if

    (setq cnt 0.015223015)
    (setq num (rtos (+ (distof num) cnt) 2 2))
    (setq xstr (strcat pro num " " %))
    (setq ed (entmod (subst (cons 1 xstr)(assoc 1 sse) sse)))
    )                               ; repeat
  ;(setq ssc (ssget "x" '((0 . "CIRCLE,TEXT,LINE")))) 
  ;(command "_erase" ssc "")
  (princ)
  )                                 ; defun 

Adesu

  • Guest
Re: Show Loading In Picture
« Reply #1 on: January 03, 2007, 12:46:01 AM »
Here the drawing for that code,look at attach file

Patrick_35

  • Guest
Re: Show Loading In Picture
« Reply #2 on: January 03, 2007, 08:12:01 AM »
Hi
And with the progress bar of express tools ?

@+

Code: [Select]
(defun c:slip (/ % ang cnt ed len len_pro loc num num_pre
num_real p1 p2 p3 pro rad sse ssn sst str
txt xstr)
  (command "_.viewres" "_y" 10000 "")               
  (setq loc '(0 0 0))
  (setq rad 5)
  (command "_.circle" loc rad "")
  (setq p2 (polar loc (* pi 1.5) 7.5))
  (setq p3 (polar p2 pi 5))
;  (setq str "Progress : 0.00 %")
;  (command "_.text" p3 1 "" str 0 "")
  (acet-ui-progress-init "Progress : " 6300)
  (command "_.zoom" "_e")
  (setq ang 0 n 0)
  (repeat
    6300
    (setq p1 (polar loc (+ (* pi 0.5) ang) rad))
    (command "_line" loc p1 "")
    (setq ang (+ ang 0.001))   
;    (setq sst (ssget "x" '((0 . "TEXT"))))       
;    (setq ssn (ssname sst 0))                   
;    (setq sse (entget ssn))
;    (setq txt (cdr (assoc 1 sse)))                            ; "Progress : 0.00 %"
;    (setq len (strlen txt))                                   ; 17
;    (setq len_pro 12)                                         ; 12
;    (if
;      (= len 17)                                              ; T
;      (progn
; (setq num_pre (- len (+ len_pro 1)))                  ; 4
; (setq num_real (- len 5))                             ; 12;
; (setq pro (substr txt 1 (- len 6)))                   ; "Progress : "
; (setq num (substr txt num_real num_pre))              ; "0.00"
; (setq % (substr txt len 1))                           ; "%"
; )                                                     ; progn
;      )                                                       ; if
;    (if
;      (= len 18)                                              ; T
;      (progn
; (setq num_pre (- len (+ len_pro 1)))                  ; 4
; (setq num_real (- len 6))                             ; 12
; (setq pro (substr txt 1 (- len 7)))                   ; "Progress : "
; (setq num (substr txt num_real num_pre))              ; "10.0"
; (setq % (substr txt len 1))                           ; "%"
; )                                                     ; progn
;      )                                                       ; if
;    (if
;      (= len 19)                                              ; T
;      (progn
; (setq num_pre (- len (+ len_pro 1)))                  ; 3
; (setq num_real (- len 7))                             ; 12
; (setq pro (substr txt 1 (- len 8)))                   ; "Progress : "
; (setq num (substr txt num_real num_pre))              ; "100"
; (setq % (substr txt len 1))                           ; "%"
; )                                                     ; progn
;      )                                                       ; if

    (setq cnt 0.015223015)
;    (setq num (rtos (+ (distof num) cnt) 2 2))
    (setq n (1+ n))
    (acet-ui-progress-safe n)
;    (setq xstr (strcat pro num " " %))
;    (setq ed (entmod (subst (cons 1 xstr)(assoc 1 sse) sse)))
    )                               ; repeat
  ;(setq ssc (ssget "x" '((0 . "CIRCLE,TEXT,LINE")))) 
  ;(command "_erase" ssc "")
  (acet-ui-progress-done)
  (princ)
  )

Guest

  • Guest
Re: Show Loading In Picture
« Reply #3 on: January 03, 2007, 08:35:41 AM »
Code: [Select]
(acet-ui-progress-init...Hmmmm... I think I might have a use for that.

Thanks.

Adesu

  • Guest
Re: Show Loading In Picture
« Reply #4 on: January 04, 2007, 07:02:24 PM »
Hi Patrick,
thanks very much for your alternative choose.

Hi
And with the progress bar of express tools ?

@+

Code: [Select]
(defun c:slip (/ % ang cnt ed len len_pro loc num num_pre
num_real p1 p2 p3 pro rad sse ssn sst str
txt xstr)
  (command "_.viewres" "_y" 10000 "")               
  (setq loc '(0 0 0))
  (setq rad 5)
  (command "_.circle" loc rad "")
  (setq p2 (polar loc (* pi 1.5) 7.5))
  (setq p3 (polar p2 pi 5))
;  (setq str "Progress : 0.00 %")
;  (command "_.text" p3 1 "" str 0 "")
  (acet-ui-progress-init "Progress : " 6300)
  (command "_.zoom" "_e")
  (setq ang 0 n 0)
  (repeat
    6300
    (setq p1 (polar loc (+ (* pi 0.5) ang) rad))
    (command "_line" loc p1 "")
    (setq ang (+ ang 0.001))   
;    (setq sst (ssget "x" '((0 . "TEXT"))))       
;    (setq ssn (ssname sst 0))                   
;    (setq sse (entget ssn))
;    (setq txt (cdr (assoc 1 sse)))                            ; "Progress : 0.00 %"
;    (setq len (strlen txt))                                   ; 17
;    (setq len_pro 12)                                         ; 12
;    (if
;      (= len 17)                                              ; T
;      (progn
; (setq num_pre (- len (+ len_pro 1)))                  ; 4
; (setq num_real (- len 5))                             ; 12;
; (setq pro (substr txt 1 (- len 6)))                   ; "Progress : "
; (setq num (substr txt num_real num_pre))              ; "0.00"
; (setq % (substr txt len 1))                           ; "%"
; )                                                     ; progn
;      )                                                       ; if
;    (if
;      (= len 18)                                              ; T
;      (progn
; (setq num_pre (- len (+ len_pro 1)))                  ; 4
; (setq num_real (- len 6))                             ; 12
; (setq pro (substr txt 1 (- len 7)))                   ; "Progress : "
; (setq num (substr txt num_real num_pre))              ; "10.0"
; (setq % (substr txt len 1))                           ; "%"
; )                                                     ; progn
;      )                                                       ; if
;    (if
;      (= len 19)                                              ; T
;      (progn
; (setq num_pre (- len (+ len_pro 1)))                  ; 3
; (setq num_real (- len 7))                             ; 12
; (setq pro (substr txt 1 (- len 8)))                   ; "Progress : "
; (setq num (substr txt num_real num_pre))              ; "100"
; (setq % (substr txt len 1))                           ; "%"
; )                                                     ; progn
;      )                                                       ; if

    (setq cnt 0.015223015)
;    (setq num (rtos (+ (distof num) cnt) 2 2))
    (setq n (1+ n))
    (acet-ui-progress-safe n)
;    (setq xstr (strcat pro num " " %))
;    (setq ed (entmod (subst (cons 1 xstr)(assoc 1 sse) sse)))
    )                               ; repeat
  ;(setq ssc (ssget "x" '((0 . "CIRCLE,TEXT,LINE")))) 
  ;(command "_erase" ssc "")
  (acet-ui-progress-done)
  (princ)
  )