Đến nội dung


Hình ảnh
- - - - -

Nhờ các bác chỉnh sửa giúp lisp bảng tọa độ


  • Please log in to reply
1 reply to this topic

#1 thanhbdhl

thanhbdhl

    Edu level: li3

  • Members
  • PipPip
  • 22 Bài viết
Điểm đánh giá: -1 (bình thường)

Đã gửi 10 December 2013 - 06:42 PM

 E đang dùng lips BTD_2 e không thành thạo về Autolisp nên e muốn nhờ các cao thủ chỉnh cho e 1 số ý như sau dc không ạ! mong các bác giúp đỡ sơm!

1 cho e chọn điểm thứ nhất để đánh số thứ tự

2 cho e chọn chiều đánh thứ tự đinh thửa ( thuận kim đồng hồ)

3 cho e chạy thêm cạnh thửa và đỉnh thửa theo bảng tọa độ.

e xin cảm ơn! 

 

 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;Chuyen gia tri goc tu do sang radian
;;;Cu phap su dung (duy:s_do>radian giatri)
;;;giatri la goc tinh theo do, kq la goc tinh theo radian
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun duy:s_do>radian (gt / gt kq)
(setq kq (* (/ pi 180) gt))
kq)
 
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;Tao moi text
;;;Cu phap su dung (duy:t_text diemchen docao gocquay canhle noidung textstyle layer color)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun duy:t_text (d c g cl nd k la co / d c g cl nd k la co)
(cond
((= cl "trai") (setq kcl 0))
((= cl "phai") (setq kcl 2))
((= cl "giua") (setq kcl 1))
)
(cond ((= g "") (setq g 0) ))
(cond ((= cl "") (setq kcl 0) ))
(setq g (duy:s_do>radian g))
(cond ((= k "") (setq k (getvar "TEXTSTYLE")) ))
(cond ((= la "") (setq la (getvar "Clayer")) ))
(cond ((= co "") (setq co 256) ))
(entmake (list (cons 0 "TEXT")(cons 10 d)(cons 11 d)(cons 40 c)(cons 50 g)(cons 72 kcl)(cons 1 nd)(cons 7 k)(cons 8 la)(cons 62 co)))
(princ)
)
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;Tao moi line
;;;Cu phap su dung (duy:t_line diemdau diemcuoi layer color ltype ltypescale)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun duy:t_line (a b la co lt slt / a b la co lt slt)
(cond ((= la "") (setq la (getvar "Clayer")) ))
(cond ((= co "") (setq co 256) ))
(cond ((= lt "") (setq lt "bylayer") ))
(cond ((= slt "") (setq slt 1) ))
(entmake (list (cons 0 "LINE")(cons 10 a)(cons 11 B)(cons 8 la)(cons 62 co)(cons 6 lt)(cons 48 slt) ))
(princ)
)
 
(defun c:btd (/ ddt dtn dth)
(command "undo" "be")
(setq dvbd (getpoint "\nChon diem viet bang: "))
(duy:t_line dvbd (list (+ (car dvbd) 30) (cadr dvbd)) "" "" "" "")
(duy:t_line (list (car dvbd) (- (cadr dvbd) 5)) (list (+ (car dvbd) 30) (- (cadr dvbd) 5)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 0) (- (cadr dvbd) 0)) (list (+ (car dvbd) 0) (- (cadr dvbd) 5)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 5) (- (cadr dvbd) 0)) (list (+ (car dvbd) 5) (- (cadr dvbd) 5)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 23) (- (cadr dvbd) 0)) (list (+ (car dvbd) 23) (- (cadr dvbd) 5)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 26.5) (- (cadr dvbd) 0)) (list (+ (car dvbd) 26.5) (- (cadr dvbd) 5)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 30) (- (cadr dvbd) 0)) (list (+ (car dvbd) 30) (- (cadr dvbd) 5)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 5) (- (cadr dvbd) 2.5)) (list (+ (car dvbd) 23) (- (cadr dvbd) 2.5)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 14) (- (cadr dvbd) 2.5)) (list (+ (car dvbd) 14) (- (cadr dvbd) 5)) "" "" "" "")
 
