자료실 Q&A
글 수 2,319
||||(defun c:WW()
(setq thick (getstring "\n철판두께는? "))
(setq area_ch "" area_temp 0.0)
(setq peri_ch "" peri_temp 0.0)
(setq e1 (ssget '(
(-4 . "<OR")
(0 . "LWPOLYLINE")
(0 . "circle")
(-4 . "OR>")
)
)
)
(setq e2 (sslength e1))
(setq e3 0)
(setq e5 nil)
(setq area_temp 0)
(setq peri_tem 0)
(setq x_file1 (open "c:/tx1.txt" "w"))
(while (/= e3 e2)
(setq e4 (ssname e1 e3))
(command "area" "a" "o" e4 "" "")
(setq area_temp (getvar "area"))
(setq peri_temp (getvar "perimeter"))
(princ area_temp x_file1)(princ "\n" x_file1)
(setq peri1 (+ peri_temp peri_tem))
(setq e3 (+ 1 e3))
(setq peri_tem peri1)
)
(close x_file1)
(okx2_exe)
(okx3_exe)
(okx4_exe)
(vl-file-delete "c:/tx1.txt")
(vl-file-delete "c:/tx2.txt")
)
(defun okx2_exe()
(setq x_file2 (open "c:/tx1.txt" "r"))
(setq x_file3 (open "c:/tx2.txt" "w"))
(setq x_k (read-char x_file2))
(setq x_l (list))
(setq x_m "")
(setq x_n (list))
(while (/= x_k nil)
(if (= x_k 10)
(if (/= x_m "")
(setq x_l (append x_l (list x_m)) x_m "")
)
(setq x_m (strcat x_m (chr x_k)))
);;if
(setq x_k (read-char x_file2))
);;while
(close x_file2)
(setq x_l (append x_l (list x_m)) x_m "")
(setq x_o1 0 x_m (nth x_o1 x_l))
(while (/= x_m nil)
(if (/= x_m "")(setq x_n (tx_q1 x_m)))
(setq x_m (nth x_o1 x_l))
(setq x_o1 (1+ x_o1))
);;while
(setq xf x_o1)
(setq xg 2)
(setq xh (- xf xg))
(setq x_o3 0)
(setq x_p (nth x_o3 x_l))
(setq xx_p 0)
(repeat xf
(if (/= x_o3 xh)
(progn
(setq x_p (nth x_o3 x_l))
(setq xy_p (atof x_p))
(setq x_o3 (1+ x_o3))
(princ x_p x_file3)(princ "\n" x_file3)
(if (> xy_p xx_p)
(setq xx_p xy_p)
)
)
)
)
(close x_file3)
(setq mxx_p xx_p)
)
(defun okx3_exe()
(setq x_file4 (open "c:/tx1.txt" "r"))
(setq mx_k (read-char x_file4))
(setq mx_l (list))
(setq mx_m "")
(setq mx_n (list))
(while (/= mx_k nil)
(if (= mx_k 10)
(if (/= mx_m "")
(setq mx_l (append mx_l (list mx_m)) mx_m "")
)
(setq mx_m (strcat mx_m (chr mx_k)))
);;if
(setq mx_k (read-char x_file4))
);;while
(close x_file4)
(setq mx_l (append mx_l (list mx_m)) mx_m "")
(setq mx_o1 0 mx_m (nth mx_o1 mx_l))
(while (/= mx_m nil)
(if (/= mx_m "")(setq mx_n (tmx_q1 mx_m)))
(setq mx_m (nth mx_o1 mx_l))
(setq mx_o1 (1+ mx_o1))
);;while
(setq mxf mx_o1)
(setq mxg 2)
(setq mxh (- mxf mxg))
(setq mx_o3 0)
(setq mx_p (nth mx_o3 mx_l))
(repeat mxf
(if (/= mx_o3 mxh)
(progn
(setq mx_p (nth mx_o3 mx_l))
(setq mxy_p (atof mx_p))
(if (= mxy_p xx_p)
(progn
(setq mx_o3 (1+ mx_o3))
)
(progn
(setq qxx_p (- mxx_p mxy_p))
(setq mx_o3 (1+ mx_o3))
(setq mxx_p qxx_p)
)
)
)
)
)
;; (princ mxx_p)(princ "\n")
)
(defun okx4_exe()
(setq area_ch (rtos mxx_p 2 3))
(setq peri_ch (rtos peri_tem 2 3))
(setq weight1 (/ 7.85 1000000))
(setq vthick (atof thick))
(setq varea (atof area_ch))
(setq weight2 (* weight1 vthick))
(setq warea (* weight2 varea))
(setq weight (rtos warea))
(command "osmode" 0)
(setq eee2 (itoa e2))
(setq iiip (strcat "두께=" thick "T," " 단중=" weight "kg," " 절단길이=" peri_ch "mm," " 예열개소=" eee2))
(setq pppo (getpoint "\n첫번째점을 찍으세요..."))
(command "style" "tt" "romans,whgtxt" "6" "0.8" "" "" "" "")
(command "text" "s" "tt" "j" "ml" pppo "" iiip)
(command "osmode" 37)
)
(defun tx_q1(x_m / x_m x_o1 x_r1 x_n x_s1 x_n x_t1 x_u1)
(setq x_o1 1 x_n (list) x_t1 "" x_r1 (strlen x_m));;setq
(setq x_u1 (substr x_m x_o1 1))
(while (<= x_o1 x_r1)
(if (x_v1 x_u1)
(progn
(if (/= x_t1 "")
(setq x_n (append x_n (list x_t1)))
);;if
(setq x_t1 x_u1)
);;progn
(if (and (/= x_u1 "(")(/= x_u1 " "))(setq x_t1 (strcat x_t1 x_u1)))
);;if
(if (= x_u1 "(")
(setq x_t1 (substr x_m x_o1) x_o1 1000)
);;if
(setq x_o1 (1+ x_o1))
(setq x_u1 (substr x_m x_o1 1))
);;while
(setq x_n (append x_n (list x_t1)))
(setq x_s1 x_n)
);;tx_q1
(defun x_v1(x_k / x_k x_w1 x_s1 x_o1)
(setq x_x1 (list "A")
x_w1 nil
x_o1 (- (length x_x1) 1)
);;setq
(while (>= x_o1 0)
(setq x_w1 (or x_w1 (= x_k (nth x_o1 x_x1))))
(setq x_o1 (1- x_o1))
);;while
(setq x_s1 x_w1)
);;x_v1
(defun tmx_q1(mx_m / mx_m mx_o1 mx_r1 mx_n mx_s1 mx_n mx_t1 mx_u1)
(setq mx_o1 1 mx_n (list) mx_t1 "" mx_r1 (strlen mx_m));;setq
(setq mx_u1 (substr mx_m mx_o1 1))
(while (<= mx_o1 mx_r1)
(if (mx_v1 mx_u1)
(progn
(if (/= mx_t1 "")
(setq mx_n (append mx_n (list mx_t1)))
);;if
(setq mx_t1 mx_u1)
);;progn
(if (and (/= mx_u1 "(")(/= mx_u1 " "))(setq mx_t1 (strcat mx_t1 mx_u1)))
);;if
(if (= mx_u1 "(")
(setq mx_t1 (substr mx_m mx_o1) mx_o1 1000)
);;if
(setq mx_o1 (1+ mx_o1))
(setq mx_u1 (substr mx_m mx_o1 1))
);;while
(setq mx_n (append mx_n (list mx_t1)))
(setq mx_s1 mx_n)
);;tmx_q1
(defun mx_v1(mx_k / mx_k mx_w1 mx_s1 mx_o1)
(setq mx_x1 (list "A")
mx_w1 nil
mx_o1 (- (length mx_x1) 1)
);;setq
(while (>= mx_o1 0)
(setq mx_w1 (or mx_w1 (= mx_k (nth mx_o1 mx_x1))))
(setq mx_o1 (1- mx_o1))
);;while
(setq mx_s1 mx_w1)
);;mx_v1
(setq thick (getstring "\n철판두께는? "))
(setq area_ch "" area_temp 0.0)
(setq peri_ch "" peri_temp 0.0)
(setq e1 (ssget '(
(-4 . "<OR")
(0 . "LWPOLYLINE")
(0 . "circle")
(-4 . "OR>")
)
)
)
(setq e2 (sslength e1))
(setq e3 0)
(setq e5 nil)
(setq area_temp 0)
(setq peri_tem 0)
(setq x_file1 (open "c:/tx1.txt" "w"))
(while (/= e3 e2)
(setq e4 (ssname e1 e3))
(command "area" "a" "o" e4 "" "")
(setq area_temp (getvar "area"))
(setq peri_temp (getvar "perimeter"))
(princ area_temp x_file1)(princ "\n" x_file1)
(setq peri1 (+ peri_temp peri_tem))
(setq e3 (+ 1 e3))
(setq peri_tem peri1)
)
(close x_file1)
(okx2_exe)
(okx3_exe)
(okx4_exe)
(vl-file-delete "c:/tx1.txt")
(vl-file-delete "c:/tx2.txt")
)
(defun okx2_exe()
(setq x_file2 (open "c:/tx1.txt" "r"))
(setq x_file3 (open "c:/tx2.txt" "w"))
(setq x_k (read-char x_file2))
(setq x_l (list))
(setq x_m "")
(setq x_n (list))
(while (/= x_k nil)
(if (= x_k 10)
(if (/= x_m "")
(setq x_l (append x_l (list x_m)) x_m "")
)
(setq x_m (strcat x_m (chr x_k)))
);;if
(setq x_k (read-char x_file2))
);;while
(close x_file2)
(setq x_l (append x_l (list x_m)) x_m "")
(setq x_o1 0 x_m (nth x_o1 x_l))
(while (/= x_m nil)
(if (/= x_m "")(setq x_n (tx_q1 x_m)))
(setq x_m (nth x_o1 x_l))
(setq x_o1 (1+ x_o1))
);;while
(setq xf x_o1)
(setq xg 2)
(setq xh (- xf xg))
(setq x_o3 0)
(setq x_p (nth x_o3 x_l))
(setq xx_p 0)
(repeat xf
(if (/= x_o3 xh)
(progn
(setq x_p (nth x_o3 x_l))
(setq xy_p (atof x_p))
(setq x_o3 (1+ x_o3))
(princ x_p x_file3)(princ "\n" x_file3)
(if (> xy_p xx_p)
(setq xx_p xy_p)
)
)
)
)
(close x_file3)
(setq mxx_p xx_p)
)
(defun okx3_exe()
(setq x_file4 (open "c:/tx1.txt" "r"))
(setq mx_k (read-char x_file4))
(setq mx_l (list))
(setq mx_m "")
(setq mx_n (list))
(while (/= mx_k nil)
(if (= mx_k 10)
(if (/= mx_m "")
(setq mx_l (append mx_l (list mx_m)) mx_m "")
)
(setq mx_m (strcat mx_m (chr mx_k)))
);;if
(setq mx_k (read-char x_file4))
);;while
(close x_file4)
(setq mx_l (append mx_l (list mx_m)) mx_m "")
(setq mx_o1 0 mx_m (nth mx_o1 mx_l))
(while (/= mx_m nil)
(if (/= mx_m "")(setq mx_n (tmx_q1 mx_m)))
(setq mx_m (nth mx_o1 mx_l))
(setq mx_o1 (1+ mx_o1))
);;while
(setq mxf mx_o1)
(setq mxg 2)
(setq mxh (- mxf mxg))
(setq mx_o3 0)
(setq mx_p (nth mx_o3 mx_l))
(repeat mxf
(if (/= mx_o3 mxh)
(progn
(setq mx_p (nth mx_o3 mx_l))
(setq mxy_p (atof mx_p))
(if (= mxy_p xx_p)
(progn
(setq mx_o3 (1+ mx_o3))
)
(progn
(setq qxx_p (- mxx_p mxy_p))
(setq mx_o3 (1+ mx_o3))
(setq mxx_p qxx_p)
)
)
)
)
)
;; (princ mxx_p)(princ "\n")
)
(defun okx4_exe()
(setq area_ch (rtos mxx_p 2 3))
(setq peri_ch (rtos peri_tem 2 3))
(setq weight1 (/ 7.85 1000000))
(setq vthick (atof thick))
(setq varea (atof area_ch))
(setq weight2 (* weight1 vthick))
(setq warea (* weight2 varea))
(setq weight (rtos warea))
(command "osmode" 0)
(setq eee2 (itoa e2))
(setq iiip (strcat "두께=" thick "T," " 단중=" weight "kg," " 절단길이=" peri_ch "mm," " 예열개소=" eee2))
(setq pppo (getpoint "\n첫번째점을 찍으세요..."))
(command "style" "tt" "romans,whgtxt" "6" "0.8" "" "" "" "")
(command "text" "s" "tt" "j" "ml" pppo "" iiip)
(command "osmode" 37)
)
(defun tx_q1(x_m / x_m x_o1 x_r1 x_n x_s1 x_n x_t1 x_u1)
(setq x_o1 1 x_n (list) x_t1 "" x_r1 (strlen x_m));;setq
(setq x_u1 (substr x_m x_o1 1))
(while (<= x_o1 x_r1)
(if (x_v1 x_u1)
(progn
(if (/= x_t1 "")
(setq x_n (append x_n (list x_t1)))
);;if
(setq x_t1 x_u1)
);;progn
(if (and (/= x_u1 "(")(/= x_u1 " "))(setq x_t1 (strcat x_t1 x_u1)))
);;if
(if (= x_u1 "(")
(setq x_t1 (substr x_m x_o1) x_o1 1000)
);;if
(setq x_o1 (1+ x_o1))
(setq x_u1 (substr x_m x_o1 1))
);;while
(setq x_n (append x_n (list x_t1)))
(setq x_s1 x_n)
);;tx_q1
(defun x_v1(x_k / x_k x_w1 x_s1 x_o1)
(setq x_x1 (list "A")
x_w1 nil
x_o1 (- (length x_x1) 1)
);;setq
(while (>= x_o1 0)
(setq x_w1 (or x_w1 (= x_k (nth x_o1 x_x1))))
(setq x_o1 (1- x_o1))
);;while
(setq x_s1 x_w1)
);;x_v1
(defun tmx_q1(mx_m / mx_m mx_o1 mx_r1 mx_n mx_s1 mx_n mx_t1 mx_u1)
(setq mx_o1 1 mx_n (list) mx_t1 "" mx_r1 (strlen mx_m));;setq
(setq mx_u1 (substr mx_m mx_o1 1))
(while (<= mx_o1 mx_r1)
(if (mx_v1 mx_u1)
(progn
(if (/= mx_t1 "")
(setq mx_n (append mx_n (list mx_t1)))
);;if
(setq mx_t1 mx_u1)
);;progn
(if (and (/= mx_u1 "(")(/= mx_u1 " "))(setq mx_t1 (strcat mx_t1 mx_u1)))
);;if
(if (= mx_u1 "(")
(setq mx_t1 (substr mx_m mx_o1) mx_o1 1000)
);;if
(setq mx_o1 (1+ mx_o1))
(setq mx_u1 (substr mx_m mx_o1 1))
);;while
(setq mx_n (append mx_n (list mx_t1)))
(setq mx_s1 mx_n)
);;tmx_q1
(defun mx_v1(mx_k / mx_k mx_w1 mx_s1 mx_o1)
(setq mx_x1 (list "A")
mx_w1 nil
mx_o1 (- (length mx_x1) 1)
);;setq
(while (>= mx_o1 0)
(setq mx_w1 (or mx_w1 (= mx_k (nth mx_o1 mx_x1))))
(setq mx_o1 (1- mx_o1))
);;while
(setq mx_s1 mx_w1)
);;mx_v1