lisp: (command pause)

I'm having trouble with a short lisp:(defun c:ii () (setq &last (entlast)) ;get last entity ... ;some (command "_insert") ;run insert (while (= (getvar "CMDNAMES") "INSERT") (command pause)(princ) ) ;wait until the user finishes inserting (if (not (equal &last (setq &b (entlast)))) (%hebatf &b) ;if there is a new entity (the insert) ;run my lisp on it ) (entupd &b))I want to launch the insert block dialog boxand after the user is done inserting the blockI want to run a lisp on the insert (involving hebrew attribs).1. (command "_insert") executes the command line version of insert. (command "insert") asks for an insertion snap2. (command pause) doesn't seem to work in Bricscad. I have trouble with other lisps.how do I execute the dialog box version of insertand then run a lisp on the resultant block?In autocad R14 I have no trouble (I use (c:ddinsert) to call the insert dialoge box)

Comments

  • correction: (command ... pause ...)does work. I tried it in another lisp.It seems to be the cmdnames loop.

  • I think that the Lisp engine they installed in ver 8, is not the same as with ver 7. It's is full of bugs. Try running the same lisp routine with acad, and see for yourself. I have similar problems with real numbers converted to strings, and inserting block with attributes, and much more. Even a .cui file that works fine with autocad, will not work with the new version. It loads OK, but crushes with execution of some lisp routines.Raam.

  • Here is a Lisp routine that will draw some points with elevations. the elevation of the point are converted from real numbers to a string and is noted next to the point. I submit here two files in which one of them has elevations that ends with zeros. for instance 78.00, the other file consist of the same points but with elevations that that ends with digits other then zero. Try running the lisp routine. The file that contains elevations of .00 will cause the computer to freeze.The lisp routine is as follows:;;; Dialog for point list file(defun ddopen (koteret ext) (setQ fn "~" ; Assume a ~ fd nil ; Assume no file descriptor ) (while (= "~" fn) (if (= 1 (setq fn (getfiled koteret "" ext 4))) (setq fn (getstring "\nList of Files ")) ) ) ;while (if (and fn ; Got filename? ------------1 (setq fd (open fn "r")) ; ...and can read the file? ) ;and ; ...and dialog def'n is okay? (progn (set_tile "title" fn) ; Place filename in dialog title area (start_list "list_box") ; Read file's contents into list box ) ;progn ) ;if-------1;;;-------------------------------------(SetQ ly fn j (StrLen ly) n 1 endname 0 startname 1)(Repeat j (SetQ sub$ (SubStr ly n 1)) (if (or (= (Ascii sub$) 58) (= (Ascii sub$) 92)) (SetQ startname n)) (if (= (Ascii sub$) 46) (SetQ endname (1- n))) (SetQ n (1+ n)))(SetQ ly (SubStr ly (+ 1 startname)))(if (/= endname 0) (SetQ ly (SubStr ly 1 (- endname startname))))(SetQ extension (Strcase (substr fn (+ 2 endname)))));; k = Length of number;; inc = number of digis after decimal point(defun DecPlace (z kk) (setq inc -1) (while (not (or (and (/= kk (setq inc (1+ inc))) (= "." (substr z (- kk inc) 1)) )))));;;------- Removes spaces left and right of string(Defun LspcR () (SetQ nn 1) (While (= (Substr rec nn 1) " ") (SetQ nn (1+ nn)) ) (SetQ rec (SubStr rec nn)) (SetQ n 1) (While (/= (Substr rec n 1) " ") (SetQ n (1+ n)) ));;;-------------PTFILE Main prog-------------;Drawing a point list with/without eleveation. with 2 or 3 or 4 digits after decimal point.;=========================================================================(Defun C:PTfile (/ cl act size i n nn x y z z1 k k1 prec rec a fn bl blk inc dialog) (DDOPEN "Select XYZ File" "tac") (SetQ dialog (GetVar "attdia")) (SetVar "attdia" 0) (SetQ #htxt 0.017 i 0 n 1) (command "LAYER" "m" "Pratim" "c" 4 "Pratim" " ") (while (SetQ rec (read-line fd)) (LspcR) (SetQ bl (Substr rec 1 (1- n))) (SetQ rec (SubStr rec (1+ n))) (LspcR) (SetQ y (Atof (Substr rec 1 (1- n)))) (SetQ rec (SubStr rec (1+ n))) (LspcR) (SetQ x (Atof (Substr rec 1 (1- n)))) (SetQ z (Atof (SubStr rec (1+ n)))) (SetQ x1 (+ x ( 0.002 #knm)) y1 (+ y (* 0.002 #knm)) ) (If (/= z 0) (Progn (Setq z (rtos z)) (SetQ k (Strlen z)) ;k = Length of string (DecPlace z k) ;k1 = nuber of digits left of decimal point. (SetQ k1 (- k inc 1) z1 (atof z) prec inc ;prec = number of digits right of decimal point z (StrCat (SubStr z 1 k1) " " (SubStr z (+ k1 2))) ) (Cond ((= prec 2) (If (= 6 k) (SetQ z (StrCat z " "))) (If (= 4 k) (SetQ z (StrCat " " z))) ) ((= prec 3) (If (= 6 k) (SetQ z (StrCat " " z))) (If (= 5 k) (SetQ z (StrCat " " z))) ) ((= prec 4) (If (= 8 k) (SetQ z (StrCat " " z))) (If (= 7 k) (SetQ z (StrCat " " z))) (If (= 6 k) (SetQ z (StrCat " " z))) ) );cond ) (SetQ z1 0.0 z " ") ) (entmake (list (cons 0 "POINT") (list 10 y x z1) (cons 8 "Pratim"))) (entmake (list (cons 0 "TEXT") (cons 8 "Pratim") (list 10 y1 x1 z1) (cons 40 #htxt) (cons 1 bl))) (SetQ n (1+ n)) (If z (entmake (list (cons 0 "text") (cons 8 "Pratim") (list 10 y x z1) (cons 40 #htxt) (cons 1 z) (cons 72 4) (list 11 y x z1))) ) (SetQ i (1+ i)) ) ;While (SetVar "attdia" dialog) (SetQ fd (Close fd)) (terpri)(princ))(c:ptfile)Point file 10.tac is as follows: 1 1167.07 5145.76 98.00 2 1166.24 5142.13 100.00 3 1166.51 5150.13 98.00 4 1165.64 5140.05 99.00 5 1162.85 5136.97 99.00 6 1149.43 5150.12 98.00 7 1150.25 5146.71 98.00 8 1150.68 5145.00 99.00 9 1150.91 5139.00 99.00Point file 10A.tac is as follows: 1 1167.07 5145.76 98.01 2 1166.24 5142.13 100.01 3 1166.51 5150.13 98.01 4 1165.64 5140.05 99.01 5 1162.85 5136.97 99.01 6 1149.43 5150.12 98.01 7 1150.25 5146.71 98.01 8 1150.68 5145.00 99.01 9 1150.91 5139.00 99.01Raam.

  • The old, slow and limited V7 Lisp engine has indeed been replaced by a modern engine which is much faster, supports much more functions, and has proven its quality for many years.It expects to run in a 100 % AutoCAD compatible environment though, and that is where problems that are currently revealed stem from: internal V8 and ODA lib functions, used by the Lisp engine, which are not (yet) behaving fully compatible. We encourage users who stumble on Lisp code issues, to report and document them using the Support Request pages on the Bricsys website: these requests are then assigned to our Lisp specialists who will solve them with priority. We highly appreciate your cooperation and we apologize for these growing pains.

  • Your reply is extremely encouraging. I understand from this that the existing bugs in the current lisp implementation will be worked out over the next few months, with our help. I am currently going over (slowly) our rather large library of lisps (about 700 kb) to try to get them to work in Bricscad V8. (I even managed to get autoload to work under V8.0.12)I notice that you have a developers area on your website with a "Lisp" section. I tried a number of times to ask for more information using the contact form, but got no answer.Who is eligible to enter this lisp section and what resources are available there?By the way, I find the occasional comment like this very interesting. Maybe, if someone in the Bricsys development team has any time :) they could start a small blog to discuss the development of V8 - progress and problems. We could offer encouragement and maybe a little help.

  • Dear Yaacov,Dear Raam,many thanks for your input here ...In main point, Hans is correct ... usually, the problem is not the Lisp engine itself - it has been originally designed for AutoCAD LT, to provide AutoLisp compatible Lisp engine in Acad LT environment.So at least, the new Lisp engine inside Bricscad originally targets to AutoLisp/AutoCAD compatible Lisp code ...But there are 2 major points at the moment :1. the details which Hans has spoken about (some not-yet-implemented, some incompatible, some functions with issues) in underlying Bricscad/ODA systems=> this will be fixed as quickly as ever possible2. some "old" Lisp code was designed for V6/V7 Bricscad - where some other/different Lisp functions were provided, like (imagemenu) ... we will do our best to get those V6/V7 Lisp functions still alive, not to brake V6/V7 Lisp code 3. currently, Bricscad redesigns the "dialog" based commands vs. "command-line" based commands to exactly meet AutoCAD's behaviour ... this additionally sometimes causes some trouble when such "dialog" commands are run from (command "cmdname") - where Acad always goes into command line ...=========Beside this, I will check the Lisp code you provided here, and will test it - for sure, it will work in very next future (some days, 1...2 weeks)

  • The Lisp section in the developers area contains information on how to port applications to run on Bricscad V6-V7, as well as some workarounds for known problems with the old engine. With the new Lisp engine our goal is to run legacy acad Lisp code as is, without requiring any modifications, and thus render these Lisp web pages obsolete.

  • But, to go back to my original problem:typing "insert" on the command line calls up the insert dialog box.(command "insert") doesn't. Instead it replies:"Snap to insertion of: NIL" I have tried various combinations of prefixes .XXX -XXX _ XXX ._XXX, etc.,but I don't get the dialog box, just the command line version of "insert".The command line and (command "...") should give the same result, in my opinion.Has anybody noticed any other commands with different results?

  • I see from Torsten Moses' post that this behavior is supposed to precisely imitate Autocad. I'm of course for this. I guess this happens in advanced versions of Autocad, we're still using R14. Hey, I just noticed ddinsert.lsp and .dcl in the R14 support folder, and with the permissive copyright notice, I can use it for Bricscad. What's more, my users will be used to it. This solves my problem.I like the new folder list dialog box for support file search path in "Settings".

  • about (command "insert") asking for a snap point, this has been fixed. The fix will be available in the next update.kind regards,Alexander Van Heuverzwyn,Bricsys

  • Dear Yaacov,Dear Raam,for the command name problems :2 points :Acad has introduced (initdia t/nil) a while ago - to "force" the dialog box version of particular commands (around 12...14 specific commands)=> this is about to be implemented in Bricscad as wellBeside this, there is a major redesign pending, regarding the Acad compatible command naming conventions :plot vs -plotbhatch vs -bhatchetc. where the "-" version of command names always go into commandline, where the "normal2 version depends on situation : from Lisp/Script, it remains in command line, but from command line, it opens the dialog box(beside the (initdia) mechanism, which does not apply to all commands)On the other side, Acad R14 is not 2old" - but Adesk changed major designs in Acad 2000 then ...Beside this, I'm just working on your routines (was tooo much thhngs to do in the past days :-))Many greetings to allTorsten

  • does that mean that (for example)(command "-insert" ...) and (command "insert" ...) will both be in command line mode?and that (initdia T)(command "insert") will force the dialog box?

  • Yes, it means this exactly :-)With (initdia) or (initdia 1), the next (and only the next) command will be forced to use dialog mode - this applies to approx. 12 commands as defined by AutoLisp; but we might decide to use that logic for even more commands.In generally, using (command "xxx" ...) will always force that command XXX to go into command line interface (if available in generally) - but this can be overriden then by (initdia);We will implement this soon -(initdia) is already present in lisp engine, but not yet functional.-----Regarding your sample code :I'm finished with testing and fixing the code - it is documented in forum id=7255http://www.bricsys.com/protected/en_INTL/support/forumthread.jsp?id=7255Please have a look there.

  • Thanks! Topic ID=7255 has revisions for Raam Finzi's code.Did you look at mine?particularly concerning that CMDNAMES loop.

  • Dear Yaacov,I have just tried your CMNAMES loop ...In fact, not (getvar "CMDNAMES") is the problem - but the (command pause) during _insert command.Also from other feedback, it is now proven, that there is a synchronisation problem, if both Lisp and an active running command (like _insert, _line etc) request input ... it is a kind of "concurrent" input request then.This problem is currently under development to fix the related problems.At this moment, no real solution or workaround for this :-(Many greetingsTorsten

  • I understand from your reply that(command pause)doesn't work for the time being.A possible workaround would be to implement the command prompts in lisp (or only those parts that you need)(setq myvariable (getkword "\n...and then feed the variables to(command "CMD" myvariable ...This might be rather cumbersome for some of the more elaborate commands (especially as the prompt sequence sometimes changes according to the state of the entity - open or closed pline, etc.)Do you have any estimate as to when this will be fixed? in general, weeks or months? I would be able to decide whether to invest the time in revising some of my lisps to compensate. Thanks!

  • Dear Yaacov,as you also found, (command pause) sometimes works ... it simply depends on the context and particular command.Also, you are correct regarding redesign of Lisp routines - your suggestion will work, as we also verified yet.Your main question :I guess, it will take a few weeks, until all issues around (command pause) and related other constructions like(setq pt (getpoint))(command pt)in a loop ...will be fixed - but fo rsure, not months ...In an ycase, please keep us updated if you encounter any other issues.Many greetingsTorsten

  • Thanks! I appreciate the work you must be doing.It would be really helpful if someone could write up a short summary of the outstanding issues and problems with lisp in V8 and a rough timeline for solution. I could then figure out how to organize adapting my lisp library to v8. We bought 5 seats of V8 and intend to start installing them to our users before the end of the year, by around November, so Bricscad has to be usable for us by then.

  • Why is this happening to me with 19.1 BricsCAD just purchased today 12-28-15?

  • Bill, you need to explain more clearly what you mean. This is a very old topic in which a number of issues are discussed. If I were you I would start a new topic with some sample code.
This discussion has been closed.