(duy:t_text (list (+ (car dvbd) 2.5) (- (cadr dvbd) 3)) 1 0 "giua" "§Ønh" "" "" "")
(duy:t_text (list (+ (car dvbd) 14) (- (cadr dvbd) 1.75)) 1 0 "giua" "Täa §é" "" "" "")
(duy:t_text (list (+ (car dvbd) 9.5) (- (cadr dvbd) 4.25)) 1 0 "giua" "X (m)" "" "" "")
(duy:t_text (list (+ (car dvbd) 18.5) (- (cadr dvbd) 4.25)) 1 0 "giua" "Y (m)" "" "" "")
(duy:t_text (list (+ (car dvbd) 24.75) (- (cadr dvbd) 1.75)) 1 0 "giua" "Tªn" "" "" "")
(duy:t_text (list (+ (car dvbd) 28.25) (- (cadr dvbd) 1.75)) 1 0 "giua" "C¹nh" "" "" "")
(duy:t_text (list (+ (car dvbd) 24.75) (- (cadr dvbd) 4.25)) 1 0 "giua" "C¹nh" "" "" "")
(duy:t_text (list (+ (car dvbd) 28.25) (- (cadr dvbd) 4.25)) 1 0 "giua" "(m)" "" "" "")
 
(setq dvbd (list (car dvbd) (- (cadr dvbd) 5)))
(duy:t_line (list (car dvbd) (- (cadr dvbd) 2)) (list (+ (car dvbd) 23) (- (cadr dvbd) 2)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 23) (- (cadr dvbd) 3)) (list (+ (car dvbd) 30) (- (cadr dvbd) 3)) "" "" "" "")
 
(setq ddt (getpoint "\nChon diem thu 1: "))
(setq dtn ddt)
(setq sttn 1)
(duy:t_text (list (+ (car dvbd) 2.5) (- (cadr dvbd) 1.5)) 1 0 "giua" "1" "" "" "")
(duy:t_text (list (+ (car dvbd) 9.5) (- (cadr dvbd) 1.5)) 1 0 "giua" (rtos (cadr dtn) 2 3) "" "" "")
(duy:t_text (list (+ (car dvbd) 18.5) (- (cadr dvbd) 1.5)) 1 0 "giua" (rtos (car dtn) 2 3) "" "" "")
 
