Đến nội dung


Hình ảnh
- - - - -

vướng mắc autolisp tìm lời giải đáp


  • Please log in to reply
24 replies to this topic

#21 lp_hai

lp_hai

    biết lệnh measure

  • Members
  • PipPipPipPipPipPip
  • 456 Bài viết
Điểm đánh giá: 202 (khá)

Đã gửi 13 August 2010 - 12:38 PM

Các bác ơi. Em muốn dùng lisp sau cho Bv2 thì làm thế nào, BV1 e dùng thì OK
http://www.cadviet.c...les/3/bv1_1.dwg
http://www.cadviet.c...les/3/bv2_1.dwg
http://www.cadviet.c...iles/3/nscd.rar
Mong các bác giúp đỡ

đường dẫn thứ 3 là j vậy bạn. lisp hả. mình tải ko dc. "Em muốn dùng lisp sau cho Bv2 thì làm thế nào, BV1 e dùng thì OK" ý bạn là sao??
bạn hỏi về cách sữ dụng lisp đó cho bv2 hay là cái lisp đó ở bv2 nó ko hiểu.
nếu như trường hợp thứ nhất bạn nên nêu rõ hơn yêu cầu của mình: như mục đích của lisp đó để làm gì?...
  • 0
Hình đã gửi

#22 anhbr

anhbr

    biết pan

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

Đã gửi 13 August 2010 - 12:51 PM

Có bác nào xem giúp em chưa? huhu? chỉ e với

Bạn xem lại link xem sao, sao down k đc kìa
  • 0

#23 ndq111

ndq111

    biết pan

  • Members
  • Pip
  • 5 Bài viết
Điểm đánh giá: 0 (bình thường)

Đã gửi 18 August 2010 - 08:58 AM

Link th­ứ 3 là lisp e muốn dùng nó cho BV2, BV1 thì e dùng được, nhưng BV1 dùng được nhưng k cho kq đúng
  • 0

#24 ndq111

ndq111

    biết pan

  • Members
  • Pip
  • 5 Bài viết
Điểm đánh giá: 0 (bình thường)

Đã gửi 18 August 2010 - 09:01 AM

;TINH CAO DO NHAP KHOANG CACH VA VIET VAO DIEM CHON
(defun c:tinh ()
(setvar "osmode" 33)
(initget 3)
(setq pt1 (getpoint "\nChon diem co cao do: " ))
(setq pt2 (getpoint "\nChon diem chon diem tim cao do: " pt1))
(setq pt3 (getpoint "\nChon diem viet k/c 2 diem: " ))
(setq pt6 (getpoint "\nChon diem viet cao do diem: " ))
(initget 0)
(setq pt4 (getreal "\nVao so cao do diem truoc:" ))
(setq dau1 (car pt1))
(setq cuoi1 (cadr pt1))
(setq dau2 (car pt2))
(setq cuoi2 (cadr pt2))
(setq l (abs (- dau1 dau2)))
(if ( > l ntl )
(command "text" "J" "M" pt3 height "0" (rtos (/ l ntl) 2 tphan))
(command "text" "J" "M" pt3 height "90" (rtos (/ l ntl) 2 tphan))
)
(command "text" "J" "M" pt6 height "90" (rtos (+ pt4 (/ (- cuoi2 cuoi1) ntl)) 2 tphan))
(setvar "osmode" luu)
(setq pt4 nil)
) ;het timcaodo

(defun c:nscd ()
(setq luu (getvar "osmode"))
(setq luublipmode (getvar "blipmode"))
(setvar "osmode" 33)
(setvar "blipmode" 0)
(initget 3)
(setq pt1 (getpoint "\nBam vao diem da biet cao do: " ))
(setq pt2 (getpoint "\nBam vao diem can tim cao do: " pt1))
(setvar "blipmode" 0)
(while (null (setq chon (entsel "\nChon so cao do diem truoc:"))))
(setq dt (entget (car chon)))
(setq loai (cdr (assoc 0 dt)))
(if (= loai "TEXT")
(progn
(setq gtri (cdr (assoc 1 dt)))
(if (null gtri) (princ "\nBan chon khong dung so")
(progn
(setq pt3 (atof gtri))
(setq pt4 (rtos (+ pt3 (/ (- (cadr pt2) (cadr pt1)) )) 2 tphan))
(setq pt5 (entsel "\nChon so ghi can sua so cao do diem noi suy:"))
(initget 0)
(if (null pt5)
(progn
(setq pt6 (getpoint "\nChon diem de the ghi cao do diem noi suy: " ))
(command "text" "J" "M" pt6 height "90" pt4)
)
(progn
(command ".change" pt5 "" "" "" "" (cdr (assoc 40 dt)) "" pt4)
(command ".change" pt5 "" "P" "C" "7" "")
)
)
)
)
)
(princ "\nBan chon nham khong phai la chu so.")
)
(princ "\n")
(setvar "osmode" luu)
(setvar "blipmode" luublipmode)
(setq chon nil gtri nil dt nil loai nil pt1 nil pt2 nil pt3 nil pt4 nil pt5 nil pt6 nil)
)

