本帖最后由 qcw911 于 2013-3-4 18:45 编辑
- (defun c:tt (/ ss i lst s1 pt e1 e2)
- ;;; (setq ss (ssget '((0 . "LINE"))))
- (setq xy (last (ssnamex (setq ss (ssget '((0 . "LINE")))) 0)))
- (setq x (last (cadr xy)) y (last (cadddr xy)))
- (command "RECTANG" x y)
- (setq myname (entlast))
- (setq i -1)
- (setq LSTe '())
- (setq LSTs '())
- (repeat (sslength ss)
- (setq s1 (ssname SS (setq i (1+ i)))
- pte (dxf 11 (entget s1))
- pts (dxf 10 (entget s1))
- lste (cons pte lste)
- lsts (cons pts lsts)
- )
- )
- (setq lsts (vl-sort lsts
- (function (lambda (e1 e2) (> (car e1) (car e2))))
- )
- )
- (setq lste (vl-sort lste
- (function (lambda (e1 e2) (> (car e1) (car e2))))
- )
- )
- (setq lst (append lsts lste)) ;合并元素
- (setq n (length lst )) ;表内元素个数
- (setq ii 0)
- (repeat n
- (setq ptn (nth ii lst))
- (setq ptn_x(car ptn))
- (setq ptn_y(cadr ptn))
- (setq x_x (car x))
- (setq x_y (cadr x))
- (setq y_x (car y))
- (setq y_y (cadr y))
-
- ;判断ptn点是否在x,y点形成的矩形区域内
- ;这块不会写 那个大侠帮帮忙
-
- (setq ii (1+ ii))
- )
-
- ;;; lst
- )
- (defun dxf (code elist) (cdr (assoc code elist)))
哪位大侠帮帮忙写一下
或者有其他思路??
|