以下是一些帮助您入门的代码:
- (defun c:pltx ( / pt )
- (if (setq pt (gettextpoint))
- (progn
- (command "_.3dpoly" "_non" pt)
- (while (setq pt (gettextpoint))
- (command "_non" pt)
- )
- (command "")
- )
- )
- (princ)
- )
- (defun gettextpoint ( / x y z )
- (if
- (and
- (setq x (getnumericaltext "\nSelect X-Value Text <Exit>: "))
- (setq y (getnumericaltext "\nSelect Y-Value Text <Exit>: "))
- (setq z (getnumericaltext "\nSelect Z-Value Text <Exit>: "))
- )
- (list x y z)
- )
- )
- (defun getnumericaltext ( msg / ent enx num )
- (while
- (progn (setvar 'errno 0) (setq ent (car (nentsel msg)))
- (cond
- ( (= 7 (getvar 'errno))
- (princ "\nMissed, try again.")
- )
- ( (= 'ename (type ent))
- (setq enx (entget ent))
- (cond
- ( (not (wcmatch (cdr (assoc 0 enx)) "TEXT,MTEXT,ATTRIB"))
- (princ "\nPlease select Text, MText or Attribute.")
- )
- ( (not (setq num (distof (cdr (assoc 1 enx)))))
- (princ "\nSelected text is not numerical.")
- )
- )
- )
- )
- )
- )
- num
- )
|