본문 바로가기
캐드리습

카운터보어 리습

by good-life-story 2023. 2. 14.
728x90

;카운터보어 치수기입 dcb
(defun dtr(a)(* pi (/ a 180.0)))
(defun C:dcb (/ cla osm dms l l1 l2 alen hd hd1 su def_hd def_su def_dp dp h7 sp ap txt txt1 arrang h1 h2 h3 h4 h5 h6)
  (setvar "CMDECHO" 0)
  (setvar "BLIPMODE" 0)
  (setq osm (getvar "osmode"))
  (setq cla (getvar "clayer"))
  (setvar "osmode" 544)
  (setq dms (getvar "dimscale"))
  (setq L (* 2.5 dms))
  (setq L1 (* DMS 1.9))
  (setq L2 (* DMS 2.1))
  (setq alen (* (getvar "dimscale") 2.5))
  (setvar "ORTHOMODE" 0)
    (if (= hd nil) (setq hd 11))
    (if (= hd1 nil) (setq hd1 16))
    (if (= su nil) (setq su 4))
    (if (= DP nil) (setq DP 15))
    (setq def_hd hd)
    (setq def_hd1 hd1)
    (setq def_su su)
    (setq DEF_DP DP)
      (setq SP (getpoint "\n화살표의 시작점을 입력하시오.:")
            AP (getpoint SP "\n다음 점을 입력 하시오.:"))
    (setvar "ORTHOMODE" 1)
      (setq AD (getangle AP "\n글자의 입력방향을 선택 하시오.:")
            SU (getint (strcat "\n드릴 가공 홀의 수량를 입력 하시오. <" (itoa SU) ">:"))
            HD (getreal (strcat "\n드릴 가공의 지름값을 입력하시오. <" (rtos hd) ">:"))
            HD1 (getreal (strcat "\n카운터 보어의 지름값을 입력하시오. <" (rtos HD1) ">:"))
            DP (getreal (strcat "\n카운터 보어의 깊이값을 입력하시오. <" (rtos DP) ">:")))
  (if (= hd nil) (setq hd def_hd))
  (if (= hd1 nil) (setq hd1 def_hd1))
  (if (= su nil) (setq su def_su))
  (if (= DP nil) (setq DP DEF_DP))
     (setq TXT (strcat "%%C" (rtos HD) " DRILL"))
     (setq TXT1 (strcat (itoa SU) "-%%C" (rtos HD) " DRILL"))
  (if (< su 2) (setq h TXT) (setq h TXT1))
     (setq hh (strcat "  %%C" (rtos hd1) " C-BORE, DP:" (rtos DP)))
     (setq ARRANG (angle SP AP)
           H1 (strlen H)
           H2 (- (* L H1) (* L 3.8)) ; 문자 시작점
           H3 (polar AP AD (* H2 1.5)) ; 문자 밑줄 H3 (polar AP AD H2)
           H4 (polar AP AD (/ H2 2))
           H5 (list (car h4) (+ (cadr h4) L1))
           H6 (polar sp arrang alen)
           H7 (list (car h4) (- (cadr h4) L2))
  )
  (command "layer" "s" "dim" "")
  (setvar  "osmode" 0)
  (command "pline" sp "w" "0.0" (/ alen 3) H6 "w" "0.0" "0.0" ap h3 "")
  (command "CHPROP" "L" "" "C" "4" "")
  (command "text" "M" (polar H5 (dtr 90) (* L 1.7)) l 0 H) ; (command "text" "M" H5 l 0 H)
  (COMMAND "CHPROP" "L" "" "C" "3" "")
  (setq 2ndp (polar H7 ad (* 2.3 L))) ;; add
  (command "text" "M" (polar 2ndp (dtr 90) (* L 1.7)) l 0 HH) ;  (command "text" "M" H7 l 0 HH)
  (command "chprop" "L" "" "c" "3" "")
  (setvar "osmode" 39)
  (command "layer" "s" cla "")
  (princ)
) ; end of defun

 
728x90