(defun c:copyso ()
(c:setupdesign)
(setq luu (getvar "osmode"))
(setq luublipmode (getvar "blipmode"))
(setvar "osmode" 33)
(setvar "blipmode" 1)
(initget 3)
(setvar "blipmode" 0)
(while (null (setq chon (entsel "\nChon so tren ban ve:"))))
(setq dt (entget (car chon)))
(setq loai (cdr (assoc 0 dt)))
(if (= loai "TEXT")
(progn
(setq gtri (cdr (assoc 1 dt)))
(if (null gtri) (princ "\nBan chon khong dung so")
(progn
(setq pt3 (atof gtri))
(setq pt5 (entsel "\nChon so ghi can sua so vua tinh:"))
(initget 0)
(if (null pt5)
(progn
(setq pt6 (getpoint "\nChon diem de the ghi so vua tinh: " ))
(command "text" "J" "M" pt6 height "90" (rtos pt3 2 tphan))
)
(progn
(command ".change" pt5 "" "" "" "" "" "" (rtos pt3 2 tphan))
(command ".change" pt5 "" "P" "C" "2" "")
)
)
)
)
)
(princ "\nBan chon nham khong phai la chu so.")
)
(princ "\n")
(setvar "osmode" luu)
(setvar "blipmode" luublipmode)
(setq chon nil gtri nil dt nil loai nil pt3 nil pt4 nil pt5 nil pt6 nil)
)

(defun c:sa ()

(setq luu (getvar "osmode"))
(setq luublipmode (getvar "blipmode"))
(setvar "osmode" 33)
(setvar "blipmode" 1)
(initget 3)
(setvar "blipmode" 0)
(while (null (setq chon (entsel "\nChon so tren ban ve:"))))
(setq dt (entget (car chon)))
(setq loai (cdr (assoc 0 dt)))
(if (= loai "TEXT")
(progn
(setq gtri (cdr (assoc 1 dt)))
(if (null gtri) (princ "\nBan chon khong dung so")
(progn
(setq pt3 (atof gtri))
(while (setq chon1 (entsel "\nChon so cong tren ban ve :"))
(setq pt4 (atof (cdr (assoc 1 (entget (car chon1))))))
(setq pt7 (+ pt3 (/ pt4 100)))
)
(setq pt5 (entsel "\nChon so ghi can sua so vua tinh:"))
(initget 0)
(if (null pt5)
(progn
(setq pt6 (getpoint "\nChon diem de the ghi so vua tinh: " ))
(command "text" "J" "M" pt6 height "90" (rtos pt7 2 tphan))
)
(progn
(command ".change" pt5 "" "" "" "" "" (rtos pt7 2 tphan))
(command ".change" pt5 "" "P" "C" "2" "")
)
)
)
)
)
(princ "\nBan chon nham khong phai la chu so.")
)
(princ "\n")
(setvar "osmode" luu)
(setvar "blipmode" luublipmode)
(setq chon nil gtri nil dt nil loai nil pt3 nil pt4 nil pt5 nil pt6 nil)
)

