love1030312 发表于 2015-6-12 00:05:41

各位大大们 帮忙加个记忆上一次输入的数

本帖最后由 love1030312 于 2015-6-12 00:07 编辑

;;; 用模糊距离连接线,弧和多义线原作者是flyfox1047感谢他提供的程序 非常好用但希望大大们加个记忆
(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)
)

kwok 发表于 2015-6-12 00:05:42

love1030312 发表于 2015-6-12 09:18 static/image/common/back.gif
大大 我是小白能麻烦直接改改么万分感谢

;;; 用模糊距离连接线,弧和多义线原作者是flyfox1047感谢他提供的程序 非常好用但希望大大们加个记忆
(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))
   (setq fuzz (getdist (strcat "\nFuzz distance<" (rtos *fuzz 2 2) ">:")))
   (if (NULL fuzz) (setq fuzz *fuzz) (SETQ *fuzz fuzz))

(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)
)

zxmmelly 发表于 2015-6-12 08:31:56

可以用一个全局变量来保存你想要的数据,这样在当前文件中就可以记忆了

Andyhon 发表于 2015-6-12 08:50:10

(setq fuzz (getdist "\nFuzz distance <0>: "))
(if (= fuzz nil) (setq fuzz 0))

改用 Udist
(setq fuzz (Udist 4 "" "\nFuzz distance" fuzz nil))

Udist函数站内有

love1030312 发表于 2015-6-12 09:18:50

Andyhon 发表于 2015-6-12 08:50 static/image/common/back.gif
(setq fuzz (getdist "\nFuzz distance : "))
(if (= fuzz nil) (setq fuzz 0))



大大 我是小白能麻烦直接改改么万分感谢

xiang19751218 发表于 2015-6-12 13:40:02

试一试
(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 (Udist 4 "" "\nFuzz distance(模糊距离):" (cond (*DD*)) nil))
(setq *DD* fuzz)
(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 udist (bit kwd msg def bpt / inp)
(if def
    (setq msg (strcat "\n" msg "<" (rtos def) ">: ")
          bit (* 2 (fix (/ bit 2)))
    )
    (setq msg (strcat "\n" msg ": "))
)
(initget bit kwd)
(setq inp (if bpt (getdist msg bpt) (getdist msg)))
(if inp inp def)
)

lucas_3333 发表于 2015-6-12 15:48:08

程序并不准确, 就算两条线之间的间距为100mm , 模糊距离输0.1 , 照样合并

love1030312 发表于 2015-6-12 21:54:13

lucas_3333 发表于 2015-6-12 15:48 static/image/common/back.gif
程序并不准确, 就算两条线之间的间距为100mm , 模糊距离输0.1 , 照样合并

恩大大发现真详细是有这个问题 但是不知道如何解决

下文没句号。 发表于 2024-6-24 23:38:34

是两条线连接起来吗?
页: [1]
查看完整版本: 各位大大们 帮忙加个记忆上一次输入的数