本帖最后由 qazxswk 于 2024-5-3 14:50 编辑
看了你那个文件,你那里面的线段长度,介于19-21之间,所以要做范围内删除。
- (defun c:11(/ ss i j ent obj len)
- (vl-load-com)
- (setq ss (ssget "x" '((0 . "ARC,LWPOLYLINE,LINE,CIRCLE,SPLINE"))) i -1 j 0)
- (while
- (setq ent (ssname ss (setq i (1+ i))))
- (setq obj (vlax-ename->vla-object ent))
- (setq len (vlax-curve-getdistatparam obj(vlax-curve-getendparam obj)))
- (if(and(< len 21.0)(> len 19.0))(progn(entdel ent)(setq j (+ j 1))))
- )
- (princ (strcat "已删除 "(itoa j) " 条线段。"))
- (princ))
|