本帖最后由 ysq101 于 2017-12-11 19:20 编辑
首先注明:此程序作者BY:LL_sheng
- ; 2017-10-28更新 BY:LL_sheng
- (defun getcolor(e / c)
- (if(setq e(entget e)c(assoc 62 e))
- (cdr c)
- (cdr(assoc 62(tblsearch"layer"(cdr(assoc 8 e)))))
- ))
- (defun plinexy(e)
- (mapcar'cdr(vl-remove-if'(lambda(x)(/=(car x)10))(entget e)))
- )
- (defun Pldir(pt)
- (<(apply'+(mapcar'(lambda(x y)(-(*(car x)(cadr y))(*(car y)(cadr x))))(cons(last pt)pt)pt))0))
- (defun c:wt(/ s f i e p pt txt c)
- (if(and(setq s(ssget'((0 . "lwpolyline")(-4 . "&")(70 . 1))))
- (setq s(vl-remove-if'(lambda(x)(/=(type x)'ename))(mapcar'cadr(ssnamex s)))
- f(getfiled "" "" "txt" 1))
- (setq txt""f(open f"w")))
- (progn
- (foreach e s
- (foreach i(if(pldir(setq p(plinexy e)))(setq p(reverse p))p)
- (if(not(member i pt))(setq pt(append pt(list i))))
- (setq txt(strcat(itoa(vl-position i pt))"\n"txt)))
- (setq c(getcolor e)
- c(cadr(assoc c(append'((1" 0 0 0 0 0 0 276")
- (2" 0 0 0 0 0 0 260")
- (3" 0 0 0 0 0 0 400")
- (4" 0 0 0 1 0 0 384")
- (5" 0 0 0 3 0 0 384")
- (6" 0 0 25 0 25 0 260")
- (7" 0 0 0 2 0 0 384")
- (8" 0 0 0 0 0 0 384"))
- (list(list c(strcat" 0 0 0 0 0 0 "(itoa c)))))))
- txt(strcat"\n"(itoa(length p))c"\n"txt)))
- (setq txt(strcat"\n"(itoa(length s))"\n"txt)
- i(length pt));;;;
- (foreach p(reverse pt)
- (entmakex(mapcar'cons'(0 1 10 40 62)(list"text"(itoa i)p 2 1)));;;;
- (setq i(1- i)txt(strcat(rtos(car p)2 4)" "(rtos(* -1.5557 (cadr p))2 4)"\n"txt)))
- (write-line(strcat(itoa(length pt))"\n\n"txt)f)
- (close f))
- ))
帮忙修改一下,判断各 闭合多线段 顶点时,
增加容差 差别0.01MM内 全按相同点排除
跪谢
|