Is there a way to have the user either select a point or input a keyword during a lisp routine?... i.e. the pline command... once started you can continue selecting points or you can type "arc" or such and then continue selecting points. Thanks.
|
Is there a way to have the user either select a point or input a keyword during a lisp routine?... i.e. the pline command... once started you can continue selecting points or you can type "arc" or such and then continue selecting points. Thanks.
Higarberadam,
for this question
"Is there a way to have the user either select a point or input a keyword during a lisp routine?... "
you can use
1). (setq ss (car (entsel "\nSelect a object")))
2). (setq ss (ssget "x" '((0 . "LINE,PLINE",ARC....etc"))))
for others question,I'm cannot answerd,because rather confuse (maybe I stupid).
Originally Posted by garberadam
I'm sorry i guess i was confusing earlier.... what i want is for the user to be able to pick points to draw a line.... then type a string.... then go back to picking points.....
If i use the getpoint command i can't input a string... if i use the getstring i can't pick a point with the cursor.. how do i enable both at the same time?... sorry for the confusion.. i don't know if my explanation helps... i guess i just want to redo the polyline command.. with my own options...... i don't know how else to explain it though....
Hi garberadam,
do you mean like this
Code:(defun c:test (/ cth p1 p2 p3 str cth th) (while (setq p1 (getpoint "\nClick any location<0,0,0>: ")) (if (= p1 "")(setq p1 '(0 0 0))) (setq p2 (getpoint p1"\nClick any location<0,0,0>: ")) (if (= p2 "")(setq p2 '(10 0 0))) (command "_line" p1 p2 "") (setq str (getstring "\nEnter new string: ")) (setq p3 (getpoint "\nClick where to put string: ")) (setq cth (getvar "textsize")) (setq th (getdist (strcat "\nEnter text height< " (rtos cth) " >: "))) (if (= th nil)(setq th cth)) (command "_text" p3 th "" str 0) ) (princ) )
Originally Posted by garberadam
This is the solution
: ) Happy Computing !Code:(command "._pline" ) (while (= 1 (logand (getvar "CMDACTIVE") 1 )) (command PAUSE ) )
kennet
From AutoCAD Developer's Help, look at the arbitrary keyboard input.Originally Posted by garberadam
Originally Posted by AutoCAD Developer's Help
If you have a technical question, please find the appropriate forum and ask it there.
You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
jUSt
This is an option, although it will not allow the space character. Single words only.
If you need spaces in the text you will have to use grread.
Code:(defun c:getline (/ pt1 strlst pstart) (while (cond ((progn (initget 128) (null (if pstart (setq pt1 (getpoint pstart "\nSelect Next Point or enter Text: ")) (setq pt1 (getpoint "\nSelect 1st Point or enter Text: ")) ) ) ) nil ; exit loop ) ((= 'STR (type pt1)) ; collect user input (setq strlst (cons pt1 strlst)) ) ((= 'LIST (type pt1)) (if pstart (command "_.line" pstart pt1 "") ) (setq pstart pt1) ) ) ) strlst ; return a list of the keyword strings entered by the user )
I think the answer to your question is the "initget" function?! It is specifically designed to do exactly what you want. What you do with the user input is up to you. You have to write the necessary code using while, if and/or cond etc to handle the user input.
Here is an example:
Code:(while (/= (type INSPT) 'LIST) (initget "T M B O") (setq INSPT (getpoint PT1 "\nInsert point or [Top/Middle/Bottom](Options...): ")) (cond ((= INSPT "T") (setq PT1 SP) ) ((= INSPT "M") (setq PT1 (list (car SP) (- (cadr SP) (/ D 2.00)) (caddr SP))) ) ((= INSPT "B") (setq PT1 (list (car SP) (- (cadr SP) D) (caddr SP))) ) ((= INSPT "O") (setq WHAT_NEXT 2 INSPT '(0 0)) (ppn:vla-delete-ss SS1) ) ((= INSPT nil) (setq WHAT_NEXT 0 INSPT '(0 0)) (ppn:vla-delete-ss SS1) ) ) )
THANK YOU THANK YOU THANK YOU..... you guys are great!!!!!!!!!!!