mline法lwpolyline
本帖最后由 wzg356 于 2020-12-3 21:13 编辑;mline转lwpolyline;(ml2pl(car(entsel)))
(defun ml2pl(en / myoffset es pts e70 e40 en1 en2 ok)
(defun myoffset (en d / obj rtn)
(setq obj(vlax-ename->vla-object en))
(setq rtn(vl-catch-all-apply 'vla-Offset(list obj d)))
(if(not(vl-catch-all-error-p rtn))(entlast))
)
(setq es(entget en))
(setq e70(cdr(assoc 70 es)) e40(cdr(assoc 40 es)))
(setq pts(mapcar 'cdr(vl-remove-if '(lambda(x)(/= 11(car x)))es)))
(if(= (cdr(assoc 71 es))3)(setq pts(reverse(cons "c"(reverse pts)))))
(setvar "cmdecho" 0)
(command "_pline" (foreach p pts(command p)))
(setq en1(entlast))
(cond
((= 0 e70)(setq en2(myoffset en1 e40)))
((= 2 e70)(setq en2(myoffset en1(- 0.0 e40))))
((= 1 e70)(setq en2(myoffset en1(* -0.5 e40)))
(entdel en1)(setq en1(myoffset en2 e40))
)
)
(if (and en1 en2)
(setq ok(command "_matchprop" en en1 en2 "")
ok (list en1 en2)
)
)(setvar "cmdecho" 1)ok
)
(defun c:mpl ( / ss ee e)
(command "_undo" "be")
(princ "\n功能:多线法画lwpolyline")
(setq ee(entlast))
(command"_MLINE")
(while(>(getvar"cmdactive")0)(command pause))
(if (not(eq ee(setq e(entlast))))(ml2pl e))
(command "_undo" "_e")
(princ)
)
(defun c:ml2pl ( / ss ee e)
(command "_undo" "be")
(princ "\n功能:mline转lwpolyline")
(and(setq ss(ssget(list(cons 0 "MLINE"))))
(setq ss(vl-remove-if 'listp(mapcar 'cadr(ssnamex ss))))
(foreach e ss(ml2pl e))
)
(command "_undo" "_e")
(princ)
)
感谢楼主分享! 顶起,,,,谢谢楼主分享 感谢分享 很有用 感谢分享 很有用 感谢分享 很有用!!!
页:
[1]