(while (setq dth (getpoint dtn(strcat "\nChon diem thu " (rtos (+ sttn 1) 2 0) " <Enter de ket thuc!>")  ))
(grdraw dtn dth 7)
(duy:t_line (list (car dvbd) (- (- (cadr dvbd) (* 2 sttn)) 2)) (list (+ (car dvbd) 23) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
(duy:t_text (list (+ (car dvbd) 2.5) (- (- (cadr dvbd) (* 2 sttn)) 1.5)) 1 0 "giua" (rtos (+ sttn 1) 2 0) "" "" "")
(duy:t_text (list (+ (car dvbd) 9.5) (- (- (cadr dvbd) (* 2 sttn)) 1.5)) 1 0 "giua" (rtos (cadr dth) 2 3) "" "" "")
(duy:t_text (list (+ (car dvbd) 18.5) (- (- (cadr dvbd) (* 2 sttn)) 1.5)) 1 0 "giua" (rtos (car dth) 2 3) "" "" "")
(duy:t_text (list (+ (car dvbd) 24.8) (- (- (cadr dvbd) (* 2 sttn)) 0.5)) 1 0 "giua" (strcat (rtos sttn 2 0) "-" (rtos (+ sttn 1) 2 0)) "" "" "")
(duy:t_text (list (+ (car dvbd) 28.3) (- (- (cadr dvbd) (* 2 sttn)) 0.5)) 1 0 "giua" (rtos (distance dtn dth) 2 2) "" "" "")
(duy:t_line (list (+ (car dvbd) 23) (- (- (cadr dvbd) (* 2 sttn)) 3)) (list (+ (car dvbd) 30) (- (- (cadr dvbd) (* 2 sttn)) 3)) "" "" "" "")
 
(setq dtn dth)
(setq sttn (+ sttn 1))
)
(command ".erase" "last" "")
(duy:t_line (list (car dvbd) (- (- (cadr dvbd) (* 2 sttn)) 2)) (list (+ (car dvbd) 30) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
(duy:t_text (list (+ (car dvbd) 2.5) (- (- (cadr dvbd) (* 2 sttn)) 1.5)) 1 0 "giua" "1" "" "" "")
(duy:t_text (list (+ (car dvbd) 9.5) (- (- (cadr dvbd) (* 2 sttn)) 1.5)) 1 0 "giua" (rtos (cadr ddt) 2 3) "" "" "")
(duy:t_text (list (+ (car dvbd) 18.5) (- (- (cadr dvbd) (* 2 sttn)) 1.5)) 1 0 "giua" (rtos (car ddt) 2 3) "" "" "")
(duy:t_text (list (+ (car dvbd) 24.8) (- (- (cadr dvbd) (* 2 sttn)) 0.5)) 1 0 "giua" (strcat (rtos sttn 2 0) "-" "1") "" "" "")
(duy:t_text (list (+ (car dvbd) 28.3) (- (- (cadr dvbd) (* 2 sttn)) 0.5)) 1 0 "giua" (rtos (distance dtn ddt) 2 2) "" "" "")
 
 
(duy:t_line (list (+ (car dvbd) 0) (+ (cadr dvbd) 0)) (list (+ (car dvbd) 0) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 5) (+ (cadr dvbd) 0)) (list (+ (car dvbd) 5) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 14) (+ (cadr dvbd) 0)) (list (+ (car dvbd) 14) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 23) (+ (cadr dvbd) 0)) (list (+ (car dvbd) 23) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 26.5) (+ (cadr dvbd) 0)) (list (+ (car dvbd) 26.5) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 30) (+ (cadr dvbd) 0)) (list (+ (car dvbd) 30) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
 
 
(command "undo" "end")
(Princ)
)
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;Chuyen gia tri goc tu do sang radian
;;;Cu phap su dung (duy:s_do>radian giatri)
;;;giatri la goc tinh theo do, kq la goc tinh theo radian
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun duy:s_do>radian (gt / gt kq)
(setq kq (* (/ pi 180) gt))
kq)
 
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;Tao moi text
;;;Cu phap su dung (duy:t_text diemchen docao gocquay canhle noidung textstyle layer color)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun duy:t_text (d c g cl nd k la co / d c g cl nd k la co)
(cond
((= cl "trai") (setq kcl 0))
((= cl "phai") (setq kcl 2))
((= cl "giua") (setq kcl 1))
)
(cond ((= g "") (setq g 0) ))
(cond ((= cl "") (setq kcl 0) ))
(setq g (duy:s_do>radian g))
(cond ((= k "") (setq k (getvar "TEXTSTYLE")) ))
(cond ((= la "") (setq la (getvar "Clayer")) ))
(cond ((= co "") (setq co 256) ))
(entmake (list (cons 0 "TEXT")(cons 10 d)(cons 11 d)(cons 40 c)(cons 50 g)(cons 72 kcl)(cons 1 nd)(cons 7 k)(cons 8 la)(cons 62 co)))
(princ)
)
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;Tao moi line
;;;Cu phap su dung (duy:t_line diemdau diemcuoi layer color ltype ltypescale)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun duy:t_line (a b la co lt slt / a b la co lt slt)
(cond ((= la "") (setq la (getvar "Clayer")) ))
(cond ((= co "") (setq co 256) ))
(cond ((= lt "") (setq lt "bylayer") ))
(cond ((= slt "") (setq slt 1) ))
(entmake (list (cons 0 "LINE")(cons 10 a)(cons 11 B)(cons 8 la)(cons 62 co)(cons 6 lt)(cons 48 slt) ))
(princ)
)
 
