明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
楼主: wdb

我的程序运行时间较长,任何才能实现类似进度条或完成百分比的设计

  [复制链接]
发表于 2003-7-28 11:32 | 显示全部楼层
是呀,出差这么长时间,挺想念大家的。
你上面是什么程序?要让我们“注册”么?哈哈!我说的doslid 的办法,你试过没有?可能也许更直观一些吧?
发表于 2003-7-28 12:33 | 显示全部楼层
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;进度条在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 [label [max]])
(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)
     )
|;
发表于 2003-7-28 13:03 | 显示全部楼层
很好!
发表于 2003-7-28 18:13 | 显示全部楼层
(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")
发表于 2003-7-29 12:17 | 显示全部楼层
;我也来一个

(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;
}
发表于 2003-7-29 13:13 | 显示全部楼层
用对话框dcl控制显示进度的方法不好,因为对话框在活动状态时,有很多命令同时受到限制,不能用,而且会导致CAD异常,例如,不能运行command.......
发表于 2003-7-29 13:22 | 显示全部楼层
其实很多时候都可以避免command的,
可以用entmake,entmod等,还可以ActiveX
发表于 2003-7-29 13:25 | 显示全部楼层
比如,我要  插入  ,我要  制作幻灯片,.......
发表于 2005-4-17 15:56 | 显示全部楼层
龙哥,能否解释一下,在具体的应用当中,work1 应该如何用?


比如说,用户做好选择后,由一系列程序,对所选的图元进行一系列的处理,如何在整个处理过程中显示进度条?
发表于 2005-4-18 09:17 | 显示全部楼层
斑竹帮忙啊
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-3-29 13:36 , Processed in 0.178548 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表