(getint) or (getpoint)
I need lisp to choose (getint) or (getpoint)(setq txt(getint))
(setq pt(getpoint))
If I have txt I do not need pt
and if I have pt I do not need txt
so I need to choose beteen pt and txt on one process.
regards, Something like this?
(cond((and txt pt) (princ "Both are present. Error?"))(txt (setq pt (getpoint "\nSelect point")))(pt (setq txt (getint "\nWhats the text?")))(t (princ "Neither are present..."))) Hi,
Try this:
(or (setq no (getint "\nEnter an integer:")) (setq pt (getpoint "\nSpecify a point :")) ) ; (get_pt_or_int "\nPick a point : " "\nSpecify int : ")(defun get_pt_or_int ( mp mi ) (cond ( (progn (initget "Exit") (getpoint mp)) ) ( (progn (initget "Exit") (getint mi)) ) ( (get_pt_or_int mp mi) ) ); cond); defun
Or -
(progn (initget 128 "Exit") (getpoint "\nSpecify input : "))
But you'd need to process it, it will return strings from keyboard inputs, such as: "123". May be this
...
maybe this
(while (progn (initget 128) (setq var (getpoint "\nInsertion point or Number: ")) ) (print var))Command:Insertion point or Number:(-2.43958 704.87 0.0)Insertion point or Number:"aaa"Insertion point or Number:"123"Insertion point or Number:As you can see, you can pick a point or you can type something. The output is a list (a point) or a string. You only need to check the input validity. Give this a try
(if (and (setq e (car (nentsel "\nSelect Level: "))) (setq en (entget e)) (setq typ(cdr (assoc 0 en))) ) (progn (cond( (eq typ "MTEXT")(setq ent (cdr (assoc 0 en))) )( (eq typ "TEXT")(setq ent (cdr (assoc 0 en))) )( (eq typ "POINT")(setq ent (cdr (assoc 0 en))) ) ); cond ) )
And change DXF number to what ever you want
(assoc 0 en)
页:
[1]