我知道这个帖子已经过时了,但我最近在练习/玩这些:
- ; Grrr
- ; Another attempt for emaking pline (loop with cond behaviour):
- (defun C:test ( / oldcmd ptx pt ptlst cnt )
- (setq oldcmd (getvar 'cmdecho))
- (while T
- (setvar 'cmdecho 0)
- (initget 1 "D Done")
- (while
- (cond
- (
- (not
- (if ptx
- (setq pt (getpoint "\nSpecify point or [Done]: " ptx))
- (setq pt (getpoint "\nSpecify point or [Done]: " ))
- )
- )
- (princ "\nYou must specify a point!")
- )
- ( (and (= (type pt) 'LIST) (not (or (= (type pt) 'STR) (= pt "") )) )
- (setq ptx pt)
- (setq ptlst (cons pt ptlst))
- (if (>= (length ptlst) 2)
- (progn
- (setq cnt 0)
- (redraw)
- (repeat (length ptlst)
- (if (nth (+ cnt 1) ptlst)
- (progn
- (grdraw (nth cnt ptlst) (nth (+ cnt 1) ptlst) 2 3)
- (setq cnt (+ cnt 1))
- )
- )
- )
- )
- )
- )
- (
- (or
- (and (wcmatch pt "DONE") (>= (length ptlst) 2) )
- (and (wcmatch pt "D") (>= (length ptlst) 2) )
- )
- (redraw)
- (if
- (and
- (entmake '( (0 . "POLYLINE") (66 . 1)))
- (setq cnt 0)
- (repeat (length ptlst)
- (entmake (list (cons 0 "VERTEX") (cons 10 (nth cnt ptlst))))
- (setq cnt (+ cnt 1))
- )
- (entmake '((0 . "SEQEND")))
- )
- (progn
- (setq ptx nil)
- (setq pt nil)
- (setq ptlst nil)
- (setq cnt nil)
- )
- )
- )
- );cond
- )
- (setvar 'cmdecho oldcmd)
- )
- (princ)
- )
由于我的grread练习:
我以前也见过类似的LISP,但当我试图使用grread分析光标移动并按下LMB时,意外地得到了这个结果。 |