乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 39|回复: 5

[编程交流] Flush princ/prompt/write-char

[复制链接]

4

主题

19

帖子

15

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-5 15:58:43 | 显示全部楼层 |阅读模式
Dear all.
 
This is something I tried years ago, without success; let's try again with you wise men (and women): we have many routines which iterate the full database drawing many times, so not to fulfill the console screen (you know, the F2 one  with text, we print on it a single variable character as a feedback for the user as everything is up and running, despite the long time usually taken by these routines.
 
Problem rely in the console's character buffer, as every (princ "[char]") IS NOT visualized till the buffer fills, so appearing sudden chunks of characters after long silence lapses, or when the routine ends.
 
I've tried (prin? ..) (prompt ..) and (write-char ..) without success. Ideas?
 
By the way, would be nice to find a solution pre-VisualLisp compatible (but not mandatory
 
Regards
回复

使用道具 举报

5

主题

1334

帖子

1410

银币

限制会员

铜币
-20
发表于 2022-7-5 16:21:44 | 显示全部楼层
While iteration you could use (acet-ui-progress*) functions to visualize processing of iterations - you have to implement those functions inside your lisp(s)... Try google-ing for "ACET-UI-PROGRESS" to get more info how to do it...
回复

使用道具 举报

4

主题

19

帖子

15

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-5 16:30:52 | 显示全部楼层
Thanks a lot; it looks like de PRO option, but I promise to try to implement it...
 
 
Nevertheless, would be nice to find something like (flush-what-ever ..) that could be added to our old routines effort-less...
回复

使用道具 举报

5

主题

1334

帖子

1410

银币

限制会员

铜币
-20
发表于 2022-7-5 16:38:43 | 显示全部楼层
Also worth of mentioning...
 
http://www.theswamp.org/~john/avlisp/#grtext
回复

使用道具 举报

26

主题

1495

帖子

20

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-5 16:48:49 | 显示全部楼层
I think I understand.
 
I use this for a visual progress display since A2K ( this is when visual was incorporated into autolisp whether you wanted it or not )
 
  1. [b][color=BLACK]([/color][/b]defun c:vprog [b][color=FUCHSIA]([/color][/b]/ ss i en ed la[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]and [b][color=NAVY]([/color][/b]setq ss [b][color=MAROON]([/color][/b]ssget [color=#2f4f4f]"X"[/color][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]      [b][color=NAVY]([/color][/b]setq i 0[b][color=NAVY])[/color][/b]      [b][color=NAVY]([/color][/b]while [b][color=MAROON]([/color][/b]setq en [b][color=GREEN]([/color][/b]ssname ss i[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]             [b][color=MAROON]([/color][/b]princ [color=#2f4f4f]"\t\t\r"[/color][b][color=MAROON])[/color][/b]             [b][color=MAROON]([/color][/b]prin1 en[b][color=MAROON])[/color][/b]             [b][color=MAROON]([/color][/b]setq ed [b][color=GREEN]([/color][/b]entget en[b][color=GREEN])[/color][/b]                   la [b][color=GREEN]([/color][/b]cdr [b][color=BLUE]([/color][/b]assoc 8 ed[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]             [b][color=MAROON]([/color][/b]setq i [b][color=GREEN]([/color][/b]1+ i[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]
 
Sometimes a (princ) was required as the else statement in order to display.
 
This can be modified to work with tables as well
 
-David
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 17:04:26 | 显示全部楼层
I would go the same way as Marko, you can make it a defun so call it for multiple steps, we have something that does 5 steps so useful to see that something is happening.
 
  1. ; This is example code(setq  doc (vla-get-activedocument (vlax-get-acad-object))) ; open database(setq allblocks (vla-get-blocks doc)) ; get all the blocks in dwg(setq numinc (/ 100.0 (vla-get-count allblocks))) ; divide num of blocks as ratio of 100%(setq num 0.0)(acet-ui-progress-init "Block to bylayer" 100); heading - interval length heading could  be a variable(vlax-for block allblocks (acet-ui-progress-safe (setq num (+ num numinc))); update progressbar(command "delay" "100") ; dummy line as progress bar will just flash remove if doing lots of stuff) ;_ end of vlax-for (acet-ui-progress-done); dismiss progressbar(command "regen") ; remove progress bar
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-14 13:08 , Processed in 2.177109 second(s), 64 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表