(defun c:btd (/ ddt dtn dth)
(command "undo" "be")
(setq dvbd (getpoint "\nChon diem viet bang: "))
(duy:t_line dvbd (list (+ (car dvbd) 30) (cadr dvbd)) "" "" "" "")
(duy:t_line (list (car dvbd) (- (cadr dvbd) 5)) (list (+ (car dvbd) 30) (- (cadr dvbd) 5)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 0) (- (cadr dvbd) 0)) (list (+ (car dvbd) 0) (- (cadr dvbd) 5)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 5) (- (cadr dvbd) 0)) (list (+ (car dvbd) 5) (- (cadr dvbd) 5)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 23) (- (cadr dvbd) 0)) (list (+ (car dvbd) 23) (- (cadr dvbd) 5)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 26.5) (- (cadr dvbd) 0)) (list (+ (car dvbd) 26.5) (- (cadr dvbd) 5)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 30) (- (cadr dvbd) 0)) (list (+ (car dvbd) 30) (- (cadr dvbd) 5)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 5) (- (cadr dvbd) 2.5)) (list (+ (car dvbd) 23) (- (cadr dvbd) 2.5)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 14) (- (cadr dvbd) 2.5)) (list (+ (car dvbd) 14) (- (cadr dvbd) 5)) "" "" "" "")
 
(duy:t_text (list (+ (car dvbd) 2.5) (- (cadr dvbd) 3)) 1 0 "giua" "§Ønh" "" "" "")
(duy:t_text (list (+ (car dvbd) 14) (- (cadr dvbd) 1.75)) 1 0 "giua" "Täa §é" "" "" "")
(duy:t_text (list (+ (car dvbd) 9.5) (- (cadr dvbd) 4.25)) 1 0 "giua" "X (m)" "" "" "")
(duy:t_text (list (+ (car dvbd) 18.5) (- (cadr dvbd) 4.25)) 1 0 "giua" "Y (m)" "" "" "")
(duy:t_text (list (+ (car dvbd) 24.75) (- (cadr dvbd) 1.75)) 1 0 "giua" "Tªn" "" "" "")
(duy:t_text (list (+ (car dvbd) 28.25) (- (cadr dvbd) 1.75)) 1 0 "giua" "C¹nh" "" "" "")
(duy:t_text (list (+ (car dvbd) 24.75) (- (cadr dvbd) 4.25)) 1 0 "giua" "C¹nh" "" "" "")
(duy:t_text (list (+ (car dvbd) 28.25) (- (cadr dvbd) 4.25)) 1 0 "giua" "(m)" "" "" "")
 
(setq dvbd (list (car dvbd) (- (cadr dvbd) 5)))
(duy:t_line (list (car dvbd) (- (cadr dvbd) 2)) (list (+ (car dvbd) 23) (- (cadr dvbd) 2)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 23) (- (cadr dvbd) 3)) (list (+ (car dvbd) 30) (- (cadr dvbd) 3)) "" "" "" "")
 
(setq ddt (getpoint "\nChon diem thu 1: "))
(setq dtn ddt)
(setq sttn 1)
(duy:t_text (list (+ (car dvbd) 2.5) (- (cadr dvbd) 1.5)) 1 0 "giua" "1" "" "" "")
(duy:t_text (list (+ (car dvbd) 9.5) (- (cadr dvbd) 1.5)) 1 0 "giua" (rtos (cadr dtn) 2 3) "" "" "")
(duy:t_text (list (+ (car dvbd) 18.5) (- (cadr dvbd) 1.5)) 1 0 "giua" (rtos (car dtn) 2 3) "" "" "")
 
