dcl 작성 해서 미리 보기하면
사각형 가로,세로 확인
원형 지름 확인
이렇게 제가 나누어 놓았습니다.
사각형에 있는 확인을 누르면 캐드상에 사각형만 그려지게 하고싶고
원형에 있는 확인을 누르면 캐드상에 원형만 그려지게 하고 싶은데
제가 지금 소스 나누는거 정리를 잘 못하여 확인 누르면 사각형과 원형이
다 같이 그려져서 문제 입니다.
소스내용 적어놓을테니 수정 부탁드립니다.
dcl 소스는
aaa : dialog { label = “옵션”;
:row {
:column{
:boxed_column{label = “모재”;
:edit_box {label = “X”; key = “key1”; edit_width = 5;}
:edit_box {label = “Y”; key = “key2”; edit_width = 5;}
}
:boxed_column{label = “오차보정”;
:edit_box {label = “Ex”; key = “key3”; edit_width = 5;}
:edit_box {label = “Ey”; key = “key4”; edit_width = 5;}
:edit_box {label = “Ec”; key = “key5”; edit_width = 5;}
}
}
:boxed_column{label = “사각형”;
:column {
:image {key = “image1”; width = 16; height = 8; color =0; }
:edit_box { label = “X Length”; key = “key6” ; edit_width = 5;}
:edit_box { label = “Y Length”; key = “key7” ; edit_width = 5;}
}
ok_only;
}
:boxed_column{label = “원형”;
:column {
:image {key = “image2”; width = 16; height = 10; color =0; }
:edit_box { label = “Ø”; key = “key8” ; edit_width = 5;}
}
ok_only;
}
}
}
그리고 lsp 소스는
(defun c:aaa()
(if (/= (aaadlg) 0)
(progn
(setq p1 (list 0 0))
(setq p2 (polar p1 (dtr 90) (atof B)))
(setq p3 (polar p2 0 (atof A)))
(setq p4 (polar p1 0 (atof A)))
;;****************************
;; 원형
;;****************************
(defun aaacir()
(initget 1)
(setq A1 (/ (atof A) 2))
(setq A2 (/ A1 2))
(setq A21 (- A1 A2))
(setq A22 (+ A1 A2))
(setq o1 (list a21 b21))
(setq A1 (/ (atof A) 2))
(setq A2 (/ A1 2))
(setq A21 (- A1 A2))
(setq A22 (+ A1 A2))
(setq B1 (/ (atof B) 2))
(setq B2 (/ B1 2))
(setq B21 (- B1 B2))
(setq B22 (+ B1 B2))
(setq o2 (list a21 b22))
(setq B1 (/ (atof B) 2))
(setq B2 (/ B1 2))
(setq B21 (- B1 B2))
(setq B22 (+ B1 B2))
(setq C1 (/ (atof C) 2))
(setq C2 (/ C1 2))
(setq C21 (- C1 C2))
(setq C22 (+ C1 C2))
(setq o3 (list a22 b22))
(setq C1 (/ (atof C) 2))
(setq C2 (/ C1 2))
(setq C21 (- C1 C2))
(setq C22 (+ C1 C2))
(setq D1 (/ (atof D) 2))
(setq D2 (/ D1 2))
(setq D21 (- D1 D2))
(setq D22 (+ D1 D2))
(setq o4 (list a22 b21))
(setq D1 (/ (atof D) 2))
(setq D2 (/ D1 2))
(setq D21 (- D1 D2))
(setq D22 (+ D1 D2))
(setq o1 (list a21 b21))
(setq o2 (list a21 b22))
(setq o3 (list a22 b22))
(setq o4 (list a22 b21))
(setq x1 (/ (atof n1) 2))
(setq y1 (/ (atof n2) 2))
;;************************
;;사각형
;;************************
(defun aaarec()
(initget 1)
(setq aa1 (list (- (car o1) x1) (- (cadr o1) y1)))
(setq aa2 (polar aa1 (dtr 90) (atof n2)))
(setq aa3 (polar aa2 0 (atof n1)))
(setq aa4 (polar aa1 0 (atof n1)))
(setq bb1 (list (- (car o2) x1) (- (cadr o2) y1)))
(setq bb2 (polar bb1 (dtr 90) (atof n2)))
(setq bb3 (polar bb2 0 (atof n1)))
(setq bb4 (polar bb1 0 (atof n1)))
(setq cc1 (list (- (car o3) x1) (- (cadr o3) y1)))
(setq cc2 (polar cc1 (dtr 90) (atof n2)))
(setq cc3 (polar cc2 0 (atof n1)))
(setq cc4 (polar cc1 0 (atof n1)))
(setq dd1 (list (- (car o4) x1) (- (cadr o4) y1)))
(setq dd2 (polar dd1 (dtr 90) (atof n2)))
(setq dd3 (polar dd2 0 (atof n1)))
(setq dd4 (polar dd1 0 (atof n1)))
(command “pline” aa1 aa2 aa3 aa4 “c”)
(command “pline” bb1 bb2 bb3 bb4 “c”)
(command “pline” cc1 cc2 cc3 cc4 “c”)
(command “pline” dd1 dd2 dd3 dd4 “c”)
(command “pline” p1 p2 p3 p4 “c”)
(command “circle” o1 (Atof C))
(command “circle” o2 (Atof C))
(command “circle” o3 (Atof C))
(command “circle” o4 (Atof C))
)
)
)
;;;
(defun aaadlg()
(setq A “120”)
(setq B “40”)
(setq N1 “12”)
(setq N2 “10”)
(setq c “8”)
(setq dcl_id (load_dialog “c:/UserPRG/lemon.dcl”))
(if (not (new_dialog “aaa” dcl_id)) (exit))
(start_image “image1”)
(slide_image 0 0 (dimx_tile “image1”) (dimy_tile “image1”) “c:/UserPRG/Drawing1”)
(end_image)
(start_image “image2”)
(slide_image 0 0 (dimx_tile “image2”) (dimy_tile “image2”) “c:/UserPRG/Drawing2”)
(end_image)
(set_tile “key1” A)
(set_tile “key2” B)
(set_tile “key6” N1)
(set_tile “key7” N2)
(set_tile “key8” C)
(action_tile “key1” “(setq A $value)”)
(action_tile “key2” “(setq B $value)”)
(action_tile “key6” “(setq N1 $value)”)
(action_tile “key7” “(setq N2 $value)”)
(action_tile “key8” “(setq C $value)”)
(start_dialog)
)
;;;
(defun dtr(a) (setq x (* pi (/ a 180.0))))
입니다. 제가 책 보고 시도해보았는데 안되었네요
lsp 소스에서 나누는것 같습니다 그렇나요?
수정 꼭 부탁 드립니다.고수님들….정말 정말 부탁 드립니다.!