(defun c:truso ()

(setq luu (getvar "osmode"))
(setq luublipmode (getvar "blipmode"))
(setvar "osmode" 33)
(setvar "blipmode" 1)
(initget 3)
(setvar "blipmode" 0)
(while (null (setq chon (entsel "\nChon so tren ban ve:"))))
(setq dt (entget (car chon)))
(setq loai (cdr (assoc 0 dt)))
(if (= loai "TEXT")
(progn
(setq gtri (cdr (assoc 1 dt)))
(if (null gtri) (princ "\nBan chon khong dung so")
(progn
(setq pt3 (atof gtri))
(while (setq chon1 (entsel "\nChon so de tru tren ban ve :"))
(setq pt4 (atof (cdr (assoc 1 (entget (car chon1))))))
(setq pt3 (- pt3 pt4))
)
(setq pt5 (entsel "\nChon so ghi can sua so vua tinh:"))
(initget 0)
(if (null pt5)
(progn
(setq pt6 (getpoint "\nChon diem de the ghi so vua tinh: " ))
(command "text" "J" "M" pt6 height "90" (rtos pt3 2 tphan))
)
(progn
(command ".change" pt5 "" "" "" "" (cdr (assoc 40 dt)) "" (rtos pt3 2 tphan))
(command ".change" pt5 "" "P" "C" "2" "")
)
)
)
)
)
(princ "\nBan chon nham khong phai la chu so.")
)
(princ "\n")
(setvar "osmode" luu)
(setvar "blipmode" luublipmode)
(setq chon nil gtri nil dt nil loai nil pt3 nil pt4 nil pt5 nil pt6 nil)
)

(defun c:nhanso ()
(c:setupdesign)
(setq luu (getvar "osmode"))
(setq luublipmode (getvar "blipmode"))
(setvar "osmode" 33)
(setvar "blipmode" 1)
(initget 3)
(setvar "blipmode" 0)
(while (null (setq chon (entsel "\nChon so tren ban ve:"))))
(setq dt (entget (car chon)))
(setq loai (cdr (assoc 0 dt)))
(if (= loai "TEXT")
(progn
(setq gtri (cdr (assoc 1 dt)))
(if (null gtri) (princ "\nBan chon khong dung so")
(progn
(setq pt3 (atof gtri))
(while (setq chon1 (entsel "\nChon so de nhan tren ban ve :"))
(setq pt4 (atof (cdr (assoc 1 (entget (car chon1))))))
(setq pt3 (* pt3 pt4))
)
(setq pt5 (entsel "\nChon so ghi can sua so cao do diem noi suy:"))
(initget 0)
(if (null pt5)
(progn
(setq pt6 (getpoint "\nChon diem de the ghi tich so vua nhan: " ))
(command "text" "J" "M" pt6 height "90" (rtos pt3 2 tphan))
)
(progn
(command ".change" pt5 "" "" "" "" (cdr (assoc 40 dt)) "" (rtos pt3 2 tphan))
(command ".change" pt5 "" "P" "C" "2" "")
)
)
)
)
)
(princ "\nBan chon nham khong phai la chu so.")
)
(princ "\n")
(setvar "osmode" luu)
(setvar "blipmode" luublipmode)
(setq chon nil gtri nil dt nil loai nil pt3 nil pt4 nil pt5 nil pt6 nil)
)

(defun c:chiaso ()
(c:setupdesign)
(setq luu (getvar "osmode"))
(setq luublipmode (getvar "blipmode"))
(setvar "osmode" 33)
(setvar "blipmode" 1)
(initget 3)
(setvar "blipmode" 0)
(while (null (setq chon (entsel "\nChon so tren ban ve de chia:"))))
(setq dt (entget (car chon)))
(setq loai (cdr (assoc 0 dt)))
(if (= loai "TEXT")
(progn
(setq gtri (cdr (assoc 1 dt)))
(if (null gtri) (princ "\nBan chon khong dung so")
(progn
(setq pt3 (atof gtri))
(while (setq chon1 (entsel "\nBam vao mau so de chia tren ban ve :"))
(setq pt4 (atof (cdr (assoc 1 (entget (car chon1))))))
(setq pt3 (/ pt3 pt4))
)
(setq pt5 (entsel "\nChon so ghi can sua so vua chia:"))
(initget 0)
(if (null pt5)
(progn
(setq pt6 (getpoint "\nChon diem de ghi so moi chia: " ))
(command "text" "J" "M" pt6 height "90" (rtos pt3 2 tphan))
)
(progn
(command ".change" pt5 "" "" "" "" (cdr (assoc 40 dt)) "" (rtos pt3 2 tphan))
(command ".change" pt5 "" "P" "C" "2" "")
)
)
)
)
)
(princ "\nBan chon nham khong phai la chu so.")
)
(princ "\n")
(setvar "osmode" luu)
(setvar "blipmode" luublipmode)
(setq chon nil gtri nil dt nil loai nil pt3 nil pt4 nil pt5 nil pt6 nil)
)