(while (setq dth (getpoint dtn(strcat "\nChon diem thu " (rtos (+ sttn 1) 2 0) " <Enter de ket thuc!>")  ))
(grdraw dtn dth 7)
(duy:t_line (list (car dvbd) (- (- (cadr dvbd) (* 2 sttn)) 2)) (list (+ (car dvbd) 23) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
(duy:t_text (list (+ (car dvbd) 2.5) (- (- (cadr dvbd) (* 2 sttn)) 1.5)) 1 0 "giua" (rtos (+ sttn 1) 2 0) "" "" "")
(duy:t_text (list (+ (car dvbd) 9.5) (- (- (cadr dvbd) (* 2 sttn)) 1.5)) 1 0 "giua" (rtos (cadr dth) 2 3) "" "" "")
(duy:t_text (list (+ (car dvbd) 18.5) (- (- (cadr dvbd) (* 2 sttn)) 1.5)) 1 0 "giua" (rtos (car dth) 2 3) "" "" "")
(duy:t_text (list (+ (car dvbd) 24.8) (- (- (cadr dvbd) (* 2 sttn)) 0.5)) 1 0 "giua" (strcat (rtos sttn 2 0) "-" (rtos (+ sttn 1) 2 0)) "" "" "")
(duy:t_text (list (+ (car dvbd) 28.3) (- (- (cadr dvbd) (* 2 sttn)) 0.5)) 1 0 "giua" (rtos (distance dtn dth) 2 2) "" "" "")
(duy:t_line (list (+ (car dvbd) 23) (- (- (cadr dvbd) (* 2 sttn)) 3)) (list (+ (car dvbd) 30) (- (- (cadr dvbd) (* 2 sttn)) 3)) "" "" "" "")
 
(setq dtn dth)
(setq sttn (+ sttn 1))
)
(command ".erase" "last" "")
(duy:t_line (list (car dvbd) (- (- (cadr dvbd) (* 2 sttn)) 2)) (list (+ (car dvbd) 30) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
(duy:t_text (list (+ (car dvbd) 2.5) (- (- (cadr dvbd) (* 2 sttn)) 1.5)) 1 0 "giua" "1" "" "" "")
(duy:t_text (list (+ (car dvbd) 9.5) (- (- (cadr dvbd) (* 2 sttn)) 1.5)) 1 0 "giua" (rtos (cadr ddt) 2 3) "" "" "")
(duy:t_text (list (+ (car dvbd) 18.5) (- (- (cadr dvbd) (* 2 sttn)) 1.5)) 1 0 "giua" (rtos (car ddt) 2 3) "" "" "")
(duy:t_text (list (+ (car dvbd) 24.8) (- (- (cadr dvbd) (* 2 sttn)) 0.5)) 1 0 "giua" (strcat (rtos sttn 2 0) "-" "1") "" "" "")
(duy:t_text (list (+ (car dvbd) 28.3) (- (- (cadr dvbd) (* 2 sttn)) 0.5)) 1 0 "giua" (rtos (distance dtn ddt) 2 2) "" "" "")
 
 
(duy:t_line (list (+ (car dvbd) 0) (+ (cadr dvbd) 0)) (list (+ (car dvbd) 0) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 5) (+ (cadr dvbd) 0)) (list (+ (car dvbd) 5) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 14) (+ (cadr dvbd) 0)) (list (+ (car dvbd) 14) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 23) (+ (cadr dvbd) 0)) (list (+ (car dvbd) 23) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 26.5) (+ (cadr dvbd) 0)) (list (+ (car dvbd) 26.5) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 30) (+ (cadr dvbd) 0)) (list (+ (car dvbd) 30) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
 
 
(command "undo" "end")
(Princ)
)
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;Chuyen gia tri goc tu do sang radian
;;;Cu phap su dung (duy:s_do>radian giatri)
;;;giatri la goc tinh theo do, kq la goc tinh theo radian
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun duy:s_do>radian (gt / gt kq)
(setq kq (* (/ pi 180) gt))
kq)
 
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;Tao moi text
;;;Cu phap su dung (duy:t_text diemchen docao gocquay canhle noidung textstyle layer color)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun duy:t_text (d c g cl nd k la co / d c g cl nd k la co)
(cond
((= cl "trai") (setq kcl 0))
((= cl "phai") (setq kcl 2))
((= cl "giua") (setq kcl 1))
)
(cond ((= g "") (setq g 0) ))
(cond ((= cl "") (setq kcl 0) ))
(setq g (duy:s_do>radian g))
(cond ((= k "") (setq k (getvar "TEXTSTYLE")) ))
(cond ((= la "") (setq la (getvar "Clayer")) ))
(cond ((= co "") (setq co 256) ))
(entmake (list (cons 0 "TEXT")(cons 10 d)(cons 11 d)(cons 40 c)(cons 50 g)(cons 72 kcl)(cons 1 nd)(cons 7 k)(cons 8 la)(cons 62 co)))
(princ)
)
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;Tao moi line
;;;Cu phap su dung (duy:t_line diemdau diemcuoi layer color ltype ltypescale)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun duy:t_line (a b la co lt slt / a b la co lt slt)
(cond ((= la "") (setq la (getvar "Clayer")) ))
(cond ((= co "") (setq co 256) ))
(cond ((= lt "") (setq lt "bylayer") ))
(cond ((= slt "") (setq slt 1) ))
(entmake (list (cons 0 "LINE")(cons 10 a)(cons 11 B)(cons 8 la)(cons 62 co)(cons 6 lt)(cons 48 slt) ))
(princ)
)
 
