guigonse 发表于 2022-7-5 15:58:43

Flush princ/prompt/write-char

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 onewith 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 "") 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

marko_ribar 发表于 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...

guigonse 发表于 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...

marko_ribar 发表于 2022-7-5 16:38:43

Also worth of mentioning...
 
http://www.theswamp.org/~john/avlisp/#grtext

David Bethel 发表于 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 )
 

(defun c:vprog (/ ss i en ed la) (and (setq ss (ssget "X"))      (setq i 0)      (while (setq en (ssname ss i))             (princ "\t\t\r")             (prin1 en)             (setq ed (entget en)                   la (cdr (assoc 8 ed)))             (setq i (1+ i)))) (prin1))
 
Sometimes a (princ) was required as the else statement in order to display.
 
This can be modified to work with tables as well
 
-David

BIGAL 发表于 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.
 

; This is example code(setqdoc (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 couldbe 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
页: [1]
查看完整版本: Flush princ/prompt/write-char