;请大师改改,输入明天后提示:错误no function definition: GETREGNEW
(defun c:tt( / d1 e e1 h int l m n o obj p pt0 pt1 pt2 pts q ss ss1 test test0 tmp w x z)
(setvar "cmdecho" 0)
(setvar "osmode" 16383)
(setvar "peditaccept" 1)
(setvar "ORTHOMODE" 0);关闭正交
(command "ucs" "w")
(setq TEST0 t)
(while TEST0 ;;循环绘制辅助进刀
(setq TEST t)
(while TEST ;;循环设置参数
;;读取注册表数值:偏距,不存在则赋初始值
(setq d (atof(getregnew regpaths "辅助进刀偏移" "0.25")))
(setq sf '((0 . "LWPOLYLINE")(-4 . "<AND")(-4 . "<NOT")(70 . 1)(-4 . "NOT>")(-4 . "AND>")(-3 ("my_tag"))))
(setq WORD(clh-entsel (STRCAT "\n选择线割图元或[偏移量(D)/取消(空格键)]{当前偏移量:" (rtos d 2 2) "}") "D" sf "\n所选对像不符合要求!请重新选择:"))
(cond
;;按下键盘键或者击鼠标右键
((= WORD "D");;修改:偏移量
(if (/= (setq d (getreal (strcat "\n>>指定偏移量 <" (rtos d 2 2) ">: "))) nil)
(setreg regpaths "辅助进刀偏移" (rtos d 2 2))
))
((= WORD nil);;退出
(exit_msg2 "退出")
)
((= (type WORD) 'LIST)(setq TEST nil))
)
);;结束参数设置
(setq pt1 (cadr WORD))
(if (and pt1 (setq ss(ssget pt1 '((0 . "LWPOLYLINE")
(-4 . "<AND")
(-4 . "<NOT")
(70 . 1)
(-4 . "NOT>")
(-4 . "AND>")
(-3 ("my_tag")))
)
)
)
(progn
(setq
e(SSNAME SS 0)
pts(Tao-get-pl-pt e)
p(cadr pts)
)
(while
(and
(setq q (getpoint (trans p 0 1) "\n打断点: "))
(equal p (setq q (vlax-curve-getclosestpointto e (trans q 1 0))) 1e-8)
)
(princ "\n***点必须是不同的***")
)
(if q
(progn
(if(>(setq m(vlax-curve-getparamatpoint e p))(setq n(vlax-curve-getparamatpoint e q)))(mapcar 'set '(m n p q)(list n m q p)))
(setq
e (entget e)
h (reverse (member (assoc 39 e) (reverse e)))
h (subst (cons 70 (logand (cdr (assoc 70 h)) (~ 1))) (assoc 70 h) h)
l (LMWVERTICES e)
z (assoc 210 e)
)
(repeat (fix m)
(setq l (cdr l))
)
(if (not (equal m (fix m) 1e-8))
(setq x (car l)
w (cdr (assoc 40 x))
l
(cons
(list
(cons 10 (trans p 0 (cdr z)))
(cons 40 (+ w (* (- m (fix m)) (- (cdr (assoc 41 x)) w))))
(assoc 41 x)
(cons 42
(TAN
(* (- (min n (1+ (fix m))) m)
(atan (cdr (assoc 42 x)))
)
)
)
)
(cdr l)
)
)
)
(setq l (reverse l))
(repeat (+ (length l) (fix m) (- (fix n)) -1)
(setq l (cdr l))
)
(if (not (equal n (fix n) 1e-8))
(setq x (car l)
w (cdr (assoc 40 x))
l
(vl-list*
(list
(cons 10 (trans q 0 (cdr z)))
'(40 . 0.0)
'(41 . 0.0)
'(42 . 0.0)
)
(list
(assoc 10 x)
(assoc 40 x)
(cons 41
(+ w
(* (/ (- n (max m (fix n))) (- (1+ (fix n)) (max m (fix n))))
(- (cdr (assoc 41 x)) w)
)
)
)
(cons 42
(TAN
(* (if (< (fix n) m) 1.0 (- n (fix n)))
(atan (cdr (assoc 42 x)))
)
)
)
)
(cdr l)
)
)
)
(command "undo" "m")
(setq o(entmakex (append h (apply 'append (reverse l)) (list z))))
(Tao-offset o d 1)