이 리습은 주동자님이 올려주셧던 리습인데요 ..
이 리습으로는 공차를 선택해야 하잖아요 ..
선택으로 안하고 자기가 수동으로 써서 입력 할 수 있게 할수있을까요 ?
그리고 공차값이 같을경우 ±가 자동으로 나오는데 이값이 나올경우
치수선 아래까지 침범을 하내요 .. 위치가 너무 아래로 내려가서 적용이 되내요 ..
이것좀 수정 할수있을까요 ..?
고수님들 부탁드리겠습니다 .. 꾸벅
————————————————–
LSP
————————————————–
(defun dialog_dim(/ dcl_id up_list low_list)
(setvar “cmdecho” 0)
(if (= up nil) (setq up “1”))
(if (= low nil) (setq low “1”))
(setq dcl_id (load_dialog “tole.dcl”))
(if (not (new_dialog “Tolerances” dcl_id))
(exit))
(set_tile “dim_v” (strcat “선택된 치수값 : “(rtos dim_value)))
(setq up_list (list ” ” ” 0″ “+0.01” “+0.02” “+0.03” “+0.04” “+0.05” “+0.06” “+0.07”
“+0.08” “+0.09” “+0.1 ” “+0.11” “+0.12” “+0.13” “+0.14” “+0.15”
“+0.001” “+0.002” “+0.003” “+0.004” “+0.005” “+0.006”))
(setq low_list(list ” ” ” 0″ “-0.01” “-0.02” “-0.03” “-0.04” “-0.05” “-0.06” “-0.07”
“-0.08” “-0.09” “-0.1 ” “-0.11” “-0.12” “-0.13” “-0.14” “-0.15”
“-0.001” “-0.002” “-0.003” “-0.004” “-0.005” “-0.006”))
(start_list “ptl”)
(mapcar ‘add_list up_list) (end_list)
(start_list “mtl”)
(mapcar ‘add_list low_list) (end_list)
(set_tile “ptl” up)
(set_tile “mtl” low)
(action_tile “ptl” “(p_tol)”)
(action_tile “mtl” “(m_tol)”)
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
(princ)
);The end;
;;;
;;
;
(defun p_tol(/ temp)
(setvar “cmdecho” 0)
(setq temp $value
ptl (nth (atoi temp) up_list)
up temp)
);;;
;;
;;
;
(defun m_tol(/ temp)
(setvar “cmdecho” 0)
(setq temp $value
mtl (nth (atoi temp) low_list)
low temp)
);;;
;;
;;
;
(defun c:tole(/ sel ea obj i j new old ptol mtol)
(setvar “cmdecho” 0)
(if (= ptl nil) (setq ptl ” 0″))
(if (= mtl nil) (setq mtl ” 0″))
(setq j 1)
(while j
(ssget “:s”)
(setq sel(ssget “p” ‘((0 . “DIMENSION”))))
(if (/= sel nil) (setq j nil))
)
(setq ea (sslength sel))
(setq i 0)
(repeat ea
(setq obj (entget (ssname sel i)))
(setq dim_value (cdr (assoc 42 obj)))
(setq k 1)
(while k
(dialog_dim)
(if (or (/= ptl “”)(/= mtl “”))
(setq k nil)
)
);while end
(setq old (assoc 1 obj))
(setq ptol(abs(atof ptl))
mtol(abs(atof mtl))
)
(if (= ptol mtol)
(if (= ptol 0)
(setq new(cons 1 “”))
(setq new(cons 1 (strcat “<>{\H0.7x;\S”>\A1;<>{\H0.7x;\S ^%%p” (rtos ptol)”;}”)))
);end if
(setq new (cons 1 (strcat “<>{\H0.7x;\S”>\A1;<>{\H0.7x;\S” ptl “^” mtl “;}”)))
);end if
(setq obj (subst new old obj))
(entmod obj)
(setq i(1+ i))
)
(princ)
);;;
;;;
;;
;
————————————————-
DCL
————————————————-
Tolerances : dialog {
label = “Tolerances Value” ;
:paragraph{
:text_part{
key = “dim_v”;
value = “”;
}
}
:boxed_column{
:popup_list {
fixed_width = true;
label = “Upper Value :”;
edit_width = 10;
key = “ptl”;
}
:popup_list {
fixed_width = true;
label = “Lower Value :”;
edit_width = 10;
key = “mtl”;
}
}
ok_cancel;
}