Chuyển đến nội dung
Diễn đàn CADViet
Đăng nhập để thực hiện theo  
thanhbdhl

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

Các bài được khuyến nghị

 

 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)
)

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác

Tạo một tài khoản hoặc đăng nhập để nhận xét

Bạn cần phải là một thành viên để lại một bình luận

Tạo tài khoản

Đăng ký một tài khoản mới trong cộng đồng của chúng tôi. Điều đó dễ mà.

Đăng ký tài khoản mới

Đăng nhập

Bạn có sẵn sàng để tạo một tài khoản ? Đăng nhập tại đây.

Đăng nhập ngay

Đăng nhập để thực hiện theo  

×