(defun c:phantram ()
(c:setupdesign)
(setq luu (getvar "osmode"))
(setq luublipmode (getvar "blipmode"))
(setvar "osmode" 33)
(setvar "blipmode" 1)
(initget 3)
(setvar "blipmode" 0)
(while (null (setq chon (entsel "\nChon so ghi tu so tren ban ve de chia:"))))
(setq dt (entget (car chon)))
(setq loai (cdr (assoc 0 dt)))
(if (= loai "TEXT")
(progn
(setq gtri (cdr (assoc 1 dt)))
(if (null gtri) (princ "\nBan chon khong dung so")
(progn
(setq pt3 (atof gtri))
(while (setq chon1 (entsel "\nBam vao mau so de chia tren ban ve :"))
(setq pt4 (atof (cdr (assoc 1 (entget (car chon1))))))
(setq pt3 (/ pt3 pt4))
)
(setq ptram (strcat (rtos (* pt3 100) 2 tphan) " %"))
(setq pt5 (entsel "\nChon so ghi can sua so vua tinh:"))
(initget 0)
(if (null pt5)
(progn
(setq pt6 (getpoint "\nChon diem de ghi so moi chia: " ))
(command "text" "J" "M" pt6 height "90" ptram)
)
(progn
(command ".change" pt5 "" "" "" "" (cdr (assoc 40 dt)) "" ptram)
(command ".change" pt5 "" "P" "C" "2" "")
)
)
)
)
)
(princ "\nBan chon nham khong phai la chu so.")
)
(princ "\n")
(setvar "osmode" luu)
(setvar "blipmode" luublipmode)
(setq chon nil gtri nil dt nil loai nil pt3 nil pt4 nil pt5 nil pt6 nil)
)

(defun c:tangheso ()
(c:setupdesign)
(setq luu (getvar "osmode"))
(setq luublipmode (getvar "blipmode"))
(setvar "osmode" 33)
(setvar "blipmode" 1)
(initget 3)
(setvar "blipmode" 0)
(while (null (setq chon (entsel "\nChon so ghi tu so tren ban ve de tang:"))))
(setq dt (entget (car chon)))
(setq loai (cdr (assoc 0 dt)))
(if (= loai "TEXT")
(progn
(setq gtri (cdr (assoc 1 dt)))
(if (null gtri) (princ "\nBan chon khong dung so")
(progn
(setq pt3 (atof gtri))
(setq ptram (strcat " " (rtos (* pt3 heso) 2 tphan)))
(command ".change" chon "" "" "" "" (cdr (assoc 40 dt)) "" ptram)
(command ".change" chon "" "P" "C" "2" "")
)
)
)
(princ "\nBan chon nham khong phai la chu so.")
)
(princ "\n")
(setvar "osmode" luu)
(setvar "blipmode" luublipmode)
(setq chon nil gtri nil dt nil loai nil pt3 nil pt4 nil pt5 nil pt6 nil)
)
  • 0

#25 ndq111

ndq111

    biết pan

  • Members
  • Pip
  • 5 Bài viết
Điểm đánh giá: 0 (bình thường)

Đã gửi 23 August 2010 - 02:00 PM

;TINH CAO DO NHAP KHOANG CACH VA VIET VAO DIEM CHON
(defun c:tinh ()
(setvar "osmode" 33)
(initget 3)
(setq pt1 (getpoint "\nChon diem co cao do: " ))
(setq pt2 (getpoint "\nChon diem chon diem tim cao do: " pt1))
(setq pt3 (getpoint "\nChon diem viet k/c 2 diem: " ))
(setq pt6 (getpoint "\nChon diem viet cao do diem: " ))
(initget 0)
(setq pt4 (getreal "\nVao so cao do diem truoc:" ))
(setq dau1 (car pt1))
(setq cuoi1 (cadr pt1))
(setq dau2 (car pt2))
(setq cuoi2 (cadr pt2))
(setq l (abs (- dau1 dau2)))
(if ( > l ntl )
(command "text" "J" "M" pt3 height "0" (rtos (/ l ntl) 2 tphan))
(command "text" "J" "M" pt3 height "90" (rtos (/ l ntl) 2 tphan))
)
(command "text" "J" "M" pt6 height "90" (rtos (+ pt4 (/ (- cuoi2 cuoi1) ntl)) 2 tphan))
(setvar "osmode" luu)
(setq pt4 nil)
) ;het timcaodo

