fathihvac Posted April 14, 2013 Posted April 14, 2013 Hello, Looking for an autolisp that draws continously polyline and with right clic dropdown list allow to change to arc or spline . Quote
Stefan BMR Posted April 14, 2013 Posted April 14, 2013 If I understand correctly and if you have DosLib installed, try this (defun c:test (/ cmd_list cmd p1) (setq cmd_list '("Pline" "Arc" "Spline" "Exit")) (while (and (setq cmd (dos_popupmenu cmd_list)) (/= cmd 3) ) (command (nth cmd cmd_list)) (if p1 (command p1)) (while (= 1 (getvar 'cmdactive)) (command "\\") ) (setq p1 (getvar 'lastpoint)) ) (princ) ) Quote
fathihvac Posted April 14, 2013 Author Posted April 14, 2013 Thank you very much Stefan BMR good working. Quote
fathihvac Posted April 17, 2013 Author Posted April 17, 2013 Hello Stefan BMR , I tried to use your code with my autolisp custom commands it gives "unknown command press "F1" for help" ,to your knowledge the autolisps are already loaded and my custom commands run when launched from my custom toolbar.Any help. Quote
Stefan BMR Posted April 17, 2013 Posted April 17, 2013 Hi fathihvac It must be some misspelling in your loading routine or in macro assignment. Please double check lisp file name, command name and macro command. I can not suspect anything else going wrong. Quote
Lee Mac Posted April 17, 2013 Posted April 17, 2013 fathihvac (a.k.a. baali) see your thread here. Quote
mdbdesign Posted April 18, 2013 Posted April 18, 2013 I try to replace existing command with other but circle only work. Does it got any limitation or need to rewrite something in program? It is actually very handy. Quote
Lee Mac Posted April 18, 2013 Posted April 18, 2013 I try to replace existing command with other but circle only work. Does it got any limitation or need to rewrite something in program? It is actually very handy. Try this Marek: (defun c:test ( / cmd lpt lst ) (setq lst '("Pline" "Arc" "Spline" "Circle" "Exit")) (while (and (setq cmd (dos_popupmenu lst)) (/= "EXIT" (strcase (nth cmd lst))) ) (command (nth cmd lst)) (if lpt (command lpt)) (while (= 1 (getvar 'cmdactive)) (vl-cmdf "\\") ) (setq lpt (getvar 'lastpoint)) ) (princ) ) Quote
Stefan BMR Posted April 18, 2013 Posted April 18, 2013 Hi MD OP specifically asks to draw continuously some specific objects. In this particularly case, each command demands a point as a first input. If you try commands that need something else as a first input, i.e. select object, then obviously is not going to work. You may try this, but do not try to call Text, Mtext, Save, Open etc. USE IT ON YOUR OWN RISK. (defun c:test (/ cmd_list cmd cmd_name) (setq cmd_list '("Line" "Move" "Copy" "Offset" "Trim" "Erase" "Exit")) ; don't forget to put "exit" option (while (and (setq cmd (dos_popupmenu cmd_list)) (setq cmd_name (strcase (nth cmd cmd_list))) (not (eq cmd_name "EXIT")) ) (if (not (wcmatch cmd_name "*TEXT,*DIM*,*LEADER,OPEN,SAVE")) (progn (command cmd_name) (while (= 1 (getvar 'cmdactive)) (command "\\") ) ) ) ) (princ) ) Quote
mdbdesign Posted April 18, 2013 Posted April 18, 2013 Add all command form Lee and Stefan routines into one. Another speed increase for me. Nice thing, this drop down stay at cursor, no more running for icon or typing. -Is there any particular reason why not to use Command mentioned by Stefan? Another thing: try to call lisp from inside this routine and it fail. Is it supporting only native Autocad commands? Maybe I want to much... Quote
Stefan BMR Posted April 19, 2013 Posted April 19, 2013 Marek I just tried Mtext command and my screen filled up with "\" and I could exit only by pressing escape. I thought this may cause AutoCAD to stuck and that's why I say not to use some commands, especially those who prompt for string. I didn't try Open or Save but, just in case, I added them on "forbidden" list. Maybe I overreacted. About calling another lisp, try this (defun c:test (/ cmd_list cmd) (setq cmd_list '("Line" "Pline" "Spline" "Arc" "Circle" "Ellipse" "Erase" "Trim" "Extend" "Offset" "" ; separator. Do not remove it. Do not add another separator. ; Add autocad native commands only above separator ; Add lisp defined command only after separator "Lisp1" "Lisp2") ) (if (setq cmd (dos_popupmenu cmd_list)) (if (< cmd (vl-position "" cmd_list)) (command (nth cmd cmd_list)) (eval (read (strcat "(C:" (nth (1+ cmd) cmd_list) ")"))) ) ) (princ) ) You will notice it is not working exactly like the other one. Maybe it can be improved, but for now just try it and tell me what you think. Quote
mdbdesign Posted April 19, 2013 Posted April 19, 2013 No need for improvement for now. Work very well. Sometime I got work that require same set of commands, like repeating sequences that where it becoming handy. Thank you for it. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.