xazhji 发表于 2003-7-28 11:32:00

是呀,出差这么长时间,挺想念大家的。
你上面是什么程序?要让我们“注册”么?哈哈!我说的doslid 的办法,你试过没有?可能也许更直观一些吧?

龙龙仔 发表于 2003-7-28 12:33:00

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;进度条在doslib中有专门的函数
;;一个进度条在图中,一个在状态。
;;(work1 "数据处理" 1000);;;1000~10000

(defun WORK1 (PROM Y)
(setq X 0)
(dos_getprogress PROM "进行中,请耐心等待..." Y)
(repeat (fix (/ Y 3))
    (setq A 1)
)
(while (< X Y)
    (dos_getprogress -1)
    (setq X (1+ X))
)
(dos_getprogress t)
)

(defun WORK2 (PROM Y)
(dos_progbar PROM 10)
(repeat (fix (/ Y 3))
    (setq A 1)
)
(dos_progbar -1)
(dos_progbar)
(setq X 0)
(dos_progbar PROM Y)
(while (< X Y)
    (dos_progbar -1)
    (setq X (1+ X))
)
(dos_progbar)
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Library: acetutil.arx (expresstools)
acet-ui-progress ])
(acet-ui-progress current)

Display progress meter.

Arguments
label If provided, a text string that will appear as a label for the progress meter.
max If provided, the maximum value in the range to be displayed (starting with 0).
current If provided, gives the current value, which should be less than max; positive values are absolute while negative values increment the current position.

If no parameters are provided, the progress meter is removed.

Return Values
The return value depends on the action performed:
Initialize: returns T if successful, otherwise NIL.
Update: returns current.
Restore: returns NIL.
Example
;;init meter
(acet-ui-progress "Working:" (length theList))
;;process each item
(foreach item theList
    ;;perform action
    (doSomethingTo item)
    ;;update meter by one item
    (acet-ui-progress -1)
)
;;kill meter
(acet-ui-progress)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;|
xdrx-api

96. xdrx_pbarbegin
功能:设置ACAD状态行进度条初值
调用格式:(xdrx_pbarbegin <提示字符串> <终值>)
说明:1.参数<终值>:整数值
      2.显示进度条,必须先调用此函数,在LISP的循环体外

97. xdrx_pbarsetpos
功能:设置进度条的位置
调用格式:(xdrx_pbarsetpos <位置>)
说明:1.<位置>:在0和由函数xdrx_pbarbegin设置的终值之间的整数值
      2.该函数在lisp循环体内调用
返回值:NIL
98. xdrx_pbarend
功能:清除ACAD状态行的进度条
调用格式: (xdrx_pbarend)
返回值:NIL

举例:函数xdrx_pbarbegin,xdrx_pbarsetpos,xdrx_pbarend函数应用
   (defun c:test(/ i)
      (xdrx_pbarbegin "已经完成:" 100)
      (setq i 0)
      (repeat 100;;循环执行10秒左右
         (xdrx_pbarsetpos (setq i (1+ i)))
         (xdrx_sleep 100);延迟0.1秒
      )
      (xdrx_pbarend)
      (princ)
   )
|;

xazhji 发表于 2003-7-28 13:03:00

很好!

南子 发表于 2003-7-28 18:13:00

(prompt (stract "\n"(mutilStr num "|") "\n"))
(defun mutilstr(num sym / str)
   (setq str "")
(repeat num
   (setq str (strcat sym str))
   )
   str
)
关键在于: (strcat "\n" str "\n")

meflying 发表于 2003-7-29 12:17:00

;我也来一个

(defun act_slider(/ all counter)
(setq all 10)
(setq counter 1.0)
(while (>= all 0)
    (setq counter 1.0)
    (while (< counter 100000)
      (setq counter (* counter 1.0001))
    )
    (set_tile "sl" (rtos (- 10 all)))
    (set_tile "text" (strcat (rtos (* (/ (- 10.0 all) 10.0) 100.0)) "%"))
    (setq all (1- all))
)
(princ "完成")
(princ )
)
(defun c:Ctrl_slider( / dcl_id)
(if (< (setq dcl_id (load_dialog "slider")) 0)
    (exit)
)

(if (not (new_dialog "sls" dcl_id))
    (exit)
)
(act_slider)

(start_dialog)
(unload_dialog dcl_id)
(princ)
)

;------------------------------
sls:dialog{
        label = "进度";
        :slider {label = "显示进度"; key = "sl"; fixed_width = true; width = 25; max_value = 10; min_value = 1;}
        :text {label = "进度"; key = "text";}
        ok_cancel;
}

xazhji 发表于 2003-7-29 13:13:00

用对话框dcl控制显示进度的方法不好,因为对话框在活动状态时,有很多命令同时受到限制,不能用,而且会导致CAD异常,例如,不能运行command.......

meflying 发表于 2003-7-29 13:22:00

其实很多时候都可以避免command的,
可以用entmake,entmod等,还可以ActiveX

xazhji 发表于 2003-7-29 13:25:00

比如,我要插入,我要制作幻灯片,.......

SWAYWOOD 发表于 2005-4-17 15:56:00

龙哥,能否解释一下,在具体的应用当中,work1 应该如何用?


比如说,用户做好选择后,由一系列程序,对所选的图元进行一系列的处理,如何在整个处理过程中显示进度条?

SWAYWOOD 发表于 2005-4-18 09:17:00

斑竹帮忙啊
页: 1 [2] 3
查看完整版本: 我的程序运行时间较长,任何才能实现类似进度条或完成百分比的设计