;These functions are freeware courtesy of the author's of "Inside AutoLisp" ;for rel. 10 published by New Riders Publications. This credit must ;accompany all copies of this function. ;* UANGLE User interface angle function ;* BIT (1 for no null, 0 for none) and KWD key word ("" for none) are same as ;* for INITGET. MSG is the prompt string, to which a default real in rads is ;* added as (nil for none), and a : is added. BPT is base point (nil ;* for none). ;* (defun uangle (bit kwd msg def bpt / inp) (if def (setq msg (strcat "\n" msg " <" (if(eq(type def)'STR)def(angtos def)) ">: ") bit (* 2 (fix (/ bit 2))) ) (setq msg (strcat "\n" msg ": ")) ) (initget bit kwd) (setq inp (if bpt (getangle msg bpt) (getangle msg) ) ) (if inp inp def) );defun ;* (princ) ;* ;* UDIST User interface function ;* BIT (0 for none) and KWD key word ("" for none) are same as for INITGET. ;* MSG is the prompt string, to which a default real is added as (nil ;* for none), and a : is added. BPT is base point (nil for none). ;* (defun udist (bit kwd msg def bpt / inp) (if def (setq msg (strcat "\n" msg " <" (rtos def) ">: ") bit (* 2 (fix (/ bit 2))) );setq (setq msg (strcat "\n" msg ": ")) );if (initget bit kwd) (setq inp (if bpt (getdist msg bpt) (getdist msg) ) );setq&if (if inp inp def) );defun ;* (princ) ;* ;* UINT User interface function ;* BIT (0 for none) and KWD key word ("" for none) are same as for INITGET. ;* MSG is the prompt string, to which a default real is added as (nil ;* for none), and a : is added. ;* (defun uint (bit kwd msg def / inp) (if def (setq msg (strcat "\n" msg " <" (rtos def 2 0) ">: ") bit (* 2 (fix (/ bit 2))) ) (setq msg (strcat "\n" msg ": ")) );if (initget bit kwd) (setq inp (getint msg)) (if inp inp def) );defun ;* (princ) ;* ;* UKWORD User key word. DEF, if any, must match one of the KWD strings ;* BIT (1 for no null, 0 for none) and KWD key word ("" for none) are same as ;* for INITGET. MSG is the prompt string, to which a default string is added ;* as (nil or "" for none), and a : is added. ;* (defun ukword (bit kwd msg def / inp) (if (and def (/= def "")) (setq msg (strcat "\n" msg " <" def ">: ") bit (* 2 (fix (/ bit 2))) );setq );if (initget bit kwd) (setq inp (getkword msg)) (if inp inp def) );defun ;* ;* UPOINT User interface point function ;* BIT (1 for no null, 0 for none) and KWD key word ("" for none) are same as ;* for INITGET. MSG is the prompt string, to which a default point variable ;* is added as (nil for none), and a : is added. BPT is base point ;* (nil for none). ;* (defun upoint (bit kwd msg def bpt / inp) (if def (setq pts (strcat (rtos (car def)) "," (rtos (cadr def)) (if (and (caddr def) (= 0 (getvar "FLATLAND"))) (strcat "," (rtos (caddr def))) "" ) );if&strcat msg (strcat "\n" msg " <" pts ">: ") bit (* 2 (fix (/ bit 2))) ) (setq msg (strcat "\n" msg ": ")) );if a default was supplied (initget bit kwd) (setq inp (if bpt (getpoint msg bpt) (getpoint msg) ) );setq&if (if inp inp def) );defun ;* (princ) ;* ;* UREAL User interface real function ;* BIT (0 for none) and KWD key word ("" for none) are same as for INITGET. ;* MSG is the prompt string, to which a default real is added as (nil ;* for none), and a : is added. ;* (defun ureal (bit kwd msg def / inp) (if def (setq msg (strcat "\n" msg " <" (rtos def 2) ">: ") bit (* 2 (fix (/ bit 2))) ) (setq msg (strcat "\n" msg ": ")) );if (initget bit kwd) (setq inp (getreal msg)) (if inp inp def) );defun ;* (princ) ;* ;* USTR User interface string ;* If BIT=1 no null "" input allowed, 0 for none, BIT ignored if DEF present. ;* MSG is the prompt string, to which a default string is added as (nil ;* or "" for none), and a : is added. If SPFLAG T, spaces are allowed in ;* string. ;* (defun ustr (bit msg def spflag / inp nval) (if (and def (/= def "")) (setq msg (strcat "\n" msg " <" def ">: ") inp (getstring msg spflag) inp (if (= inp "") def inp) );setq (progn (setq msg (strcat "\n" msg ": ")) (if (= bit 1) (while (= "" (setq inp (getstring msg spflag)))) (setq inp (getstring msg spflag)) ) );progn&if );if inp );defun ;* (princ) ;*