Jump to content

Lisp lệnh TK trong chủ đề “Nhờ sửa lsp thống kê thép có thêm đoạn nối chồng”

đây là bộ lsp thông kê mình vẫn hay dùng nếu bạn thích thi đây bạn có thể load về sài. Lệnh thống kê là TK nhé. mỗi tội cái thống kê của mình hok có tổng hợp khối lượng cho từng loại thép và đai cột tròn thôi. nếu thích thì bạn có thể thêm vào nhé.

;=CHUONG TRINH THONG KE COT THEP CAU KIEN
;;;Chuong trinh bat loi
(defun loitk (s)                    ; If an error (such as CTRL-C) occurs
                                      ; while this command is active...
  (cond
    ((= s "quit / exit abort") (princ))
    ((/= s "Function cancelled") (princ (strcat "\nError: " s)))
  )
(SETVAR "CMDECHO" CMD)
(SETVAR "LIMCHECK" LIM)
(SETVAR "TEXTSIZE" TS)
(SETVAR "PLINEWID" PLW)
(SETVAR "OSMODE" OSM)
(SETQ *error* OLDERR)
(princ)
)
;;;CHUONG TRINH CON NHAP DU LIEU
(princ "\nThong ke cot thep H3.0 ");
(defun gpuser()
(princ "\nTHONG KE COT THEP H 3.0 by KY SU NGUYEN XUAN MINH DHXD HANOI") 
(princ "\n      Copyright HiTech Group 2004 ENG NGUYEN XUAN MINH") 
(setq base_point(getpoint "\nBase point : "))
(setq loai      (getint   "\nLoai (0-18) : "))
)
;;;
;;;Chuong trinh con ve thep loai 0
(defun veloai0()
(princ "\nCot thep bat ky") 
(setq chieudai (getreal    "\nChieu dai  : "))
)
;;;
;;;Chuong trinh con ve thep loai 1
(defun veloai1()
(princ "\nCot thep thang") 
(setq chieudai (getreal    "\nChieu dai  : "))
(command "_PLINE" ( polar (polar base_point 0 10) (/ pi 2) 2 ) "@30,0" "") 
(command "_TEXT" "_M" "@-15,3" 0 (rtos chieudai 2 0) )
)
;;;
;;;Chuong trinh con ve thep loai 2 
(defun veloai2()
(princ "\nCot thep uon hai dau") 
(setq chieudai1(getreal   "\nChieu dai doan uon 1 : "))
(setq chieudai2(getreal   "\nChieu dai doan thang : "))
(setq chieudai3(getreal   "\nChieu dai doan uon 2 : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3 ))
(command "_PLINE" 
( polar (polar base_point 0 10) (/ pi 2) 2 ) 
"@0,6" 
"@30,0"
"@0,-6"
"") 
(command "_TEXT" "_M" "@-35,3" 0 (rtos chieudai1 2 0) )
(command "_TEXT" "_M" "@20,0" 0  (rtos chieudai2 2 0) )
(command "_TEXT" "_M" "@20,0" 0  (rtos chieudai3 2 0) )
)
;;;
;;;Chuong trinh con ve thep loai 3 
(defun veloai3()
(princ "\nCot thep uon mot dau") 
(setq chieudai1(getreal   "\nChieu dai doan uon   : "))
(setq chieudai2(getreal   "\nChieu dai doan thang : "))
(setq chieudai ( + chieudai1 chieudai2 ))
(command "_PLINE" 
( polar (polar base_point 0 10) (/ pi 2) 2 ) 
"@0,6" 
"@30,0"
"") 
(command "_TEXT" "_M" "@-35,-3" 0 (rtos chieudai1 2 0) )
(command "_TEXT" "_M" "@20,0" 0 (rtos chieudai2 2 0) )
)
;;;
;;;Chuong trinh con ve thep loai 4 
(defun veloai4()
(princ "\nCot thep san") 
(setq chieudai1(getreal   "\nChieu dai thep : "))
(setq chieudai2(getreal   "\nChieu dai moc  : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai2 ))
(command "_PLINE" 
( polar (polar base_point 0 12) (/ pi 2) 4 ) 
"@-2,0" 
"_A"
"@0,-2"
"_L"
"@30,0"
"_A"
"@0,2"
"_L"
"@-2,0"
"") 
(command "_TEXT" "_M" "@-33,1" 0 (rtos chieudai2 2 0) )
(command "_TEXT" "_M" "@20,0" 0 (rtos chieudai1 2 0) )
(command "_TEXT" "_M" "@20,0" 0 (rtos chieudai2 2 0) )
)
;;;
;;;Chuong trinh con ve thep loai 5
(defun veloai5()
(princ "\nCot thep dai chu nhat") 
(setq chieudai1(getreal   "\nChieu cao dai : "))
(setq chieudai2(getreal   "\nChieu rong dai: "))
(setq chieudai3(getreal   "\nChieu dai moc : "))
(setq chieudai ( + chieudai1 chieudai1 chieudai2 chieudai2 chieudai3 chieudai3 ))
(command "_PLINE" 
( polar (polar base_point 0 5) (/ pi 2) 5 ) 
"@35,0" 
"@0,-3"
"@-30,0"
"@0,6"
"") 
(command "_TEXT" "_M" "@-5,0" 0 (rtos chieudai3 2 0) )
(command "_TEXT" "_M" "@20,0" 0 (rtos chieudai1 2 0) )
(command "_TEXT" "_M" "@20,-3" 0 (rtos chieudai2 2 0) )
)
;;;
;;;Chuong trinh con ve thep loai 6
(defun veloai6()
(princ "\nCot thep vai bo")
(setq chieudai1 (getreal   "\nChieu dai 1  :"))
(setq chieudai2 (getreal   "\nChieu dai 2  :"))
(setq chieudai3 (getreal   "\nChieu dai 3  :"))
(setq chieudai4 (getreal   "\nChieu dai 4  :"))
(setq chieudai ( + chieudai1 chieudai2 chieudai3 chieudai2 chieudai4 ))
(command  "_PLINE"
( polar (polar base_point 0 10) (/ pi 2) 5 )
"@5,0"
"@3,-3"
"@14,0"
"@3,3"
"@5,0"
"")
(command "TEXT" "_R" "@-25,1.5" 0 (rtos chieudai1 2 0) )
(command "TEXT" "_R" "@0,-5.5" 0 (rtos chieudai2 2 0) )
(command "TEXT" "_M" "@10,3.5" 0 (rtos chieudai3 2 0) )
(command "TEXT" "@10,-3.5" 0 (rtos chieudai2 2 0) )
(command "TEXT" "@0,5.5" 0 (rtos chieudai4 2 0) )
) 
;;;
;;;Chuong trinh con ve thep loai 7
(defun veloai7()
(princ "\nCot thep treo moc cau")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai3 (getreal  "\nChieu dai doan cong    : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3 chieudai2 chieudai1 ))
(command "_PLINE"
(polar (polar base_point 0 16) (/ pi 2) 2 )
"@6,0"
"@0,6"
"_A"
"@3,0"
"_L"
"@0,-6"
"@6,0"
"")
(command "TEXT" "_M" "@-20,1" 0 (rtos chieudai1 2 0))
(command "TEXT" "_M" "@7,3" 0 (rtos chieudai2 2 0))
(command "TEXT" "_M" "@12,3" 0 (rtos chieudai3 2 0))
(command "TEXT" "_M" "@6,-6" 0 (rtos chieudai1 2 0))
)
;;;Chuong trinh con ve thep loai 8
(defun veloai8 ()
(princ "\nCot thep cau thang loai 1")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai ( + chieudai1 chieudai2))
(command "_PLINE"
(polar (polar base_point 0 10) (/ pi 2) 2 )
"@20,6"
"@10,0"
""
)
(command "TEXT" "_R" "@-21,-2" 0 (rtos chieudai1 2 0))
(command "TEXT" "@12,-2" 0 (rtos chieudai2 2 0))
)
;;;Chuong trinh con ve loai 9
(defun veloai9 ()
(princ "\nCot thep cau thang loai 2")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai3 (getreal  "\nChieu dai doan thang 3 : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3))
(command "_PLINE"
(polar (polar base_point 0 10) (/ pi 2) 2 )
"@20,6"
"@10,0"
"@0,-6"
""
)
(command "TEXT" "_R" "@-21,4" 0 (rtos chieudai1 2 0))
(command "TEXT" "_C" "@15,-2" 0 (rtos chieudai2 2 0))
(command "TEXT" "@7,0" 0 (rtos chieudai3 2 0))
)
;;;
;;;Chuong trinh con ve loai 10
(defun veloai10 ()
(princ "\nCot thep cau thang loai 3")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai3 (getreal  "\nChieu dai doan thang 3 : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3))
(command "_PLINE"
(polar (polar base_point 0 10) (/ pi 2) 1 )
"@0,2"
"@20,5"
"@10,0"
""
)
(command "TEXT" "_R" "@-31.5,-7" 0 (rtos chieudai1 2 0))
(command "TEXT" "R" "@9,5" 0 (rtos chieudai2 2 0))
(command "TEXT" "@13,-2" 0 (rtos chieudai3 2 0))
)
;;;Chuong trinh con ve loai 11
(defun veloai11 ()
(princ "\nCot thep cau thang loai 4")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai3 (getreal  "\nChieu dai doan thang 3 : "))
(setq chieudai4 (getreal  "\nChieu dai doan thang 4 : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3 chieudai4))
(command "_PLINE"
(polar (polar base_point 0 10) (/ pi 2) 1 )
"@0,2"
"@20,5"
"@10,0"
"@0,-7"
""
)
(command "TEXT" "_R" "@-31.5,0" 0 (rtos chieudai1 2 0))
(command "TEXT" "_R" "@9,5" 0 (rtos chieudai2 2 0))
(command "TEXT" "C" "@16,-2" 0 (rtos chieudai3 2 0))
(command "TEXT" "@8,-1" 0 (rtos chieudai4 2 0))
)
:;;
;;;Chuong trinh con ve loai 12
(defun veloai12 ()
(princ "\nCot thep cau thang loai 5")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai3 (getreal  "\nChieu dai doan thang 3 : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3))
(command "_PLINE"
(polar (polar base_point 0 10) (/ pi 2) 1 )
"@18,5"
"@0,2"
"@10,0"
""
)
(command "TEXT" "_R" "@-29.5,-6" 0 (rtos chieudai1 2 0))
(command "TEXT" "_R" "@18,5" 0 (rtos chieudai2 2 0))
(command "TEXT" "C" "@7.5,-2.5" 0 (rtos chieudai3 2 0))
)
:;;
;;;Chuong trinh con ve loai 13
(defun veloai13 ()
(princ "\nCot thep cau thang loai 6")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai3 (getreal  "\nChieu dai doan thang 3 : "))
(setq chieudai4 (getreal  "\nChieu dai doan thang 4 : "))
(setq chieudai5 (getreal  "\nChieu dai doan thang 5 : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3 chieudai4 chieudai5))
(command "_PLINE"
(polar (polar base_point 0 10) (/ pi 2) 1 )
"@10,0"
"@0,2"
"@10,3"
"@0,2"
"@10,0"
""
)
(command "TEXT" "_R" "@-31.5,-7" 0 (rtos chieudai1 2 0))
(command "TEXT" "_R" "@10,2" 0 (rtos chieudai2 2 0))
(command "TEXT" "_M" "@8,-1.5" 0 (rtos chieudai3 2 0))
(command "TEXT" "_R" "@2,5" 0 (rtos chieudai4 2 0))
(command "TEXT" "C" "@7,-2" 0 (rtos chieudai5 2 0))
)
:;;
;;;Chuong trinh con ve loai 14
(defun veloai14 ()
(princ "\nCot thep cau thang loai 7")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai3 (getreal  "\nChieu dai doan thang 3 : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3))
(command "_PLINE"
(polar (polar base_point 0 10) (/ pi 2) 1 )
"@10,0"
"@0,2"
"@20,5"
""
)
(command "TEXT" "_R" "@-31.5,-7" 0 (rtos chieudai1 2 0))
(command "TEXT" "_R" "@10,2" 0 (rtos chieudai2 2 0))
(command "TEXT" "C" "@12,-2" 0 (rtos chieudai3 2 0))
)
:;;
;;;Chuong trinh con ve loai 15
(defun veloai15 ()
(princ "\nCot thep cau thang loai 8")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai3 (getreal  "\nChieu dai doan thang 3 : "))
(setq chieudai4 (getreal  "\nChieu dai doan thang 4 : "))
(setq chieudai5 (getreal  "\nChieu dai doan thang 5 : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3 chieudai4 chieudai5))
(command "_PLINE"
(polar (polar base_point 0 10) (/ pi 2) 1 )
"@0,2"
"@14,2"
"@1,2"
"@15,-2"
"@0,-2"
""
)
(command "TEXT" "_R" "@-31.5,-2" 0 (rtos chieudai1 2 0))
(command "TEXT" "_R" "@7,4" 0 (rtos chieudai2 2 0))
(command "TEXT" "_M" "@6,2" 0 (rtos chieudai2 2 0))
(command "TEXT" "_R" "@14,0.5" 0 (rtos chieudai3 2 0))
(command "TEXT" "@6,-4" 0 (rtos chieudai4 2 0))
)
:;;
;;;Chuong trinh con ve loai 16
(defun veloai16 ()
(princ "\nCot thep cau thang loai 9")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai3 (getreal  "\nChieu dai doan thang 3 : "))
(setq chieudai4 (getreal  "\nChieu dai doan thang 4 : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3 chieudai4))
(command "_PLINE"
(polar (polar base_point 0 10) (/ pi 2) 1 )
"@6,0"
"@14,5"
"@0,2"
"@10,0"
""
)
(command "TEXT" "_R" "@-31.5,-6" 0 (rtos chieudai1 2 0))
(command "TEXT" "_R" "@11,2.5" 0 (rtos chieudai2 2 0))
(command "TEXT" "_R" "@9,2" 0 (rtos chieudai3 2 0))
(command "TEXT" "_M""@6,-1" 0 (rtos chieudai4 2 0))
)
:;;
;;;Chuong trinh con ve loai 17
(defun veloai17 ()
(princ "\nCot thep cau thang loai 10")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai3 (getreal  "\nChieu dai doan thang 3 : "))
(setq chieudai4 (getreal  "\nChieu dai doan thang 4 : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3 chieudai4))
(command "_PLINE"
(polar (polar base_point 0 10) (/ pi 2) 2 )
"@0.5,5"
"@15,-4"
"@15,4"
"@0.5,-5"
""
)
(command "TEXT" "_R" "@-32,0" 0 (rtos chieudai1 2 0))
(command "TEXT" "_R" "@12,4" 0 (rtos chieudai2 2 0))
(command "TEXT" "C" "@10,0" 0 (rtos chieudai3 2 0))
(command "TEXT" "@11,-4" 0 (rtos chieudai4 2 0))
)
:;;
;;;Chuong trinh con ve loai 18
(defun veloai18 ()
(princ "\nCot thep dam loai 2")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai3 (getreal  "\nChieu dai doan thang 3 : "))
(setq chieudai4 (getreal  "\nChieu dai doan thang 4 : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3 chieudai4))
(command "_PLINE"
(polar (polar base_point 0 10) (/ pi 2) 2 )
"@0,0" 
"@0,5"
"@30,0"
"@0,-2.5"
"@-10,-2.5"
""
)

(command "TEXT" "_R" "@-22,2" 0 (rtos chieudai1 2 0))
(command "TEXT" "_M" "@15,5" 0 (rtos chieudai2 2 0))
(command "TEXT" "C" "@21,-4.5" 0 (rtos chieudai3 2 0))
(command "TEXT" "@-20,-2" 0 (rtos chieudai4 2 0))
)
;;; Chuong trinh con tinh toan thong ke
(defun thongke()
(command "_POINT" ( polar base_point 0 50))
(setq duongkinh(getreal   "\nDuong kinh : "))
(setq sothanh  (getreal   "\nSo thanh   : "))
(setq socaukien(getreal   "\nSo cau kien: <1>"))
(if socaukien null (setq socaukien 1.0))
(if (and (>= duongkinh 10) (> chieudai 11700))
        (progn
        (setq a (fix(/ chieudai 11700)))
        (setq cdainoi (getreal "\nChieu dai noi chong: <30D>"))
        (if (not cdainoi)    (setq cdainoi 30))
        (setq chieudai (+ chieudai (* a (* cdainoi duongkinh))))
                     ))
(setq tongchd(* chieudai (* sothanh (* socaukien 0.001))))
(setq tongkhlg(* tongchd (* duongkinh (* duongkinh 0.006165375))))
(command "_TEXT" "_M" "@5,5" 0 (rtos duongkinh 2 0) )
(command "_TEXT" "_M" "@15,0" 0 (rtos chieudai 2 0) )
(command "_TEXT" "_M" "@15,0" 0 (rtos sothanh 2 0) )
(command "_TEXT" "_M" "@10,0" 0 (rtos (* sothanh socaukien) 2 0) )
(command "_TEXT" "_M" "@15,0" 0 (rtos tongchd 2 2) )
(command "_TEXT" "_M" "@20,0" 0 (rtos tongkhlg 2 2) )
)
;;;Chuong trinh chinh
(defun c:tk( / CMD LIM TS PLW OSM OLDERR)
(SETQ OLDERR *error*
        *error* loitk
)
(SETQ CMD (GETVAR "CMDECHO"))
(SETQ LIM (GETVAR "LIMCHECK"))
(SETQ TS (GETVAR "TEXTSIZE"))
(SETQ PLW (GETVAR "PLINEWID"))
(SETQ OSM (GETVAR "OSMODE"))
(command "SETVAR" "CMDECHO" 0 )
(command "SETVAR" "LIMCHECK" 0 )
(command "SETVAR" "TEXTSIZE" 2.5 )
(command "SETVAR" "PLINEWID" 0.5 )
(command "OSNAP" "INT")
(gpuser)
(SETVAR "OSMODE" 0)
(cond 
((= loai 0) (veloai0))
((= loai 1) (veloai1))
((= loai 2) (veloai2))
((= loai 3) (veloai3))
((= loai 4) (veloai4))
((= loai 5) (veloai5))
((= loai 6) (veloai6))
((= loai 7) (veloai7))
((= loai 8) (veloai8))
((= loai 9) (veloai9))
((= loai 10) (veloai10))
((= loai 11) (veloai11))
((= loai 12) (veloai12))
((= loai 13) (veloai13))
((= loai 14) (veloai14))
((= loai 15) (veloai15))
((= loai 16) (veloai16))
((= loai 17) (veloai17))
((= loai 18) (veloai18))
)
(thongke)
(SETVAR "CMDECHO" CMD)
(SETVAR "LIMCHECK" LIM)
(SETVAR "TEXTSIZE" TS)
(SETVAR "PLINEWID" PLW)
(SETVAR "OSMODE" 15295)
(SETQ *error* OLDERR)
(princ)
)
(princ " loaded !")

cái này minhd đã để nó ở hệ mm nên bạn cần chuyển cái file temp acad.dwt về hệ này để dùng https://www.cadviet.com/upfiles/3/54284_tk14.dwg

Cách dùng

  1. Tải tệp 283973_tk.lsp về máy.
  2. Trong AutoCAD gõ lệnh APPLOAD, chọn tệp vừa tải rồi bấm Load. Cũng có thể kéo thả tệp .lsp vào cửa sổ bản vẽ.
  3. Gõ lệnh TK để chạy lisp.

Mã nguồn 283973_tk.lsp

;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/96982-nh%E1%BB%9D-s%E1%BB%ADa-lsp-th%E1%BB%91ng-k%C3%AA-th%C3%A9p-c%C3%B3-th%C3%AAm-%C4%91o%E1%BA%A1n-n%E1%BB%91i-ch%E1%BB%93ng/
;=CHUONG TRINH THONG KE COT THEP CAU KIEN
;;;Chuong trinh bat loi
(defun loitk (s)                    ; If an error (such as CTRL-C) occurs
                                      ; while this command is active...
  (cond
    ((= s "quit / exit abort") (princ))
    ((/= s "Function cancelled") (princ (strcat "\nError: " s)))
  )
(SETVAR "CMDECHO" CMD)
(SETVAR "LIMCHECK" LIM)
(SETVAR "TEXTSIZE" TS)
(SETVAR "PLINEWID" PLW)
(SETVAR "OSMODE" OSM)
(SETQ *error* OLDERR)
(princ)
)
;;;CHUONG TRINH CON NHAP DU LIEU
(princ "\nThong ke cot thep H3.0 ");
(defun gpuser()
(princ "\nTHONG KE COT THEP H 3.0 by KY SU NGUYEN XUAN MINH DHXD HANOI") 
(princ "\n      Copyright HiTech Group 2004 ENG NGUYEN XUAN MINH") 
(setq base_point(getpoint "\nBase point : "))
(setq loai      (getint   "\nLoai (0-18) : "))
)
;;;
;;;Chuong trinh con ve thep loai 0
(defun veloai0()
(princ "\nCot thep bat ky") 
(setq chieudai (getreal    "\nChieu dai  : "))
)
;;;
;;;Chuong trinh con ve thep loai 1
(defun veloai1()
(princ "\nCot thep thang") 
(setq chieudai (getreal    "\nChieu dai  : "))
(command "_PLINE" ( polar (polar base_point 0 10) (/ pi 2) 2 ) "@30,0" "") 
(command "_TEXT" "_M" "@-15,3" 0 (rtos chieudai 2 0) )
)
;;;
;;;Chuong trinh con ve thep loai 2 
(defun veloai2()
(princ "\nCot thep uon hai dau") 
(setq chieudai1(getreal   "\nChieu dai doan uon 1 : "))
(setq chieudai2(getreal   "\nChieu dai doan thang : "))
(setq chieudai3(getreal   "\nChieu dai doan uon 2 : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3 ))
(command "_PLINE" 
( polar (polar base_point 0 10) (/ pi 2) 2 ) 
"@0,6" 
"@30,0"
"@0,-6"
"") 
(command "_TEXT" "_M" "@-35,3" 0 (rtos chieudai1 2 0) )
(command "_TEXT" "_M" "@20,0" 0  (rtos chieudai2 2 0) )
(command "_TEXT" "_M" "@20,0" 0  (rtos chieudai3 2 0) )
)
;;;
;;;Chuong trinh con ve thep loai 3 
(defun veloai3()
(princ "\nCot thep uon mot dau") 
(setq chieudai1(getreal   "\nChieu dai doan uon   : "))
(setq chieudai2(getreal   "\nChieu dai doan thang : "))
(setq chieudai ( + chieudai1 chieudai2 ))
(command "_PLINE" 
( polar (polar base_point 0 10) (/ pi 2) 2 ) 
"@0,6" 
"@30,0"
"") 
(command "_TEXT" "_M" "@-35,-3" 0 (rtos chieudai1 2 0) )
(command "_TEXT" "_M" "@20,0" 0 (rtos chieudai2 2 0) )
)
;;;
;;;Chuong trinh con ve thep loai 4 
(defun veloai4()
(princ "\nCot thep san") 
(setq chieudai1(getreal   "\nChieu dai thep : "))
(setq chieudai2(getreal   "\nChieu dai moc  : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai2 ))
(command "_PLINE" 
( polar (polar base_point 0 12) (/ pi 2) 4 ) 
"@-2,0" 
"_A"
"@0,-2"
"_L"
"@30,0"
"_A"
"@0,2"
"_L"
"@-2,0"
"") 
(command "_TEXT" "_M" "@-33,1" 0 (rtos chieudai2 2 0) )
(command "_TEXT" "_M" "@20,0" 0 (rtos chieudai1 2 0) )
(command "_TEXT" "_M" "@20,0" 0 (rtos chieudai2 2 0) )
)
;;;
;;;Chuong trinh con ve thep loai 5
(defun veloai5()
(princ "\nCot thep dai chu nhat") 
(setq chieudai1(getreal   "\nChieu cao dai : "))
(setq chieudai2(getreal   "\nChieu rong dai: "))
(setq chieudai3(getreal   "\nChieu dai moc : "))
(setq chieudai ( + chieudai1 chieudai1 chieudai2 chieudai2 chieudai3 chieudai3 ))
(command "_PLINE" 
( polar (polar base_point 0 5) (/ pi 2) 5 ) 
"@35,0" 
"@0,-3"
"@-30,0"
"@0,6"
"") 
(command "_TEXT" "_M" "@-5,0" 0 (rtos chieudai3 2 0) )
(command "_TEXT" "_M" "@20,0" 0 (rtos chieudai1 2 0) )
(command "_TEXT" "_M" "@20,-3" 0 (rtos chieudai2 2 0) )
)
;;;
;;;Chuong trinh con ve thep loai 6
(defun veloai6()
(princ "\nCot thep vai bo")
(setq chieudai1 (getreal   "\nChieu dai 1  :"))
(setq chieudai2 (getreal   "\nChieu dai 2  :"))
(setq chieudai3 (getreal   "\nChieu dai 3  :"))
(setq chieudai4 (getreal   "\nChieu dai 4  :"))
(setq chieudai ( + chieudai1 chieudai2 chieudai3 chieudai2 chieudai4 ))
(command  "_PLINE"
( polar (polar base_point 0 10) (/ pi 2) 5 )
"@5,0"
"@3,-3"
"@14,0"
"@3,3"
"@5,0"
"")
(command "TEXT" "_R" "@-25,1.5" 0 (rtos chieudai1 2 0) )
(command "TEXT" "_R" "@0,-5.5" 0 (rtos chieudai2 2 0) )
(command "TEXT" "_M" "@10,3.5" 0 (rtos chieudai3 2 0) )
(command "TEXT" "@10,-3.5" 0 (rtos chieudai2 2 0) )
(command "TEXT" "@0,5.5" 0 (rtos chieudai4 2 0) )
) 
;;;
;;;Chuong trinh con ve thep loai 7
(defun veloai7()
(princ "\nCot thep treo moc cau")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai3 (getreal  "\nChieu dai doan cong    : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3 chieudai2 chieudai1 ))
(command "_PLINE"
(polar (polar base_point 0 16) (/ pi 2) 2 )
"@6,0"
"@0,6"
"_A"
"@3,0"
"_L"
"@0,-6"
"@6,0"
"")
(command "TEXT" "_M" "@-20,1" 0 (rtos chieudai1 2 0))
(command "TEXT" "_M" "@7,3" 0 (rtos chieudai2 2 0))
(command "TEXT" "_M" "@12,3" 0 (rtos chieudai3 2 0))
(command "TEXT" "_M" "@6,-6" 0 (rtos chieudai1 2 0))
)
;;;Chuong trinh con ve thep loai 8
(defun veloai8 ()
(princ "\nCot thep cau thang loai 1")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai ( + chieudai1 chieudai2))
(command "_PLINE"
(polar (polar base_point 0 10) (/ pi 2) 2 )
"@20,6"
"@10,0"
""
)
(command "TEXT" "_R" "@-21,-2" 0 (rtos chieudai1 2 0))
(command "TEXT" "@12,-2" 0 (rtos chieudai2 2 0))
)
;;;Chuong trinh con ve loai 9
(defun veloai9 ()
(princ "\nCot thep cau thang loai 2")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai3 (getreal  "\nChieu dai doan thang 3 : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3))
(command "_PLINE"
(polar (polar base_point 0 10) (/ pi 2) 2 )
"@20,6"
"@10,0"
"@0,-6"
""
)
(command "TEXT" "_R" "@-21,4" 0 (rtos chieudai1 2 0))
(command "TEXT" "_C" "@15,-2" 0 (rtos chieudai2 2 0))
(command "TEXT" "@7,0" 0 (rtos chieudai3 2 0))
)
;;;
;;;Chuong trinh con ve loai 10
(defun veloai10 ()
(princ "\nCot thep cau thang loai 3")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai3 (getreal  "\nChieu dai doan thang 3 : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3))
(command "_PLINE"
(polar (polar base_point 0 10) (/ pi 2) 1 )
"@0,2"
"@20,5"
"@10,0"
""
)
(command "TEXT" "_R" "@-31.5,-7" 0 (rtos chieudai1 2 0))
(command "TEXT" "R" "@9,5" 0 (rtos chieudai2 2 0))
(command "TEXT" "@13,-2" 0 (rtos chieudai3 2 0))
)
;;;Chuong trinh con ve loai 11
(defun veloai11 ()
(princ "\nCot thep cau thang loai 4")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai3 (getreal  "\nChieu dai doan thang 3 : "))
(setq chieudai4 (getreal  "\nChieu dai doan thang 4 : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3 chieudai4))
(command "_PLINE"
(polar (polar base_point 0 10) (/ pi 2) 1 )
"@0,2"
"@20,5"
"@10,0"
"@0,-7"
""
)
(command "TEXT" "_R" "@-31.5,0" 0 (rtos chieudai1 2 0))
(command "TEXT" "_R" "@9,5" 0 (rtos chieudai2 2 0))
(command "TEXT" "C" "@16,-2" 0 (rtos chieudai3 2 0))
(command "TEXT" "@8,-1" 0 (rtos chieudai4 2 0))
)
:;;
;;;Chuong trinh con ve loai 12
(defun veloai12 ()
(princ "\nCot thep cau thang loai 5")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai3 (getreal  "\nChieu dai doan thang 3 : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3))
(command "_PLINE"
(polar (polar base_point 0 10) (/ pi 2) 1 )
"@18,5"
"@0,2"
"@10,0"
""
)
(command "TEXT" "_R" "@-29.5,-6" 0 (rtos chieudai1 2 0))
(command "TEXT" "_R" "@18,5" 0 (rtos chieudai2 2 0))
(command "TEXT" "C" "@7.5,-2.5" 0 (rtos chieudai3 2 0))
)
:;;
;;;Chuong trinh con ve loai 13
(defun veloai13 ()
(princ "\nCot thep cau thang loai 6")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai3 (getreal  "\nChieu dai doan thang 3 : "))
(setq chieudai4 (getreal  "\nChieu dai doan thang 4 : "))
(setq chieudai5 (getreal  "\nChieu dai doan thang 5 : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3 chieudai4 chieudai5))
(command "_PLINE"
(polar (polar base_point 0 10) (/ pi 2) 1 )
"@10,0"
"@0,2"
"@10,3"
"@0,2"
"@10,0"
""
)
(command "TEXT" "_R" "@-31.5,-7" 0 (rtos chieudai1 2 0))
(command "TEXT" "_R" "@10,2" 0 (rtos chieudai2 2 0))
(command "TEXT" "_M" "@8,-1.5" 0 (rtos chieudai3 2 0))
(command "TEXT" "_R" "@2,5" 0 (rtos chieudai4 2 0))
(command "TEXT" "C" "@7,-2" 0 (rtos chieudai5 2 0))
)
:;;
;;;Chuong trinh con ve loai 14
(defun veloai14 ()
(princ "\nCot thep cau thang loai 7")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai3 (getreal  "\nChieu dai doan thang 3 : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3))
(command "_PLINE"
(polar (polar base_point 0 10) (/ pi 2) 1 )
"@10,0"
"@0,2"
"@20,5"
""
)
(command "TEXT" "_R" "@-31.5,-7" 0 (rtos chieudai1 2 0))
(command "TEXT" "_R" "@10,2" 0 (rtos chieudai2 2 0))
(command "TEXT" "C" "@12,-2" 0 (rtos chieudai3 2 0))
)
:;;
;;;Chuong trinh con ve loai 15
(defun veloai15 ()
(princ "\nCot thep cau thang loai 8")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai3 (getreal  "\nChieu dai doan thang 3 : "))
(setq chieudai4 (getreal  "\nChieu dai doan thang 4 : "))
(setq chieudai5 (getreal  "\nChieu dai doan thang 5 : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3 chieudai4 chieudai5))
(command "_PLINE"
(polar (polar base_point 0 10) (/ pi 2) 1 )
"@0,2"
"@14,2"
"@1,2"
"@15,-2"
"@0,-2"
""
)
(command "TEXT" "_R" "@-31.5,-2" 0 (rtos chieudai1 2 0))
(command "TEXT" "_R" "@7,4" 0 (rtos chieudai2 2 0))
(command "TEXT" "_M" "@6,2" 0 (rtos chieudai2 2 0))
(command "TEXT" "_R" "@14,0.5" 0 (rtos chieudai3 2 0))
(command "TEXT" "@6,-4" 0 (rtos chieudai4 2 0))
)
:;;
;;;Chuong trinh con ve loai 16
(defun veloai16 ()
(princ "\nCot thep cau thang loai 9")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai3 (getreal  "\nChieu dai doan thang 3 : "))
(setq chieudai4 (getreal  "\nChieu dai doan thang 4 : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3 chieudai4))
(command "_PLINE"
(polar (polar base_point 0 10) (/ pi 2) 1 )
"@6,0"
"@14,5"
"@0,2"
"@10,0"
""
)
(command "TEXT" "_R" "@-31.5,-6" 0 (rtos chieudai1 2 0))
(command "TEXT" "_R" "@11,2.5" 0 (rtos chieudai2 2 0))
(command "TEXT" "_R" "@9,2" 0 (rtos chieudai3 2 0))
(command "TEXT" "_M""@6,-1" 0 (rtos chieudai4 2 0))
)
:;;
;;;Chuong trinh con ve loai 17
(defun veloai17 ()
(princ "\nCot thep cau thang loai 10")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai3 (getreal  "\nChieu dai doan thang 3 : "))
(setq chieudai4 (getreal  "\nChieu dai doan thang 4 : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3 chieudai4))
(command "_PLINE"
(polar (polar base_point 0 10) (/ pi 2) 2 )
"@0.5,5"
"@15,-4"
"@15,4"
"@0.5,-5"
""
)
(command "TEXT" "_R" "@-32,0" 0 (rtos chieudai1 2 0))
(command "TEXT" "_R" "@12,4" 0 (rtos chieudai2 2 0))
(command "TEXT" "C" "@10,0" 0 (rtos chieudai3 2 0))
(command "TEXT" "@11,-4" 0 (rtos chieudai4 2 0))
)
:;;
;;;Chuong trinh con ve loai 18
(defun veloai18 ()
(princ "\nCot thep dam loai 2")
(setq chieudai1 (getreal  "\nChieu dai doan thang 1 : "))
(setq chieudai2 (getreal  "\nChieu dai doan thang 2 : "))
(setq chieudai3 (getreal  "\nChieu dai doan thang 3 : "))
(setq chieudai4 (getreal  "\nChieu dai doan thang 4 : "))
(setq chieudai ( + chieudai1 chieudai2 chieudai3 chieudai4))
(command "_PLINE"
(polar (polar base_point 0 10) (/ pi 2) 2 )
"@0,0" 
"@0,5"
"@30,0"
"@0,-2.5"
"@-10,-2.5"
""
)

(command "TEXT" "_R" "@-22,2" 0 (rtos chieudai1 2 0))
(command "TEXT" "_M" "@15,5" 0 (rtos chieudai2 2 0))
(command "TEXT" "C" "@21,-4.5" 0 (rtos chieudai3 2 0))
(command "TEXT" "@-20,-2" 0 (rtos chieudai4 2 0))
)
;;; Chuong trinh con tinh toan thong ke
(defun thongke()
(command "_POINT" ( polar base_point 0 50))
(setq duongkinh(getreal   "\nDuong kinh : "))
(setq sothanh  (getreal   "\nSo thanh   : "))
(setq socaukien(getreal   "\nSo cau kien: <1>"))
(if socaukien null (setq socaukien 1.0))
(if (and (>= duongkinh 10) (> chieudai 11700))
        (progn
        (setq a (fix(/ chieudai 11700)))
        (setq cdainoi (getreal "\nChieu dai noi chong: <30D>"))
        (if (not cdainoi)    (setq cdainoi 30))
        (setq chieudai (+ chieudai (* a (* cdainoi duongkinh))))
                     ))
(setq tongchd(* chieudai (* sothanh (* socaukien 0.001))))
(setq tongkhlg(* tongchd (* duongkinh (* duongkinh 0.006165375))))
(command "_TEXT" "_M" "@5,5" 0 (rtos duongkinh 2 0) )
(command "_TEXT" "_M" "@15,0" 0 (rtos chieudai 2 0) )
(command "_TEXT" "_M" "@15,0" 0 (rtos sothanh 2 0) )
(command "_TEXT" "_M" "@10,0" 0 (rtos (* sothanh socaukien) 2 0) )
(command "_TEXT" "_M" "@15,0" 0 (rtos tongchd 2 2) )
(command "_TEXT" "_M" "@20,0" 0 (rtos tongkhlg 2 2) )
)
;;;Chuong trinh chinh
(defun c:tk( / CMD LIM TS PLW OSM OLDERR)
(SETQ OLDERR *error*
        *error* loitk
)
(SETQ CMD (GETVAR "CMDECHO"))
(SETQ LIM (GETVAR "LIMCHECK"))
(SETQ TS (GETVAR "TEXTSIZE"))
(SETQ PLW (GETVAR "PLINEWID"))
(SETQ OSM (GETVAR "OSMODE"))
(command "SETVAR" "CMDECHO" 0 )
(command "SETVAR" "LIMCHECK" 0 )
(command "SETVAR" "TEXTSIZE" 2.5 )
(command "SETVAR" "PLINEWID" 0.5 )
(command "OSNAP" "INT")
(gpuser)
(SETVAR "OSMODE" 0)
(cond 
((= loai 0) (veloai0))
((= loai 1) (veloai1))
((= loai 2) (veloai2))
((= loai 3) (veloai3))
((= loai 4) (veloai4))
((= loai 5) (veloai5))
((= loai 6) (veloai6))
((= loai 7) (veloai7))
((= loai 8) (veloai8))
((= loai 9) (veloai9))
((= loai 10) (veloai10))
((= loai 11) (veloai11))
((= loai 12) (veloai12))
((= loai 13) (veloai13))
((= loai 14) (veloai14))
((= loai 15) (veloai15))
((= loai 16) (veloai16))
((= loai 17) (veloai17))
((= loai 18) (veloai18))
)
(thongke)
(SETVAR "CMDECHO" CMD)
(SETVAR "LIMCHECK" LIM)
(SETVAR "TEXTSIZE" TS)
(SETVAR "PLINEWID" PLW)
(SETVAR "OSMODE" 15295)
(SETQ *error* OLDERR)
(princ)
)
(princ " loaded !")

Thảo luận gốc

Lisp được chia sẻ trong chủ đề Nhờ sửa lsp thống kê thép có thêm đoạn nối chồng. Xem đúng bài viết #283973 để đọc hướng dẫn và trao đổi thêm.

Về Thư viện AutoLisp (trang 152)