马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
 - (defun c:tt (/ ss len fuzz el s)
- (if (and (setq ss (ssget '((0 . "LWPOLYLINE") (8 . "DGX"))))
- (> (sslength ss) 1) ;_加个判断,一般不会出现
- (setq len (getdist "\n输入最小阀值: "))
- (setq fuzz (getdist "\n输入最小间隙: "))
- )
- (progn
- (XD::Begin)
- (setq el (mapcar '(lambda (x)
- (list (xdrx_getpropertyvalue x "Elevation") x)
- )
- (xdrx_pickset->ents ss)
- )
- el (mapcar 'cdr
- (vl-remove-if
- '(lambda (x) (= (length x) 1))
- (XD::List:GroupByIndex el 0)
- )
- )
- )
- (setq
- el (mapcar
- '(lambda (x / xx a b c asp aep ep pts p)
- (setq xx x)
- (while xx
- (setq a (car xx)
- b xx
- asp (xdrx_curve_getstartpoint a)
- aep (xdrx_curve_getendpoint a)
- ep (fix (xdrx_curve_getendparam a))
- )
- (while (setq b (cdr b))
- (setq c (car b)
- pts (list (xdrx_curve_getstartpoint c)
- (xdrx_curve_getendpoint c)
- )
- )
- (if (and (not (vl-position asp pts))
- (setq
- p (vl-remove-if-not
- '(lambda (d) (equal asp d fuzz))
- pts
- )
- )
- )
- (xdrx_polyline_setpointat a 0 (car p))
- )
- (if (and (not (vl-position aep pts))
- (setq
- p (vl-remove-if-not
- '(lambda (d) (equal aep d fuzz))
- pts
- )
- )
- )
- (xdrx_polyline_setpointat a ep (car p))
- )
- )
- (setq xx (cdr xx))
- )
- x
- )
- el
- )
- )
- (foreach x el
- (setq s (XD::Entity->Pickset x))
- ;;(command-s ".pedit" "m" s "" "j" fuzz "");_高版本用这个更高效
- (vl-cmdf ".pedit" "m" s "" "j" fuzz "")
- )
- )
- (XD::End)
- )
- (princ)
- )
|