(defun c:nscd ()
(setq luu (getvar "osmode"))
(setq luublipmode (getvar "blipmode"))
(setvar "osmode" 33)
(setvar "blipmode" 0)
(initget 3)
(setq pt1 (getpoint "\nBam vao diem da biet cao do: " ))
(setq pt2 (getpoint "\nBam vao diem can tim cao do: " pt1))
(setvar "blipmode" 0)
(while (null (setq chon (entsel "\nChon so cao do diem truoc:"))))
(setq dt (entget (car chon)))
(setq loai (cdr (assoc 0 dt)))
(if (= loai "TEXT")
(progn
(setq gtri (cdr (assoc 1 dt)))
(if (null gtri) (princ "\nBan chon khong dung so")
(progn
(setq pt3 (atof gtri))
(setq pt4 (rtos (+ pt3 (/ (- (cadr pt2) (cadr pt1)) )) 2 tphan))
(setq pt5 (entsel "\nChon so ghi can sua so cao do diem noi suy:"))
(initget 0)
(if (null pt5)
(progn
(setq pt6 (getpoint "\nChon diem de the ghi cao do diem noi suy: " ))
(command "text" "J" "M" pt6 height "90" pt4)
)
(progn
(command ".change" pt5 "" "" "" "" (cdr (assoc 40 dt)) "" pt4)
(command ".change" pt5 "" "P" "C" "7" "")
)
)
)
)
)
(princ "\nBan chon nham khong phai la chu so.")
)
(princ "\n")
(setvar "osmode" luu)
(setvar "blipmode" luublipmode)
(setq chon nil gtri nil dt nil loai nil pt1 nil pt2 nil pt3 nil pt4 nil pt5 nil pt6 nil)
)

(defun c:copyso ()
(c:setupdesign)
(setq luu (getvar "osmode"))
(setq luublipmode (getvar "blipmode"))
(setvar "osmode" 33)
(setvar "blipmode" 1)
(initget 3)
(setvar "blipmode" 0)
(while (null (setq chon (entsel "\nChon so tren ban ve:"))))
(setq dt (entget (car chon)))
(setq loai (cdr (assoc 0 dt)))
(if (= loai "TEXT")
(progn
(setq gtri (cdr (assoc 1 dt)))
(if (null gtri) (princ "\nBan chon khong dung so")
(progn
(setq pt3 (atof gtri))
(setq pt5 (entsel "\nChon so ghi can sua so vua tinh:"))
(initget 0)
(if (null pt5)
(progn
(setq pt6 (getpoint "\nChon diem de the ghi so vua tinh: " ))
(command "text" "J" "M" pt6 height "90" (rtos pt3 2 tphan))
)
(progn
(command ".change" pt5 "" "" "" "" "" "" (rtos pt3 2 tphan))
(command ".change" pt5 "" "P" "C" "2" "")
)
)
)
)
)
(princ "\nBan chon nham khong phai la chu so.")
)
(princ "\n")
(setvar "osmode" luu)
(setvar "blipmode" luublipmode)
(setq chon nil gtri nil dt nil loai nil pt3 nil pt4 nil pt5 nil pt6 nil)
)

(defun c:sa ()

(setq luu (getvar "osmode"))
(setq luublipmode (getvar "blipmode"))
(setvar "osmode" 33)
(setvar "blipmode" 1)
(initget 3)
(setvar "blipmode" 0)
(while (null (setq chon (entsel "\nChon so tren ban ve:"))))
(setq dt (entget (car chon)))
(setq loai (cdr (assoc 0 dt)))
(if (= loai "TEXT")
(progn
(setq gtri (cdr (assoc 1 dt)))
(if (null gtri) (princ "\nBan chon khong dung so")
(progn
(setq pt3 (atof gtri))
(while (setq chon1 (entsel "\nChon so cong tren ban ve :"))
(setq pt4 (atof (cdr (assoc 1 (entget (car chon1))))))
(setq pt7 (+ pt3 (/ pt4 100)))
)
(setq pt5 (entsel "\nChon so ghi can sua so vua tinh:"))
(initget 0)
(if (null pt5)
(progn
(setq pt6 (getpoint "\nChon diem de the ghi so vua tinh: " ))
(command "text" "J" "M" pt6 height "90" (rtos pt7 2 tphan))
)
(progn
(command ".change" pt5 "" "" "" "" "" (rtos pt7 2 tphan))
(command ".change" pt5 "" "P" "C" "2" "")
)
)
)
)
)
(princ "\nBan chon nham khong phai la chu so.")
)
(princ "\n")
(setvar "osmode" luu)
(setvar "blipmode" luublipmode)
(setq chon nil gtri nil dt nil loai nil pt3 nil pt4 nil pt5 nil pt6 nil)
)

