输入模糊距离合并线,弧和多义线
;;; 用模糊距离连接线,弧和多义线(defun c:jf () (c:pljoinfuzz)) ; this line can be commented out if there is an existing command called jf
(defun c:pljoinfuzz (/ ss1 entLine objType oldcmdecho oldpeditaccept fuzz okObjects)
(setq oldcmdecho (getvar "cmdecho"))
(setq oldpeditaccept (getvar "PEDITACCEPT"))
(setvar "cmdecho" 0)
(setq A2k4 (>= (substr (getvar "ACADVER") 1 2) "16"))
(if A2k4 (setvar "PEDITACCEPT" 0))
(setqokObjects '((0 . "LINE,ARC,POLYLINE,LWPOLYLINE")))
(princ "\nSelect object to join: ")
(setq ss1 (ssget okObjects))
(setq fuzz (getdist "\nFuzz distance <0>: "))
(if (= fuzz nil) (setq fuzz 0))
(if (/= ss1 nil)
(progn
(setq objType (cdr (assoc 0 (entget (setq entLine (ssname ss1 0))))))
(if (= (sslength ss1) 1) (setq ss1 (ssget "X" okObjects)))
(if (member objType '("LINE" "ARC"))
(command "_.pedit" "_M" ss1 "" "_Y" "_J" "_J" "_B" fuzz "")
(command "_.pedit" "_M" ss1 "" "_J" "_J" "_B" fuzz "")
)
)
)
(setq ss1 nil)
(setvar "cmdecho" oldcmdecho)
(if A2k4 (setvar "PEDITACCEPT" oldpeditaccept))
(princ)
)
最小距离为3.0
;;; **********用模糊距离连接线,弧和多义线***************
(defun c:jf ()
(c:pljoinfuzz)
)
(defun c:pljoinfuzz (/ ss1 entLine objType oldcmdecho oldpeditaccept fuzz okObjects)
(setq oldcmdecho (getvar "cmdecho"))
(setq oldpeditaccept (getvar "PEDITACCEPT"))
(setvar "cmdecho" 0)
(setq A2k4 (>= (substr (getvar "ACADVER") 1 2) "16"))
(if A2k4 (setvar "PEDITACCEPT" 0))
(setqokObjects '((0 . "LINE,ARC,POLYLINE,LWPOLYLINE")))
(princ "\nSelect object to join: ")
(setq ss1 (ssget okObjects))
(setq fuzz (getdist "\n模糊距离为<3.0>: "))
(if (= fuzz nil)
(setq fuzz (* (getvar "DIMSCALE") 3.0))
)
(if (/= ss1 nil)
(progn
(setq objType (cdr (assoc 0 (entget (setq entLine (ssname ss1 0))))))
(if (= (sslength ss1) 1)
(setq ss1 (ssget "X" okObjects))
)
(if (member objType '("LINE" "ARC"))
(command "_.pedit" "_M" ss1 "" "_Y" "_J" "_J" "_B" fuzz "")
(command "_.pedit" "_M" ss1 "" "_J" "_J" "_B" fuzz "")
)
)
)
(setq ss1 nil)
(setvar "cmdecho" oldcmdecho)
(if A2k4 (setvar "PEDITACCEPT" oldpeditaccept))
(princ)
)
;; 感觉高版本的有问题
;; 用模糊距离连接线,弧和多义线
(defun c:tt ()
(setvar "PEDITACCEPT" 1)
(setq fuzz (Udist 5 "" "距离<输入或鼠标直接量取>" fuzz nil))
(setq qf '((0 . "LINE,ARC,*POLYLINE")))
(princ "\n选择实体<退出>: ")
(if (setq ss (ssget qf))
(command "_.pedit" "_M" ss "" "_J" "_J" "_B" fuzz "")
)
(princ)
) xyp1964 发表于 2019-2-26 13:24
;; 感觉高版本的有问题
命令 pm - j - j 下面合并类型中 添加(A) 及两者都(B) 对模糊距离不起作用,不知道版主能不能给支个招?
说明白点,就是设置了模糊距离只对合并类型中的 延伸 有效,试了好久都这样,不知道是什么原因? 支持分享 经过使用,这个lisp是相当的霸气啊,好用! 谢谢楼主分享,正需要这种程序 支持,这个好使! 好像只有“0”,和非“0”两种模式样的。 非常不错,能不能去掉模糊输入直接链接成一条线?而非像补丁起来的线。 楼主这合并多段线确实强大,顶上,让大家受惠~ 这个程序能不能再改一下?现在多线相交时会分别组成两部分,我想全部线都闭合在一起。 老师能不能不要输入距离,把距离固定直接选线合并我要的是距离300以下的都合并