(setq en (car (entsel "选择直线L:")))
(setq dis2line (getreal "\n输入点范围:"))
(if (and en dis2line)
(progn
(setq pt1 (cdr (assoc 10 (entget en))))
(setq pt2 (cdr (assoc 11 (entget en))))
;;(princ (angle pt1 pt2))
(setq
ranlst (list
(polar pt1 (- (angle pt1 pt2) (/ 
I 2)) dis2line)
(polar pt1 (+ (angle pt1 pt2) (/ 
I 2)) dis2line)
(polar pt2 (- (angle pt2 pt1) (/ 
I 2)) dis2line)
(polar pt2 (+ (angle pt2 pt1) (/ 
I 2)) dis2line)
)
)
(setq s1 (ssget "wP" ranlst '((0 . "point"))))
;;(setq s1 (ssget "CP" ranlst '((0 . "INSERT") (8 . "GCD"))))
)
)
)
)
(SETQ n 0)
(setq size 0.1)
;;;-------------------分配点表 --------
(repeat (sslength s1)
(setq lst (cons (ssname s1 n) lst)
n (1+ n)
)
)
;;;---进行XY值比较计算后对列表排序----------------
(setq
x (mapcar '(lambda (x) (car (cdr (assoc 10 (entget x))))) lst)
)
(setq
y (mapcar '(lambda (x) (cadr (cdr (assoc 10 (entget x)))))
lst
)
)
(setq maxx (eval (cons 'max x))
minx (eval (cons 'min x))
)
(setq maxy (eval (cons 'max y))
miny (eval (cons 'min y))
)
(setq dx (- maxx minx)
dy (- maxy miny)
)
(princ dy)
(if (> dx dy)
;;x坐标排序:
(setq S2 (SORT-SE S1 10 0 (* 0.1 SIZE) nil))
;;y坐标排序:
(setq S2 (SORT-SE S1 10 1 (* 0.1 SIZE) t))
)
;;;-----------投影各点到断面线上-------------
(progn
(setq I 0)
(repeat (sslength S2)
(setq pen_data (entget (ssname s2 i)))
(setq ppt (assoc 10 pen_data))
(setq pp (cdr ppt))
(setq 
erpt (vlax-curve-getClosestPointTo (car en) pp T))
;;找出垂点
(entmake (APPEND '((0 . "LINE")
(100 . "AcDbEntity")
(100 . "AcDbLine")
(8 . "0")
(62 . 2)
)
(LIST (CONS 10 pp) (CONS 11 perpt))
)
)
(princ "\n")
(princ (cadddr (assoc 10 (entget (ssname S2 I)))))
;;显示排序结果。
为何提示参数错误