(defun c:truso ()

(setq luu (getvar "osmode"))
(setq luublipmode (getvar "blipmode"))
(setvar "osmode" 33)
(setvar "blipmode" 1)
(initget 3)
(setvar "blipmode" 0)
(while (null (setq chon (entsel "\nChon so tren ban ve:"))))
(setq dt (entget (car chon)))
(setq loai (cdr (assoc 0 dt)))
(if (= loai "TEXT")
(progn
(setq gtri (cdr (assoc 1 dt)))
(if (null gtri) (princ "\nBan chon khong dung so")
(progn
(setq pt3 (atof gtri))
(while (setq chon1 (entsel "\nChon so de tru tren ban ve :"))
(setq pt4 (atof (cdr (assoc 1 (entget (car chon1))))))
(setq pt3 (- pt3 pt4))
)
(setq pt5 (entsel "\nChon so ghi can sua so vua tinh:"))
(initget 0)
(if (null pt5)
(progn
(setq pt6 (getpoint "\nChon diem de the ghi so vua tinh: " ))
(command "text" "J" "M" pt6 height "90" (rtos pt3 2 tphan))
)
(progn
(command ".change" pt5 "" "" "" "" (cdr (assoc 40 dt)) "" (rtos pt3 2 tphan))
(command ".change" pt5 "" "P" "C" "2" "")
)
)
)
)
)
(princ "\nBan chon nham khong phai la chu so.")
)
(princ "\n")
(setvar "osmode" luu)
(setvar "blipmode" luublipmode)
(setq chon nil gtri nil dt nil loai nil pt3 nil pt4 nil pt5 nil pt6 nil)
)

(defun c:nhanso ()
(c:setupdesign)
(setq luu (getvar "osmode"))
(setq luublipmode (getvar "blipmode"))
(setvar "osmode" 33)
(setvar "blipmode" 1)
(initget 3)
(setvar "blipmode" 0)
(while (null (setq chon (entsel "\nChon so tren ban ve:"))))
(setq dt (entget (car chon)))
(setq loai (cdr (assoc 0 dt)))
(if (= loai "TEXT")
(progn
(setq gtri (cdr (assoc 1 dt)))
(if (null gtri) (princ "\nBan chon khong dung so")
(progn
(setq pt3 (atof gtri))
(while (setq chon1 (entsel "\nChon so de nhan tren ban ve :"))
(setq pt4 (atof (cdr (assoc 1 (entget (car chon1))))))
(setq pt3 (* pt3 pt4))
)
(setq pt5 (entsel "\nChon so ghi can sua so cao do diem noi suy:"))
(initget 0)
(if (null pt5)
(progn
(setq pt6 (getpoint "\nChon diem de the ghi tich so vua nhan: " ))
(command "text" "J" "M" pt6 height "90" (rtos pt3 2 tphan))
)
(progn
(command ".change" pt5 "" "" "" "" (cdr (assoc 40 dt)) "" (rtos pt3 2 tphan))
(command ".change" pt5 "" "P" "C" "2" "")
)
)
)
)
)
(princ "\nBan chon nham khong phai la chu so.")
)
(princ "\n")
(setvar "osmode" luu)
(setvar "blipmode" luublipmode)
(setq chon nil gtri nil dt nil loai nil pt3 nil pt4 nil pt5 nil pt6 nil)
)

