flyfox1047 发表于 2013-12-1 23:06:25

输入模糊距离合并线,弧和多义线

;;; 用模糊距离连接线,弧和多义线
(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)
)

尘缘一生 发表于 2018-9-22 07:06:28

最小距离为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)
)

xyp1964 发表于 2019-2-26 13:24:47

;; 感觉高版本的有问题
;; 用模糊距离连接线,弧和多义线
(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)
)

ddbegg 发表于 2019-6-19 08:40:25

xyp1964 发表于 2019-2-26 13:24
;; 感觉高版本的有问题

命令 pm - j - j 下面合并类型中 添加(A) 及两者都(B) 对模糊距离不起作用,不知道版主能不能给支个招?
说明白点,就是设置了模糊距离只对合并类型中的 延伸 有效,试了好久都这样,不知道是什么原因?

ynhh 发表于 2013-12-2 08:14:57

支持分享

eddydqiao 发表于 2014-11-13 17:33:11

经过使用,这个lisp是相当的霸气啊,好用!

fjb007 发表于 2014-11-14 12:14:13

谢谢楼主分享,正需要这种程序

434939575 发表于 2015-8-9 16:01:04

支持,这个好使!

434939575 发表于 2015-8-9 16:06:23

好像只有“0”,和非“0”两种模式样的。

wngxb 发表于 2015-8-11 20:23:42

非常不错,能不能去掉模糊输入直接链接成一条线?而非像补丁起来的线。

tony1435 发表于 2015-8-13 11:48:13

楼主这合并多段线确实强大,顶上,让大家受惠~

farlcr 发表于 2015-10-12 23:37:48

这个程序能不能再改一下?现在多线相交时会分别组成两部分,我想全部线都闭合在一起。

664571221 发表于 2015-11-13 21:08:36

老师能不能不要输入距离,把距离固定直接选线合并我要的是距离300以下的都合并
页: [1] 2 3
查看完整版本: 输入模糊距离合并线,弧和多义线