(defun c:btd (/ ddt dtn dth)
(command "undo" "be")
(setq dvbd (getpoint "\nChon diem viet bang: "))
(duy:t_line dvbd (list (+ (car dvbd) 30) (cadr dvbd)) "" "" "" "")
(duy:t_line (list (car dvbd) (- (cadr dvbd) 5)) (list (+ (car dvbd) 30) (- (cadr dvbd) 5)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 0) (- (cadr dvbd) 0)) (list (+ (car dvbd) 0) (- (cadr dvbd) 5)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 5) (- (cadr dvbd) 0)) (list (+ (car dvbd) 5) (- (cadr dvbd) 5)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 23) (- (cadr dvbd) 0)) (list (+ (car dvbd) 23) (- (cadr dvbd) 5)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 26.5) (- (cadr dvbd) 0)) (list (+ (car dvbd) 26.5) (- (cadr dvbd) 5)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 30) (- (cadr dvbd) 0)) (list (+ (car dvbd) 30) (- (cadr dvbd) 5)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 5) (- (cadr dvbd) 2.5)) (list (+ (car dvbd) 23) (- (cadr dvbd) 2.5)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 14) (- (cadr dvbd) 2.5)) (list (+ (car dvbd) 14) (- (cadr dvbd) 5)) "" "" "" "")
 
(duy:t_text (list (+ (car dvbd) 2.5) (- (cadr dvbd) 3)) 1 0 "giua" "§Ønh" "" "" "")
(duy:t_text (list (+ (car dvbd) 14) (- (cadr dvbd) 1.75)) 1 0 "giua" "Täa §é" "" "" "")
(duy:t_text (list (+ (car dvbd) 9.5) (- (cadr dvbd) 4.25)) 1 0 "giua" "X (m)" "" "" "")
(duy:t_text (list (+ (car dvbd) 18.5) (- (cadr dvbd) 4.25)) 1 0 "giua" "Y (m)" "" "" "")
(duy:t_text (list (+ (car dvbd) 24.75) (- (cadr dvbd) 1.75)) 1 0 "giua" "Tªn" "" "" "")
(duy:t_text (list (+ (car dvbd) 28.25) (- (cadr dvbd) 1.75)) 1 0 "giua" "C¹nh" "" "" "")
(duy:t_text (list (+ (car dvbd) 24.75) (- (cadr dvbd) 4.25)) 1 0 "giua" "C¹nh" "" "" "")
(duy:t_text (list (+ (car dvbd) 28.25) (- (cadr dvbd) 4.25)) 1 0 "giua" "(m)" "" "" "")
 
(setq dvbd (list (car dvbd) (- (cadr dvbd) 5)))
(duy:t_line (list (car dvbd) (- (cadr dvbd) 2)) (list (+ (car dvbd) 23) (- (cadr dvbd) 2)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 23) (- (cadr dvbd) 3)) (list (+ (car dvbd) 30) (- (cadr dvbd) 3)) "" "" "" "")
 
(setq ddt (getpoint "\nChon diem thu 1: "))
(setq dtn ddt)
(setq sttn 1)
(duy:t_text (list (+ (car dvbd) 2.5) (- (cadr dvbd) 1.5)) 1 0 "giua" "1" "" "" "")
(duy:t_text (list (+ (car dvbd) 9.5) (- (cadr dvbd) 1.5)) 1 0 "giua" (rtos (cadr dtn) 2 3) "" "" "")
(duy:t_text (list (+ (car dvbd) 18.5) (- (cadr dvbd) 1.5)) 1 0 "giua" (rtos (car dtn) 2 3) "" "" "")
 