(defun c:chiaso ()
(c:setupdesign)
(setq luu (getvar "osmode"))
(setq luublipmode (getvar "blipmode"))
(setvar "osmode" 33)
(setvar "blipmode" 1)
(initget 3)
(setvar "blipmode" 0)
(while (null (setq chon (entsel "\nChon so tren ban ve de chia:"))))
(setq dt (entget (car chon)))
(setq loai (cdr (assoc 0 dt)))
(if (= loai "TEXT")
(progn
(setq gtri (cdr (assoc 1 dt)))
(if (null gtri) (princ "\nBan chon khong dung so")
(progn
(setq pt3 (atof gtri))
(while (setq chon1 (entsel "\nBam vao mau so de chia tren ban ve :"))
(setq pt4 (atof (cdr (assoc 1 (entget (car chon1))))))
(setq pt3 (/ pt3 pt4))
)
(setq pt5 (entsel "\nChon so ghi can sua so vua chia:"))
(initget 0)
(if (null pt5)
(progn
(setq pt6 (getpoint "\nChon diem de ghi so moi chia: " ))
(command "text" "J" "M" pt6 height "90" (rtos pt3 2 tphan))
)
(progn
(command ".change" pt5 "" "" "" "" (cdr (assoc 40 dt)) "" (rtos pt3 2 tphan))
(command ".change" pt5 "" "P" "C" "2" "")
)
)
)
)
)
(princ "\nBan chon nham khong phai la chu so.")
)
(princ "\n")
(setvar "osmode" luu)
(setvar "blipmode" luublipmode)
(setq chon nil gtri nil dt nil loai nil pt3 nil pt4 nil pt5 nil pt6 nil)
)

(defun c:phantram ()
(c:setupdesign)
(setq luu (getvar "osmode"))
(setq luublipmode (getvar "blipmode"))
(setvar "osmode" 33)
(setvar "blipmode" 1)
(initget 3)
(setvar "blipmode" 0)
(while (null (setq chon (entsel "\nChon so ghi tu so tren ban ve de chia:"))))
(setq dt (entget (car chon)))
(setq loai (cdr (assoc 0 dt)))
(if (= loai "TEXT")
(progn
(setq gtri (cdr (assoc 1 dt)))
(if (null gtri) (princ "\nBan chon khong dung so")
(progn
(setq pt3 (atof gtri))
(while (setq chon1 (entsel "\nBam vao mau so de chia tren ban ve :"))
(setq pt4 (atof (cdr (assoc 1 (entget (car chon1))))))
(setq pt3 (/ pt3 pt4))
)
(setq ptram (strcat (rtos (* pt3 100) 2 tphan) " %"))
(setq pt5 (entsel "\nChon so ghi can sua so vua tinh:"))
(initget 0)
(if (null pt5)
(progn
(setq pt6 (getpoint "\nChon diem de ghi so moi chia: " ))
(command "text" "J" "M" pt6 height "90" ptram)
)
(progn
(command ".change" pt5 "" "" "" "" (cdr (assoc 40 dt)) "" ptram)
(command ".change" pt5 "" "P" "C" "2" "")
)
)
)
)
)
(princ "\nBan chon nham khong phai la chu so.")
)
(princ "\n")
(setvar "osmode" luu)
(setvar "blipmode" luublipmode)
(setq chon nil gtri nil dt nil loai nil pt3 nil pt4 nil pt5 nil pt6 nil)
)

(defun c:tangheso ()
(c:setupdesign)
(setq luu (getvar "osmode"))
(setq luublipmode (getvar "blipmode"))
(setvar "osmode" 33)
(setvar "blipmode" 1)
(initget 3)
(setvar "blipmode" 0)
(while (null (setq chon (entsel "\nChon so ghi tu so tren ban ve de tang:"))))
(setq dt (entget (car chon)))
(setq loai (cdr (assoc 0 dt)))
(if (= loai "TEXT")
(progn
(setq gtri (cdr (assoc 1 dt)))
(if (null gtri) (princ "\nBan chon khong dung so")
(progn
(setq pt3 (atof gtri))
(setq ptram (strcat " " (rtos (* pt3 heso) 2 tphan)))
(command ".change" chon "" "" "" "" (cdr (assoc 40 dt)) "" ptram)
(command ".change" chon "" "P" "C" "2" "")
)
)
)
(princ "\nBan chon nham khong phai la chu so.")
)
(princ "\n")
(setvar "osmode" luu)
(setvar "blipmode" luublipmode)
(setq chon nil gtri nil dt nil loai nil pt3 nil pt4 nil pt5 nil pt6 nil)
)

Trên đây là toàn bộ lisp. Bác nào tìm hiểu chỉ giúp em cách dùng lisp này cái, có bv dùng được, có bản dùng không được
  • 0