프로그램
캐드 분류

캐드 볼트 탭 작도 리습질문 입니다~ 고수님들 도와주세요

컨텐츠 정보

  • 199 조회
  • 0 추천
  • 0 비추천
  • 목록

본문

아래 리습에서 탭 측면 작도시 문자가 나왔으면 합니다. 
예를 들어 M8탭 길이 15.0 을 작도 한다고 하면 
볼트에  M8X15L 이렇게 나오게 하고 싶습니다. 
고수님들의 도움 부탁드립니다. 
그리고 측면 탭 작도시 중심선이 삐져 나오는데 바깥으로 안나오게도 알려주시면 
감사하겠습니다. 좋은하루 보내세요 
;;;**********************************************************************
;;;                                                                     
;;;             2D TAP(평면,관통,막힘) 을 작도한다                      
;;;                                                                     
;;;             2010,4,8, 김규환(gw1425@hanmail.net)                    
;;;                                                              
;;;             http://cafe.daum.net/archimore/by 쇠쟁이                
;;;**********************************************************************
(setq tap_draw_layer_1 "0″
;;;외형선
      tap_draw_layer_2
         "3″
;;;실선
      tap_draw_layer_3
         "2″
;;;은선
      tap_draw_layer_4
         "1″
;;;중심선
)
(defun c:BH (/ old_bl old_cm old_lay ok ok1)
  (setq old_bl (getvar "BLIPMODE")
 old_cm (getvar "cmdecho")
 old_lay (getvar "clayer")
  )
  (defun *error* (msg)
    (SETVAR "BLIPMODE" old_bl)
    (SETVAR "cmdecho" old_cm)
    (setvar "clayer" old_lay)
  )
  (SETVAR "BLIPMODE" 0)
  (SETVAR "cmdecho" 0)
  (tap_draw_dcl)
  (if (or (= ok 1) (= ok1 1))
    (progn
      (cond
 ((= tap_draw_dia 2.5) (setq tap_draw_p 0.45)(setq tap_draw_type_2 (rtos  (+ (atof tap_draw_type_4) 2) 2 2)))
 ((= tap_draw_dia 3) (setq tap_draw_p 0.6)(setq tap_draw_type_2 (rtos  (+ (atof tap_draw_type_4) 2) 2 2)))
 ((= tap_draw_dia 4) (setq tap_draw_p 0.75)(setq tap_draw_type_2 (rtos  (+ (atof tap_draw_type_4) 2) 2 2)))
 ((= tap_draw_dia 5) (setq tap_draw_p 0.8)(setq tap_draw_type_2 (rtos  (+ (atof tap_draw_type_4) 3) 2 2)))
 ((= tap_draw_dia 6) (setq tap_draw_p 1)(setq tap_draw_type_2 (rtos  (+ (atof tap_draw_type_4) 3) 2 2)))
 ((= tap_draw_dia 8) (setq tap_draw_p 1.25)(setq tap_draw_type_2 (rtos  (+ (atof tap_draw_type_4) 3) 2 2)))
 ((= tap_draw_dia 10) (setq tap_draw_p 1.5)(setq tap_draw_type_2 (rtos  (+ (atof tap_draw_type_4) 5) 2 2)))
 ((= tap_draw_dia 12) (setq tap_draw_p 1.75)(setq tap_draw_type_2 (rtos  (+ (atof tap_draw_type_4) 5) 2 2)))
 ((= tap_draw_dia 14) (setq tap_draw_p 2)(setq tap_draw_type_2 (rtos  (+ (atof tap_draw_type_4) 5) 2 2)))
 ((= tap_draw_dia 16) (setq tap_draw_p 2)(setq tap_draw_type_2 (rtos  (+ (atof tap_draw_type_4) 7) 2 2)))
 ((= tap_draw_dia 18) (setq tap_draw_p 2.5)(setq tap_draw_type_2 (rtos  (+ (atof tap_draw_type_4) 7) 2 2)))
 ((= tap_draw_dia 20) (setq tap_draw_p 2.5)(setq tap_draw_type_2 (rtos  (+ (atof tap_draw_type_4) 7) 2 2)))
 ((= tap_draw_dia 22) (setq tap_draw_p 2.5)(setq tap_draw_type_2 (rtos  (+ (atof tap_draw_type_4) 10) 2 2)))
 ((= tap_draw_dia 24) (setq tap_draw_p 3)(setq tap_draw_type_2 (rtos  (+ (atof tap_draw_type_4) 10) 2 2)))
 ((= tap_draw_dia 30) (setq tap_draw_p 3.5)(setq tap_draw_type_2 (rtos  (+ (atof tap_draw_type_4) 10) 2 2)))
      )
      (tap_draw_layer_1_make)
      (tap_draw_layer_2_make)
      (tap_draw_layer_3_make)
      (tap_draw_layer_4_make)
      (setvar "clayer" old_lay)
      (cond
 ((= tap_draw_type_1 "0″) (tap_draw_top))
 ((= tap_draw_type_1 "1″) (tap_draw_through))
 ((= tap_draw_type_1 "2″) (tap_draw_blind))
      )
    )
  )
  (SETVAR "BLIPMODE" old_bl)
  (SETVAR "cmdecho" old_cm)
  (PRINC)
)
;;;********************************************
;;; 은선/중심선의 레이어 축척을 설정           
;;;********************************************
(defun dxf_48_setting (dxf_48 /)
  (if (> dxf_48 1)
    (setq dxf_48 1)
  )
  dxf_48
)
;;;********************************************
;;;                블럭 체인지                 
;;;********************************************
(defun block_change (block_change_ss    block_change_name
       /      block_change_ss
       block_change_name    block_change_p
      )
  (setq block_change_p 0)
  (while (ssname block_change_ss block_change_p)
    (setq block_change_1 (subst
      (cons 2 block_change_name)
      (assoc
        2
        (entget (ssname block_change_ss block_change_p)
        )
      )
      (entget (ssname block_change_ss block_change_p))
    )
   block_change_p (+ block_change_p 1)
    )
    (entmod block_change_1)
  )
)
;;;************************************
(defun tap_draw_top (/ pt ss)
  (defun tap_draw_top_1 (draw_pt / draw_pt)
    (if (= tap_draw_type_7 "1″)
      (progn
 (if (< (/ tap_draw_dia 5.0) 1)
   (entmake(list '(0 . "CIRCLE")
(cons 8 tap_draw_layer_3)
(CONS 48 (dxf_48_setting (/ tap_draw_dia 5.0)))
(cons 10 draw_pt)
(cons 40 (/ (- tap_draw_dia tap_draw_p) 2.0))))
   (entmake (list '(0 . "CIRCLE")
 (cons 8 tap_draw_layer_3)
 (cons 10 draw_pt)
 (cons 40 (/ (- tap_draw_dia tap_draw_p) 2.0))))))
      (progn
(entmake (list '(0 . "CIRCLE")
      (cons 8 tap_draw_layer_1)
      (cons 10 draw_pt)
      (cons 40 (/ (- tap_draw_dia tap_draw_p) 2.0))))
)
      )
    (COND ((= tap_draw_type_7 "1″)
  (entmake (list (cons 0 "ARC")
 (cons 8 tap_draw_layer_3)
 (cons 10 draw_pt)
 (cons 40 (/ tap_draw_dia 2.0))
 (Cons 50 (* pi 1.45))
 (cons 51 (* pi 1.05))
 )
   )
  )
 ((/= tap_draw_type_7 "1″)
  (entmake (list (cons 0 "ARC")
 (cons 8 tap_draw_layer_2)
 (cons 10 draw_pt)
 (cons 40 (/ tap_draw_dia 2.0))
 (Cons 50 (* pi 1.45))
 (cons 51 (* pi 1.05))
 )
   )
  )
 )
    
 
    (if (= tap_draw_type_8 "1″)
      (progn
 (entmake
   (LIST
     (CONS 0 "LINE")
     (CONS 8 tap_draw_layer_4)
     ;(CONS 48 (dxf_48_setting (/ tap_draw_dia 50.0)))
     (CONS 10
    (polar draw_pt pi (+ (/ tap_draw_dia 2.0) 0))
     )
     (CONS 11
    (polar draw_pt 0 (+ (/ tap_draw_dia 2.0) 0))
     )
   )
 )
 (entmake
   (LIST (CONS 0 "LINE")
  (CONS 8 tap_draw_layer_4)
  ;(CONS 48 (dxf_48_setting (/ tap_draw_dia 50.0)))
  (CONS 10
        (polar draw_pt
        (* pi 1.5)
        (+ (/ tap_draw_dia 2.0) 0)
        )
  )
  (CONS 11
        (polar draw_pt
        (* pi 0.5)     
        (+ (/ tap_draw_dia 2.0) 0)
        )
  )
   )
 )
      )
    )
  )
  (if (= tap_draw_type_5 "0″)
    (progn
      (while (/= (setq pt (getpoint "n삽입점:")) nil)
 (tap_draw_top_1 (trans pt 1 0))
      )
    )
    (progn
      (setq block_name (STRCAT "M" (RTOS tap_draw_dia) " TAP"))
      (if (= tap_draw_type_7 "1″)
 (setq block_name (strcat block_name "(H)"))
      )
      (if
 (= (tblsearch "block" block_name)
    nil
 )
  (progn
    (entmake
      (list '(0 . "BLOCK")
     (cons 2 block_name)
     '(70 . 0)
     '(10 0.0 0.0 0.0)
      )
    )
    (tap_draw_top_1 (list 0 0 0))
    (entmake '((0 . "ENDBLK")))
  )
      )
      (if (= tap_draw_type_6 "0″)
 (progn
   (prompt "n삽입점/취소=Esc/:")
   (while (/= (vl-cmdf "_insert" block_name pause "" "" 0)
       nil
   )
   )
 )
 (progn
   (prompt "n교체할 부분 선택:")
   (setq ss (ssget '((0 . "INSERT"))))
   (if ss
     (block_change ss block_name)
   )
 )
      )
    )
  )
)
;;;***************************************
(defun tap_draw_through (/
    tap_draw_through_pt1
    tap_draw_through_pt2
    tap_draw_through_dist
    tap_draw_layer
    block_name
    tap_draw_through_angle
   )
  (defun tap_draw_through1 (pt1    pt_dist  pt_angle      /
       pt1    pt2   pt4  pt5 pt6    pt7
       pt8    pt9   pt10  pt11 pt12   pt13
       pt14   pt15   pt_angle
      )
    (setq pt2 (polar pt1 pt_angle pt_dist))
    (if (= tap_draw_type_7 "1″)
      (setq tap_draw_layer tap_draw_layer_3)
      (setq tap_draw_layer tap_draw_layer_1)
    )
    (setq pt3  (polar (polar pt1
        (+ pt_angle (* pi 0.5))
        (/ (- tap_draw_dia tap_draw_p) 2.0)
        )
        pt_angle
        (/ tap_draw_p 2.0)
        )
   pt4  (polar pt3 pt_angle (- pt_dist tap_draw_p))
   pt5  (polar pt3
        (- pt_angle (* pi 0.5))
        (- tap_draw_dia tap_draw_p)
        )
   pt6  (polar pt4
        (- pt_angle (* pi 0.5))
        (- tap_draw_dia tap_draw_p)
        )
   pt7  (polar pt1 (+ pt_angle (* pi 0.5)) (/ tap_draw_dia 2.0))
   pt8  (polar pt7 pt_angle pt_dist)
   pt9  (polar pt1 (- pt_angle (* pi 0.5)) (/ tap_draw_dia 2.0))
   pt10 (polar pt9 pt_angle pt_dist)
    )
    (entmake (LIST (cons 0 "LINE")
     (cons 8 tap_draw_layer)
     (cons 10 pt3)
     (cons 11 pt4)
      )
    )
    (entmake (LIST (cons 0 "LINE")
     (cons 8 tap_draw_layer)
     (cons 10 pt5)
     (cons 11 pt6)
      )
    )
    (entmake (LIST (cons 0 "LINE")
     (cons 8 tap_draw_layer)
     (cons 10 pt7)
     (cons 11 pt3)
      )
    )
    (entmake (LIST (cons 0 "LINE")
     (cons 8 tap_draw_layer)
     (cons 10 pt3)
     (cons 11 pt5)
      )
    )
    (entmake (LIST (cons 0 "LINE")
     (cons 8 tap_draw_layer)
     (cons 10 pt5)
     (cons 11 pt9)
      )
    )
    (entmake (LIST (cons 0 "LINE")
     (cons 8 tap_draw_layer)
     (cons 10 pt8)
     (cons 11 pt4)
      )
    )
    (entmake (LIST (cons 0 "LINE")
     (cons 8 tap_draw_layer)
     (cons 10 pt4)
     (cons 11 pt6)
      )
    )
    (entmake (LIST (cons 0 "LINE")
     (cons 8 tap_draw_layer)
     (cons 10 pt6)
     (cons 11 pt10)
      )
    )
    (tap_draw_layer_2_make)
    (if
      (or (= tap_draw_type_3 "1″)
   (and (= tap_draw_type_3 "0″)
        (<= (- pt_dist (/ tap_draw_p 2.0)) (atof tap_draw_type_4))
   )
      )
       (progn
  (entmake (LIST (cons 0 "LINE")
   (cons 8 tap_draw_layer_2)
   (cons 10 pt7)
   (cons 11 pt8)
    )
  )
  (entmake (LIST (cons 0 "LINE")
   (cons 8 tap_draw_layer_2)
   (cons 10 pt9)
   (cons 11 pt10)
    )
  )
       )
       (progn
  (setq pt11 (polar pt1
      (+ pt_angle (* pi 0.5))
      (/ tap_draw_dia 2.0)
      )
        pt12 (polar pt11 pt_angle (atof tap_draw_type_4))
        pt13 (polar pt1
      (- pt_angle (* pi 0.5))
      (/ tap_draw_dia 2.0)
      )
        pt14 (polar pt13 pt_angle (atof tap_draw_type_4))
        pt15 (polar (polar pt12 pt_angle (/ tap_draw_p 2.0))
      (- pt_angle (* pi 0.5))
      (/ tap_draw_p 2.0)
      )
        pt16 (polar pt15
      (- pt_angle (* pi 0.5))
      (- tap_draw_dia tap_draw_p)
      )
  )
  (entmake (LIST (cons 0 "LINE")
   (cons 8 tap_draw_layer_2)
   (cons 10 pt11)
   (cons 11 pt12)
    )
  )
  (entmake (LIST (cons 0 "LINE")
   (cons 8 tap_draw_layer_2)
   (cons 10 pt13)
   (cons 11 pt14)
    )
  )
  (entmake (LIST (cons 0 "LINE")
   (cons 8 tap_draw_layer_2)
   (cons 10 pt12)
   (cons 11 pt15)
    )
  )
  (entmake (LIST (cons 0 "LINE")
   (cons 8 tap_draw_layer_2)
   (cons 10 pt14)
   (cons 11 pt16)
    )
  )
  (entmake (LIST (cons 0 "LINE")
   (cons 8 tap_draw_layer_2)
   (cons 10 pt12)
   (cons 11 pt14)
    )
  )
  (entmake (LIST (cons 0 "LINE")
   (cons 8 tap_draw_layer_2)
   (cons 10 pt15)
   (cons 11 pt16)
    )
  )
       )
    )
    (if (= tap_draw_type_8 "1″)
      (progn
 (tap_draw_layer_4_make)
 (entmake
   (LIST (CONS 0 "LINE")
  (CONS 8 tap_draw_layer_4)
  ;(CONS 48 (dxf_48_setting (/ pt_dist 50.0)))
  (CONS 10 (polar pt1 (+ pt_angle pi) 2.0))
  (CONS 11 (polar pt2 pt_angle 2.0))
   )
 )
      )
    )
  )
  (if (and (/= (setq tap_draw_through_pt1 (getpoint "n삽입점:")) nil)
    (/= (setq tap_draw_through_pt2
        (getpoint tap_draw_through_pt1
    "n거리/방향:"
        )
        )
        nil
    )
      )
    (progn
      (setq tap_draw_through_angle
      (angle tap_draw_through_pt1
      tap_draw_through_pt2
      )
     tap_draw_through_dist
      (DISTANCE tap_draw_through_pt1
         tap_draw_through_pt2
      )
      )
      (if (= tap_draw_type_5 "0″)
 (progn
   (tap_draw_through1
     (trans tap_draw_through_pt1 1 0)
     tap_draw_through_dist
     tap_draw_through_angle
   )
   (while
     (/= (setq tap_draw_through_pt1 (getpoint "n삽입점:")) nil)
      (tap_draw_through1
        (trans tap_draw_through_pt1 1 0)
        tap_draw_through_dist
        tap_draw_through_angle
      )
   )
 )
 (progn
   (if (or (= tap_draw_type_3 "1″)
    (and (= tap_draw_type_3 "0″)
         (<= (- tap_draw_through_dist (/ tap_draw_p 2.0))
      (atof tap_draw_type_4)
         )
    )
       )
     (setq block_name
     (strcat "M"
      (rtos tap_draw_dia)
      " TAP "
      (RTOS tap_draw_through_dist)
      "t관통"
     )
     )
     (setq block_name
     (strcat "%%C"
      (rtos (- tap_draw_dia tap_draw_p))
      " "
      (RTOS tap_draw_through_dist)
      "t관통후 M"
      (rtos tap_draw_dia)
      " TAP X "
      tap_draw_type_4
      " depth"
     )
     )
   )
   (if (= tap_draw_type_7 "1″)
     (setq block_name (strcat block_name "(H)"))
   )
   (if (= (tblsearch "block" block_name) nil)
     (progn
       (entmake (list (cons 0 "BLOCK")
        (cons 2 block_name)
        (cons 70 0)
        (cons 10 (list 0.0 0.0 0.0))
         )
       )
       (tap_draw_through1
  (list 0 0 0)
  tap_draw_through_dist
  (* pi 1.5)
       )
       (entmake '((0 . "ENDBLK")))
     )
   )
   (if (= tap_draw_type_6 "0″)
     (progn
       (vl-cmdf
  "_insert"
  block_name
  tap_draw_through_pt1
  ""
  ""
  (/ 360
     (/ (* 2.0 pi) (+ tap_draw_through_angle (* pi 0.5)))
  )
       )
       (prompt "n삽입점/취소=Esc/:")
       (while
  (/= (vl-cmdf
        "_insert"
        block_name
        pause
        ""
        ""
        (/ 360
    (/ (* 2.0 pi)
       (+ tap_draw_through_angle (* pi 0.5))
    )
        )
      )
      nil
  )
       )
     )
     (progn
       (prompt "n교체할 부분 선택:")
       (setq ss (ssget '((0 . "INSERT"))))
       (if ss
  (block_change ss block_name)
       )
     )
   )
 )
      )
    )
  )
)
;;;*********************************
(defun tap_draw_blind (/
         tap_draw_blind_pt
         tap_draw_blind_angle
         tap_draw_blind_angle_1
         tap_draw_blind_angle_2
         block_name
        )
  (defun tap_draw_blind1 (pt    pt_angle /      tap_draw_layer
     pt    pt_angle pt1      pt2      pt3
     pt4    pt5     pt6      pt7      pt8
     pt9    pt10     pt11
    )
    (if (= tap_draw_type_7 "1″)
      (progn
 (setq tap_draw_layer tap_draw_layer_3)
 (tap_draw_layer_3_make)
      )
      (progn
 (setq tap_draw_layer tap_draw_layer_1)
 (tap_draw_layer_1_make)
      )
    )
    (setq pt1 (polar (polar pt
       (+ pt_angle (* pi 0.5))
       (/ (- tap_draw_dia tap_draw_p) 2.0)
       )
       pt_angle
       (/ tap_draw_p 2.0)
       )
   pt2 (polar pt1
       pt_angle
       (- (atof tap_draw_type_2) (/ tap_draw_p 2.0))
       )
   pt3 (polar pt1
       (- pt_angle (* pi 0.5))
       (- tap_draw_dia tap_draw_p)
       )
   pt4 (polar pt2
       (- pt_angle (* pi 0.5))
       (- tap_draw_dia tap_draw_p)
       )
   pt5 (polar
  (polar pt2
         pt_angle
         (sqrt (- (expt (/ (/ (- tap_draw_dia tap_draw_p) 2.0)
      (cos (* (/ pi 180) 31))
          )
          2
    )
    (expt (/ (- tap_draw_dia tap_draw_p) 2.0) 2)
        )
         )
  )
  (- pt_angle (* pi 0.5))
  (/ (- tap_draw_dia tap_draw_p) 2.0)
       )
    )
    (entmake (LIST (cons 0 "LINE")
     (cons 8 tap_draw_layer)
     (cons 10 pt1)
     (cons 11 pt2)
      )
    )
    (entmake (LIST (cons 0 "LINE")
     (cons 8 tap_draw_layer)
     (cons 10 pt3)
     (cons 11 pt4)
      )
    )
    (entmake (LIST (cons 0 "LINE")
     (cons 8 tap_draw_layer)
     (cons 10 pt2)
     (cons 11 pt5)
      )
    )
    (entmake (LIST (cons 0 "LINE")
     (cons 8 tap_draw_layer)
     (cons 10 pt4)
     (cons 11 pt5)
      )
    )
    (entmake (LIST (cons 0 "LINE")
     (cons 8 tap_draw_layer)
     (cons 10 pt2)
     (cons 11 pt4)
      )
    )
    (tap_draw_layer_2_make)
    (if (= tap_draw_tyep_1 "2″)
;(or (= tap_draw_type_3 "1″)
    ; (and (= tap_draw_type_3 "0″)
  ; (<= (- (atof tap_draw_type_2) (/ tap_draw_p 2.0))
       ;(atof tap_draw_type_4)
  ; )
     ????
 ????
      (progn
 (setq pt6 (polar pt
    (+ pt_angle (* pi 0.5))
    (/ tap_draw_dia 2.0)
    )
       pt7 (polar pt6 pt_angle (atof tap_draw_type_2))
       pt8 (polar pt
    (- pt_angle (* pi 0.5))
    (/ tap_draw_dia 2.0)
    )
       pt9 (polar pt8 pt_angle (atof tap_draw_type_2))
 )
 (entmake (LIST (cons 0 "LINE")
         (cons 8 tap_draw_layer_2)
         (cons 10 pt6)
         (cons 11 pt7)
   )
 )
 (entmake (LIST (cons 0 "LINE")
         (cons 8 tap_draw_layer_2)
         (cons 10 pt8)
         (cons 11 pt9)
   )
 )
 (entmake (LIST (cons 0 "LINE")
         (cons 8 tap_draw_layer_2)
         (cons 10 pt7)
         (cons 11 pt2)
   )
 )
 (entmake (LIST (cons 0 "LINE")
         (cons 8 tap_draw_layer_2)
         (cons 10 pt9)
         (cons 11 pt4)
   )
 )
      )
      (progn
 (setq pt6  (polar pt
     (+ pt_angle (* pi 0.5))
     (/ tap_draw_dia 2.0)
     )
       pt7  (polar pt6 pt_angle (atof tap_draw_type_4))
       pt8  (polar pt
     (- pt_angle (* pi 0.5))
     (/ tap_draw_dia 2.0)
     )
       pt9  (polar pt8 pt_angle (atof tap_draw_type_4))
       pt10 (polar (polar pt7 pt_angle (/ tap_draw_p 2.0 (/ (sin (* pi (/ 30 180.))) (cos (* pi (/ 30 180.))))));각도조절1
     (- pt_angle (* pi 0.5))
     (/ tap_draw_p 2.0)
     )
       pt11 (polar (polar pt9 pt_angle (/ tap_draw_p 2.0 (/ (sin (* pi (/ 30 180.))) (cos (* pi (/ 30 180.))))));각도조절2
     (+ pt_angle (* pi 0.5))
     (/ tap_draw_p 2.0)
     )
 )
 (entmake (LIST (cons 0 "LINE")
         (cons 8 tap_draw_layer_2)
         (cons 10 pt6)
         (cons 11 pt7)
   )
 )
 (entmake (LIST (cons 0 "LINE")
         (cons 8 tap_draw_layer_2)
         (cons 10 pt8)
         (cons 11 pt9)
   )
 )
 (entmake (LIST (cons 0 "LINE")
         (cons 8 tap_draw_layer_2)
         (cons 10 pt7)
         (cons 11 pt10)
   )
 )
 (entmake (LIST (cons 0 "LINE");1
         (cons 8 tap_draw_layer_2)
         (cons 10 pt7)
         (cons 11 pt10);<-각도점1
   )
 )
 (entmake (LIST (cons 0 "LINE");2
         (cons 8 tap_draw_layer_2)
         (cons 10 pt9)
         (cons 11 pt11);<-각도점2
   )
 )
 ;(vl-cmdf "circle" pt7 0.1)
 ;(vl-cmdf "circle" pt9 0.1)
 (entmake (LIST (cons 0 "LINE");red2white
         (cons 8 tap_draw_layer)
         (cons 10 pt7)
         (cons 11 pt9)
   )
 )
      )
    )
    (entmake (LIST (cons 0 "LINE")
     (cons 8 tap_draw_layer)
     (cons 10 pt1)
     (cons 11 pt6)
      )
    )
    (entmake (LIST (cons 0 "LINE")
     (cons 8 tap_draw_layer)
     (cons 10 pt1)
     (cons 11 pt3)
      )
    )
    (entmake (LIST (cons 0 "LINE")
     (cons 8 tap_draw_layer)
     (cons 10 pt3)
     (cons 11 pt8)
      )
    )
    (if (= tap_draw_type_8 "1″)
      (progn
 (tap_draw_layer_4_make)
 (entmake
   (LIST (CONS 0 "LINE")
  (CONS 8 tap_draw_layer_4)
 ; (CONS 48 (dxf_48_setting (/ tap_draw_dia 50.0)))
  (CONS 10 (polar pt (+ pt_angle pi) 2.0))
  (CONS 11 (polar pt5 pt_angle 2.0))
   )
 )
      )
    )
  )
  (setq tap_draw_blind_pt (getpoint "n삽입점:"))
  (if (= tap_draw_blind_angle nil)
    (setq tap_draw_blind_angle_1 (* pi 1.5))
    (setq tap_draw_blind_angle_1 tap_draw_blind_angle)
  )
  (if (EQUAL tap_draw_blind_angle_1 0 0.000001)
    (setq tap_draw_blind_angle_2 0)
    (setq tap_draw_blind_angle_2
    (/ 360 (/ (* pi 2) tap_draw_blind_angle_1))
    )
  )
  (setq tap_draw_blind_angle
  (GETANGLE tap_draw_blind_pt
     (strcat "n방향=>삽입각도/<<"
      (rtos tap_draw_blind_angle_2)
      ">>:"
     )
  )
  )
  (if (= tap_draw_blind_angle nil)
    (setq tap_draw_blind_angle tap_draw_blind_angle_1)
  )
  (if (= tap_draw_type_5 "0″)
    (progn
      (while (/= tap_draw_blind_pt nil)
 (tap_draw_blind1
   (trans tap_draw_blind_pt 1 0)
   tap_draw_blind_angle
 )
 (setq tap_draw_blind_pt (getpoint "n삽입점:"))
      )
    )
    (progn
      (if (or (= tap_draw_type_3 "1″)
       (and (= tap_draw_type_3 "0″)
     (<= (- (atof tap_draw_type_2) (/ tap_draw_p 2.0))
         (atof tap_draw_type_4)
     )
       )
   )
 (setq block_name
        (strcat "%%C"
         (rtos (- tap_draw_dia tap_draw_p))
         " X "
         tap_draw_type_2
         " depth후 M"
         (rtos tap_draw_dia)
         " TAP"
        )
 )
 (setq block_name
        (strcat "%%C"
         (rtos (- tap_draw_dia tap_draw_p))
         " X "
         tap_draw_type_2
         " depth후 M"
         (rtos tap_draw_dia)
         " TAP X "
         tap_draw_type_4
         " depth"
        )
 )
      )
      (if (= tap_draw_type_7 "1″)
 (setq block_name (strcat block_name "(H)"))
      )
      (if (= (tblsearch "block" block_name) nil)
 (progn
   (entmake (list (cons 0 "BLOCK")
    (cons 2 block_name)
    (cons 70 0)
    (cons 10 (list 0.0 0.0 0.0))
     )
   )
   (tap_draw_blind1 (list 0 0 0) (* pi 1.5))
   (entmake '((0 . "ENDBLK")))
 )
      )
      (if (= tap_draw_type_6 "0″)
 (progn
   (vl-cmdf
     "_insert"
     block_name
     tap_draw_blind_pt
     ""
     ""
     (/ 360 (/ (* 2.0 pi) (+ tap_draw_blind_angle (* pi 0.5))))
   )
   (prompt "n삽입점/취소=Esc/:")
   (while
     (/= (vl-cmdf
    "_insert"
    block_name
    pause
    ""
    ""
    (/ 360
       (/ (* 2.0 pi) (+ tap_draw_blind_angle (* pi 0.5)))
    )
  )
  nil
     )
   )
 )
 (progn
   (prompt "n교체할 부분 선택:")
   (setq ss (ssget '((0 . "INSERT"))))
   (if ss
     (block_change ss block_name)
   )
 )
      )
    )
  )
)
;;;******************************
(defun tap_draw_layer_1_make (/)
  (if (= (TBLSEARCH "LAYER" tap_draw_layer_1) nil)
    (COMMAND "-LAYER"   "MAKE"       tap_draw_layer_1
      "COLOR"   "7″        ""     "ltype"
      "Continuous" ""        ""
     )
  )
)
(defun tap_draw_layer_2_make (/)
  (if (= (TBLSEARCH "LAYER" tap_draw_layer_2) nil)
    (COMMAND "-LAYER"   "MAKE"       tap_draw_layer_2
      "COLOR"   "1″        ""     "ltype"
      "Continuous" ""        ""
     )
  )
)
(defun tap_draw_layer_3_make (/)
  (if (= (TBLSEARCH "LAYER" tap_draw_layer_3) nil)
    (COMMAND "-LAYER"  "MAKE"      tap_draw_layer_3
      "COLOR"  "2″      ""   "ltype"
      "hidden"  ""      ""
     )
  )
)
(defun tap_draw_layer_4_make (/)
  (if (= (TBLSEARCH "LAYER" tap_draw_layer_4) nil)
    (COMMAND "-LAYER"  "MAKE"      tap_draw_layer_4
      "COLOR"  "1″      ""   "ltype"
      "center"  ""      ""
     )
  )
)
(defun tap_draw_dcl (/      tap_draw_dcl_name
       tap_draw_dcl_name_1   tap_draw_dcl_name_2
       dcl_id
      )
  (vl-load-com)
  (setq tap_draw_dcl_name
  (vl-filename-mktemp "tap_draw.dcl")
 tap_draw_dcl_name_1
  (open tap_draw_dcl_name "w")
 tap_draw_dcl_name_2
  (strcat
    "tap_draw : dialog {
label = "2D 탭";
: row {
: boxed_column {
    label = "탭 유형";
    width = 15;
    fixed_width = true;
      :row {
     :boxed_radio_column { label = "도면 상태";
                                        key = "tap_draw_type_1";
         : radio_button { label = "평면도"; key = "0";}
         : radio_button { label = "정면 관통"; key = "1";}
         : radio_button { label = "정면 깊이"; key = "2";}
        }
         spacer_1;
     : text { label = "    탭 깊이"; }
: edit_box{ key = "tap_draw_type_4";    width = 1;}
         spacer_1;
}
: row {
  : toggle { label = "블럭으로 그리기" ; key = "tap_draw_type_5";}
: toggle { label = "블럭 교체" ; key = "tap_draw_type_6";} 
}
spacer_1;
: column{
: toggle { label = "은선으로 그리기" ; key = "tap_draw_type_7";}
: toggle { label = "중심선으로 그리기" ; key = "tap_draw_type_8";}
}
spacer_1;
: row {
: text {label = "설정 탭규격"; is_bold = true;}
: text {key = "tap_draw_type_9"; is_bold = true; width = 5;}
      }
}
: boxed_column {
    label = "탭 사이즈";
    width = 15;
    fixed_width = true;
: row {
: button {
label = "M2.5";
key = "tap_draw_3";
width = 5;
height = 1.5;
}
: button {
label = "M3";
key = "tap_draw_4";
width = 5;
height = 1.5;
}
: button {
label = "M4";
key = "tap_draw_6";
width = 5;
height = 1.5;
}
}
: row {
: button {
label = "M5";
key = "tap_draw_7";
width = 5;
height = 1.5;
}
"    "
: button {
label = "M6";
key = "tap_draw_8";
width = 5;
height = 1.5;
}
: button {
label = "M8";
key = "tap_draw_10";
width = 5;
height = 1.5;
}
}
: row {
: button {
label = "M10";
key = "tap_draw_11";
width = 5;
height = 1.5;
}
: button {
label = "M12";
key = "tap_draw_12";
width = 5;
height = 1.5;
}
: button {
label = "M14";
key = "tap_draw_13";
width = 5;
height = 1.5;
}
}
: row {
: button {
label = "M16";
key = "tap_draw_14";
width = 5;
height = 1.5;
}
: button {
label = "M18";
key = "tap_draw_15";
width = 5;
height = 1.5;
}
: button {
label = "M20";
key = "tap_draw_16";
width = 5;
height = 1.5;
}
}
"    "
: row {
: button {
label = "M22";
key = "tap_draw_17";
width = 5;
height = 1.5;
}
: button {
label = "M24";
key = "tap_draw_18";
width = 5;
height = 1.5;
}
: button {
label = "M30";
key = "tap_draw_20";
width = 5;
height = 1.5;
}
}
}}
spacer_1;
ok_cancel;
}")
  )
  (write-line tap_draw_dcl_name_2 tap_draw_dcl_name_1)
  (close tap_draw_dcl_name_1)
  (setq dcl_id (load_dialog tap_draw_dcl_name))
  (if (not (new_dialog "tap_draw" dcl_id))
    (exit)
  )
  (setq ok1 0)
  (if (= tap_draw_type_1 nil)
    (setq tap_draw_type_1 "0″)
  )
  ;(if (= tap_draw_type_2 nil)
    ;(setq tap_draw_type_2 "20″)
 ; )
  (if (= tap_draw_type_3 nil)
    (setq tap_draw_type_3 "1″)
  )
  (if (= tap_draw_type_4 nil)
    ;(setq tap_draw_type_4 tap_draw_type_2)
(setq tap_draw_type_4  "4″  tap_draw_type_2 (rtos (+ (atof tap_draw_type_4) 2)2 2))
  )
  (if (= tap_draw_type_5 nil)
    (setq tap_draw_type_5 "0″)
  )
  (if (= tap_draw_type_1 "0″)
    (if (= tap_draw_type_7 nil)
      (setq tap_draw_type_7 "0″)
    )
    (if (= tap_draw_type_7 nil)
      (setq tap_draw_type_7 "1″)
    )
  )
  (if (= tap_draw_type_8 nil)
    (setq tap_draw_type_8 "1″)
  )
  (if (= tap_draw_dia nil)
    (setq tap_draw_dia 8)
  )
  (SET_TILE "tap_draw_type_1″ tap_draw_type_1)
  ;(SET_TILE "tap_draw_type_2″ tap_draw_type_2)
  ;(SET_TILE "tap_draw_type_3″ tap_draw_type_3)
  (SET_TILE "tap_draw_type_4″ tap_draw_type_4)
  (SET_TILE "tap_draw_type_5″ tap_draw_type_5)
  (SET_TILE "tap_draw_type_7″ tap_draw_type_7)
  (SET_TILE "tap_draw_type_8″ tap_draw_type_8)
  (SET_TILE "tap_draw_type_9″
     (strcat "M" (rtos tap_draw_dia))
  )
  (tap_draw_dcl_start)
  (action_tile
    "tap_draw_type_1″
    "(setq tap_draw_type_1 $value tap_draw_type_3 $value)(tap_draw_dcl_start)"
  )
  ;(action_tile
   ; "tap_draw_type_2″
   ; "(setq tap_draw_type_2 $value)(tap_draw_dcl_start)"
 ; )
 ; (action_tile
   ;  "tap_draw_type_3″
   ; "(setq tap_draw_type_3 $value)(tap_draw_dcl_start)"
 ; )
  (action_tile
    "tap_draw_type_4″
    "(setq tap_draw_type_4 $value)(tap_draw_dcl_start)"
  )
  (action_tile
    "tap_draw_type_5″
    "(setq tap_draw_type_5 $value)(tap_draw_dcl_start)"
  )
  (action_tile
    "tap_draw_type_6″
    "(setq tap_draw_type_6 $value)"
  )
  (action_tile
    "tap_draw_type_7″
    "(setq tap_draw_type_7 $value)"
  )
  (action_tile
    "tap_draw_type_8″
    "(setq tap_draw_type_8 $value)"
  )
  (action_tile
    "tap_draw_3″
    "(setq tap_draw_dia 2.5 ok1 1)(done_dialog)"
  )
  (action_tile
    "tap_draw_4″
    "(setq tap_draw_dia 3 ok1 1)(done_dialog)"
  )
  (action_tile
    "tap_draw_5″
    "(setq tap_draw_dia 3.5 ok1 1)(done_dialog)"
  )
  (action_tile
    "tap_draw_6″
    "(setq tap_draw_dia 4 ok1 1)(done_dialog)"
  )
  (action_tile
    "tap_draw_7″
    "(setq tap_draw_dia 5 ok1 1)(done_dialog)"
  )
  (action_tile
    "tap_draw_8″
    "(setq tap_draw_dia 6 ok1 1)(done_dialog)"
  )
  (action_tile
    "tap_draw_10″
    "(setq tap_draw_dia 8 ok1 1)(done_dialog)"
  )
  (action_tile
    "tap_draw_11″
    "(setq tap_draw_dia 10 ok1 1)(done_dialog)"
  )
  (action_tile
    "tap_draw_12″
    "(setq tap_draw_dia 12 ok1 1)(done_dialog)"
  )
  (action_tile
    "tap_draw_13″
    "(setq tap_draw_dia 14 ok1 1)(done_dialog)"
  )
  (action_tile
    "tap_draw_14″
    "(setq tap_draw_dia 16 ok1 1)(done_dialog)"
  )
  (action_tile
    "tap_draw_15″
    "(setq tap_draw_dia 18 ok1 1)(done_dialog)"
  )
  (action_tile
    "tap_draw_16″
    "(setq tap_draw_dia 20 ok1 1)(done_dialog)"
  )
  (action_tile
    "tap_draw_17″
    "(setq tap_draw_dia 22 ok1 1)(done_dialog)"
  )
  (action_tile
    "tap_draw_18″
    "(setq tap_draw_dia 24(tap_chk 24) ok1 1)(done_dialog)"
  )
  (action_tile
    "tap_draw_20″
    "(setq tap_draw_dia 30 ok1 1)(done_dialog)"
  )
  (setq ok (start_dialog))
  (done_dialog)
  (unload_dialog dcl_id)
  (vl-file-delete tap_draw_dcl_name)
)
(defun tap_draw_dcl_start (/)
  (if (= tap_draw_type_1 "0″)
    (progn
      (MODE_TILE "tap_draw_type_2″ 1)
      (MODE_TILE "tap_draw_type_3″ 1)
      (MODE_TILE "tap_draw_type_4″ 1)
    )
    (progn
      (if (= tap_draw_type_1 "1″)
 (MODE_TILE "tap_draw_type_2″ 1)
 (MODE_TILE "tap_draw_type_2″ 0)
      )
     ; (MODE_TILE "tap_draw_type_3″ 0)
      (if (= tap_draw_type_3 "2″)
 (progn
   (MODE_TILE "tap_draw_type_4″ 0)
   (if  (= tap_draw_type_1 "2″)
     (progn
       (setq tap_draw_type_4 tap_draw_type_4 )
       (MODE_TILE "tap_draw_type_4″ 0)
     )
   )
 )
 (MODE_TILE "tap_draw_type_4″ 1)
      )
    )
  )
  (if (= tap_draw_type_5 "1″)
    (progn
      (MODE_TILE "tap_draw_type_6″ 0)
      (if (= tap_draw_type_6 nil)
 (setq tap_draw_type_6 "0″)
      )a
      (SET_TILE "tap_draw_type_6″ tap_draw_type_6)
    )
    (progn
      (MODE_TILE "tap_draw_type_6″ 1)
    )
  )
)
(princ)

관련자료

댓글 0 / 1 페이지
등록된 댓글이 없습니다.
전체 7,416 / 352 페이지
RSS
번호
제목
이름

최근글


새댓글


알림 0