(while (setq dth (getpoint dtn(strcat "\nChon diem thu " (rtos (+ sttn 1) 2 0) " <Enter de ket thuc!>")  ))
(grdraw dtn dth 7)
(duy:t_line (list (car dvbd) (- (- (cadr dvbd) (* 2 sttn)) 2)) (list (+ (car dvbd) 23) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
(duy:t_text (list (+ (car dvbd) 2.5) (- (- (cadr dvbd) (* 2 sttn)) 1.5)) 1 0 "giua" (rtos (+ sttn 1) 2 0) "" "" "")
(duy:t_text (list (+ (car dvbd) 9.5) (- (- (cadr dvbd) (* 2 sttn)) 1.5)) 1 0 "giua" (rtos (cadr dth) 2 3) "" "" "")
(duy:t_text (list (+ (car dvbd) 18.5) (- (- (cadr dvbd) (* 2 sttn)) 1.5)) 1 0 "giua" (rtos (car dth) 2 3) "" "" "")
(duy:t_text (list (+ (car dvbd) 24.8) (- (- (cadr dvbd) (* 2 sttn)) 0.5)) 1 0 "giua" (strcat (rtos sttn 2 0) "-" (rtos (+ sttn 1) 2 0)) "" "" "")
(duy:t_text (list (+ (car dvbd) 28.3) (- (- (cadr dvbd) (* 2 sttn)) 0.5)) 1 0 "giua" (rtos (distance dtn dth) 2 2) "" "" "")
(duy:t_line (list (+ (car dvbd) 23) (- (- (cadr dvbd) (* 2 sttn)) 3)) (list (+ (car dvbd) 30) (- (- (cadr dvbd) (* 2 sttn)) 3)) "" "" "" "")
 
(setq dtn dth)
(setq sttn (+ sttn 1))
)
(command ".erase" "last" "")
(duy:t_line (list (car dvbd) (- (- (cadr dvbd) (* 2 sttn)) 2)) (list (+ (car dvbd) 30) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
(duy:t_text (list (+ (car dvbd) 2.5) (- (- (cadr dvbd) (* 2 sttn)) 1.5)) 1 0 "giua" "1" "" "" "")
(duy:t_text (list (+ (car dvbd) 9.5) (- (- (cadr dvbd) (* 2 sttn)) 1.5)) 1 0 "giua" (rtos (cadr ddt) 2 3) "" "" "")
(duy:t_text (list (+ (car dvbd) 18.5) (- (- (cadr dvbd) (* 2 sttn)) 1.5)) 1 0 "giua" (rtos (car ddt) 2 3) "" "" "")
(duy:t_text (list (+ (car dvbd) 24.8) (- (- (cadr dvbd) (* 2 sttn)) 0.5)) 1 0 "giua" (strcat (rtos sttn 2 0) "-" "1") "" "" "")
(duy:t_text (list (+ (car dvbd) 28.3) (- (- (cadr dvbd) (* 2 sttn)) 0.5)) 1 0 "giua" (rtos (distance dtn ddt) 2 2) "" "" "")
 
 
(duy:t_line (list (+ (car dvbd) 0) (+ (cadr dvbd) 0)) (list (+ (car dvbd) 0) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 5) (+ (cadr dvbd) 0)) (list (+ (car dvbd) 5) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 14) (+ (cadr dvbd) 0)) (list (+ (car dvbd) 14) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 23) (+ (cadr dvbd) 0)) (list (+ (car dvbd) 23) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 26.5) (+ (cadr dvbd) 0)) (list (+ (car dvbd) 26.5) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
(duy:t_line (list (+ (car dvbd) 30) (+ (cadr dvbd) 0)) (list (+ (car dvbd) 30) (- (- (cadr dvbd) (* 2 sttn)) 2)) "" "" "" "")
 
 
(command "undo" "end")
(Princ)
)

  • 0

#2 thanhbdhl

thanhbdhl

    Edu level: li3

  • Members
  • PipPip
  • 22 Bài viết
Điểm đánh giá: -1 (bình thường)

Đã gửi 04 March 2014 - 02:04 PM

Hu hu không ai giúp e vơi ạ

 


  • 0