明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
楼主: 紫苏炒黄瓜

[源码] 【通用进度条】2022.5.2更新

    [复制链接]
发表于 2022-4-26 18:30 | 显示全部楼层

学习学习,感谢分享
发表于 2022-4-26 20:13 | 显示全部楼层

厉害了!
点赞!
发表于 2022-4-26 20:29 | 显示全部楼层
其实我一直觉得楼主的品味不错!呵呵!
发表于 2022-4-26 20:56 | 显示全部楼层
本帖最后由 hf423 于 2022-4-26 20:58 编辑
紫苏炒黄瓜 发表于 2022-4-26 14:25
相信你可以想到办法的。

(defun HH:rtosr1 (RealNum n / DIMZIN1 SHORTREAL1)
  (setq DimZin1 (getvar "DIMZIN"))
  (setvar "DIMZIN" 0)
  (setq ShortReal1 (rtos RealNum 2 n))
  (setvar "DIMZIN" DimZin1)
  ShortReal1
)

(setq jdtexe (findfile "通用进度条.exe"))
(setq xxjdtxt (findfile "xxjd.txt"))
(setq xxjdsztxt (findfile "xxjdsz.txt"))
(startapp jdtexe);调用exe
(setq n 1)
(setq n1 1)
(setq jdz (/ (length file_list) 100.0))

;The following may be a repeat, a foreach or a while loop

(if (> n jdz);每完成1%时
    (progn
             (setq f (open xxjdtxt "w"))
             (princ (itoa (setq n1 (+ n1 (cond((< jdz 1)(read(HH:rtosr1 (/ 1.0 jdz) 0)))(t 1))))) f)
             (close f)
             (setq n 1)
     )
)

这回20次OK了。
另外想问一问,我是放到批量插图功能里,20张图处理完后,进度条跑完了,但程序接着处理删除图中大量的块,还要卡一会儿,有没有办法最后处理大量块卡着时间也进入进度条?
 楼主| 发表于 2022-4-26 21:04 | 显示全部楼层
hf423 发表于 2022-4-26 20:56
(defun HH:rtosr1 (RealNum n / DIMZIN1 SHORTREAL1)
  (setq DimZin1 (getvar "DIMZIN"))
  (setvar " ...

你可以随心所欲的控制xxjd.txt内容,大于等于100才会退出进度条。
发表于 2022-4-26 21:39 | 显示全部楼层
感谢共享!学习下
发表于 2022-4-26 22:43 来自手机 | 显示全部楼层
不耻下问,好好学习
发表于 2022-4-26 22:50 | 显示全部楼层


文字说明在没有图片的情况下要大于220才能正确显示,有图片要比这个数字更大才行
想写个函数来生成xxjdsz.txt文件,生成出来的txt为ANSI格式,然后出来的进度条就乱码了
楼主能再更新下吗?



;;说明:设置进度条
;;参数:title:窗口标题 [str]
;;参数:picture:图片名称 [str]
;;参数:picture-url:图片连接/应用名称 [str]
;;参数:explain:说明 [str]
;;参数:width:窗口宽度 [int/str]
;;参数:height:窗口高度 [int/str]
;;返回:t or nil
;;用法T-set-progress "请稍等..." "" "excel" "测试" 200 0)
;;     (T-set-progress "请稍等..." "1.jpg" "https://www.baidu.com/" "测试" 200 0)
(defun T-set-progress (title picture picture-url explain width height)
        (if (and
                                (or (null title) (= (type title) 'str))
                                (or (null picture) (= (type picture) 'str))
                                (or (null picture-url) (= (type picture-url) 'str))
                                (or (null explain) (= (type explain) 'str))
                                (or (= (type width) 'int) (= (type width) 'str))
                                (or (= (type height) 'int) (= (type height) 'str))
                                (setq path "D:\\桌面\\xxjdsz.txt");固定文件名(要和exe同目录)
                                (setq file (open path "w"))
                        )
                (progn
                        (if title       (write-line title file)         (write-line file ""));窗口标题
                        (if picture     (write-line picture file)       (write-line file ""));图片名称
                        (if explain     (write-line explain file)       (write-line file ""));说明
                        (if picture-url (write-line picture-url file)   (write-line file ""));图片连接/应用名称
                        (if width
                                (cond
                                        ((= (type width) 'int)
                                                (write-line (itoa width) file)
                                        )
                                        ((= (type width) 'str)
                                                (write-line width file)
                                        )
                                )
                        );窗口宽度
                        (if height
                                (cond
                                        ((= (type height) 'int)
                                                (write-line (itoa height) file)
                                        )
                                        ((= (type height) 'str)
                                                (write-line height file)
                                        )
                                )
                        );窗口高度
                        (close file)
                        t
                )
        )
)

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-6-26 21:32 , Processed in 0.163630 second(s), 20 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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