(defun c:r( / bas p1 p2 txt_hi dm_txt dm_siz tol_sel)
(graphscr)
(reset)
(if (= tol_up nil)
(setq tol_up1 “+0.01”)
)
(if (= tol_dw nil)
(setq tol_dw1 “-0.01”)
)
(if (= tol_mp nil)
(setq tol_mp2 “0.01”)
)
(setq dm_txt (getvar “dimtxt”))
(setq dm_siz (getvar “dimscale”))
(setq txt_hi (* dm_txt dm_siz 0.6)) ;tolerance height
(setq bas (getpoint “nPick base point :”))
(initget 1 “1 2”)
(setq tol_sel (getkword “nSelect tolerance 1 or 2 :”))
(cond
((= tol_sel “1”)
(setq p1 (polar bas (dtr 90) (/ txt_hi 1.7)))
(setq p2 (polar bas (dtr 270) (/ txt_hi 1.7)))
(setq tol_up (getstring (strcat “nEnter plus tolerance <" tol_up1 ">:”)))
(setq tol_dw (getstring (strcat “nEnter minus tolerance <" tol_dw1 ">:”)))
(if (= tol_up “”)
(setq tol_up tol_up1)
)
(if (= tol_dw “”)
(setq tol_dw tol_dw1)
)
(setq tol_up1 tol_up)
(setq tol_dw1 tol_dw)
(if (= tol_up “0”)
(setq p1 (polar p1 (dtr 0) (* dm_siz 2.7000)))
)
(if (= tol_dw “0”)
(setq p2 (polar p2 (dtr 0) (* dm_siz 2.7000)))
)
(command “text” “j” “ml” p1 txt_hi 0 tol_up) (setq e1 (entlast))
(command “text” “j” “ml” p2 txt_hi 0 tol_dw) (setq e2 (entlast))
(prompt “n
(command “rotate” e1 e2 “” bas pause)
)
((= tol_sel “2”)
(setq tol_mp (getstring (strcat “nEnter tolerance <" tol_mp2 ">:”)))
(if (= tol_mp “”)
(setq tol_mp tol_mp2)
)
(setq tol_mp2 tol_mp)
(setq tol_mp1 (strcat “%%p” tol_mp))
(command “text” “j” “ml” bas txt_hi 0 tol_mp1) (setq e1 (entlast))
(prompt “n
(command “rotate” e1 “” bas pause)
))
(reset1)
(princ)
)
(defun reset()
(setq old_osm (getvar “osmode”))
(setq old_lay (getvar “clayer”))
(setq old_txt (getvar “textsize”))
(setvar “osmode” 0)
)
(defun reset1()
(setvar “osmode” old_osm)
(setvar “textsize” old_txt)
)
공차를 삽입하는 리습인데 1번과 2번을 선택하여 공차를 적용하는데 자꾸 1번의 DTR 에서 오류가 발생합니다. 저는 리습을 잘 알지 못 하는 관계로 이렇게 죄송하게 부탁드립니다. 사용하는 버전은 2006과 2008을 같이 사용하고 있습니다..