moha_aga Posted February 15, 2018 Share Posted February 15, 2018 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, Quote Link to comment Share on other sites More sharing options...
Aftertouch Posted February 15, 2018 Share Posted February 15, 2018 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...") ) ) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 15, 2018 Share Posted February 15, 2018 Hi, Try this: (or (setq no (getint "\nEnter an integer <Enter to get point instead> :")) (setq pt (getpoint "\nSpecify a point :")) ) Quote Link to comment Share on other sites More sharing options...
Grrr Posted February 15, 2018 Share Posted February 15, 2018 ; (get_pt_or_int "\nPick a point [Exit] <int>: " "\nSpecify int [Exit] <point>: ") (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 [Exit]: ")) But you'd need to process it, it will return strings from keyboard inputs, such as: "123". Quote Link to comment Share on other sites More sharing options...
asos2000 Posted February 15, 2018 Share Posted February 15, 2018 (edited) May be this ... Edited February 15, 2018 by asos2000 Missunderstand Quote Link to comment Share on other sites More sharing options...
Stefan BMR Posted February 15, 2018 Share Posted February 15, 2018 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, 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. Quote Link to comment Share on other sites More sharing options...
asos2000 Posted February 15, 2018 Share Posted February 15, 2018 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) Quote Link to comment Share on other sites More sharing options...
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.