Về vấn đề lisp hatch nhanh
(defun c:SF(/ p dt ans ten sc ang dt)
(setvar "cmdecho" 0)
(initget "B B1 B2 BK G GD GD1 GL GL1 GL2 D D1 C K N N1 TO GO GO1")
(setq ans (getkword "\n Chon kieu hatch < B/B1/B2/BK/G/GD/GD1/GL/GL1/GL2/D/D1/C/K/N/N1/TO/GO/GO1 > : "))
(if (= ans "B")
(progn
(setq ten "AR-CONC" sc 20.0 ang 0.0
ten2 "ANSI32" sc2 200.0 ang 0.0)
)
)
(if (= ans "B1")
(progn
(setq ten "AR-CONC" sc 20.0 ang 0.0)
)
)
(if (= ans "B2")
(progn
(setq ten "GRAVEL" sc 100.0 ang 0.0)
)
)
(if (= ans "BK")
(progn
(setq ten "SOLID" sc 200.0 ang 0.0)
)
)
(if (= ans "G")
(progn
(setq ten "ANSI31" sc 400.0 ang 0.0)
)
)
(if (= ans "GD")
(progn
(setq ten "AR-B816" sc 10.0 ang 0.0)
)
)
(if (= ans "GD1")
(progn
(setq ten "FLGSTONE" sc 500.0 ang 0.0)
)
)
(if (= ans "GL")
(progn
(setq ten "NET" sc 1500.0 ang 0.0)
)
)
(if (= ans "GL1")
(progn
(setq ten "ANGLE" sc 700.0 ang 0.0)
)
)
(if (= ans "GL2")
(progn
(setq ten "AR-HBONE" sc 20.0 ang 0.0)
)
)
(if (= ans "D")
(progn
(setq ten "HOUND" sc 500.0 ang 45.0)
)
)
(if (= ans "D1")
(progn
(setq ten "EARTH" sc 500.0 ang 45.0)
)
)
(if (= ans "C")
(progn
(setq ten "AR-SAND" sc 20.0 ang 0.0)
)
)
(if (= ans "K")
(progn
(setq ten "AR-RROOF" sc 500.0 ang 45.0)
)
)
(if (= ans "N")
(progn
(setq ten "AR-RSHKE" sc 30.0 ang 0.0)
)
)
(if (= ans "N1")
(progn
(setq ten "SPANTILE" sc 400.0 ang 0.0)
)
)
(if (= ans "TO")
(progn
(setq ten "ANSI32" sc 200.0 ang 45.0)
)
)
(if (= ans "GO")
(progn
(setq ten "WOOD8" sc 700.0 ang 0.0)
)
)
(if (= ans "GO1")
(progn
(setq ten "WOOD2" sc 500.0 ang 0.0)
)
)
(setvar "hpname" ten)
(setvar "hpscale" sc)
(setvar "hpang" ang)
(initdia)
(command "hatch")
(while (< 0 (getvar "CMDACTIVE"))
(command pause)
)
(princ)
)
Sửa 1 xí . Lệnh và lựa chọn kiểu hatch như cũ. chọn xong trả lại cho lệnh hatch của cad muốn chọn gì thì chọn.
- Tải lisp
- 437014_sf.lsp
Cách dùng
- Tải tệp 437014_sf.lsp về máy.
- 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ẽ.
- Gõ lệnh SF để chạy lisp.
Mã nguồn 437014_sf.lsp
;; free lisp from cadviet.com
;;; this lisp was downloaded from https://www.cadviet.com/forum/topic/176415-nh%E1%BB%9D-ch%E1%BB%89nh-s%E1%BB%ADa-v%E1%BB%81-v%E1%BA%A5n-%C4%91%E1%BB%81-lisp-hatch-nhanh/
(defun c:SF(/ p dt ans ten sc ang dt)
(setvar "cmdecho" 0)
(initget "B B1 B2 BK G GD GD1 GL GL1 GL2 D D1 C K N N1 TO GO GO1")
(setq ans (getkword "\n Chon kieu hatch < B/B1/B2/BK/G/GD/GD1/GL/GL1/GL2/D/D1/C/K/N/N1/TO/GO/GO1 > : "))
(if (= ans "B")
(progn
(setq ten "AR-CONC" sc 20.0 ang 0.0
ten2 "ANSI32" sc2 200.0 ang 0.0)
)
)
(if (= ans "B1")
(progn
(setq ten "AR-CONC" sc 20.0 ang 0.0)
)
)
(if (= ans "B2")
(progn
(setq ten "GRAVEL" sc 100.0 ang 0.0)
)
)
(if (= ans "BK")
(progn
(setq ten "SOLID" sc 200.0 ang 0.0)
)
)
(if (= ans "G")
(progn
(setq ten "ANSI31" sc 400.0 ang 0.0)
)
)
(if (= ans "GD")
(progn
(setq ten "AR-B816" sc 10.0 ang 0.0)
)
)
(if (= ans "GD1")
(progn
(setq ten "FLGSTONE" sc 500.0 ang 0.0)
)
)
(if (= ans "GL")
(progn
(setq ten "NET" sc 1500.0 ang 0.0)
)
)
(if (= ans "GL1")
(progn
(setq ten "ANGLE" sc 700.0 ang 0.0)
)
)
(if (= ans "GL2")
(progn
(setq ten "AR-HBONE" sc 20.0 ang 0.0)
)
)
(if (= ans "D")
(progn
(setq ten "HOUND" sc 500.0 ang 45.0)
)
)
(if (= ans "D1")
(progn
(setq ten "EARTH" sc 500.0 ang 45.0)
)
)
(if (= ans "C")
(progn
(setq ten "AR-SAND" sc 20.0 ang 0.0)
)
)
(if (= ans "K")
(progn
(setq ten "AR-RROOF" sc 500.0 ang 45.0)
)
)
(if (= ans "N")
(progn
(setq ten "AR-RSHKE" sc 30.0 ang 0.0)
)
)
(if (= ans "N1")
(progn
(setq ten "SPANTILE" sc 400.0 ang 0.0)
)
)
(if (= ans "TO")
(progn
(setq ten "ANSI32" sc 200.0 ang 45.0)
)
)
(if (= ans "GO")
(progn
(setq ten "WOOD8" sc 700.0 ang 0.0)
)
)
(if (= ans "GO1")
(progn
(setq ten "WOOD2" sc 500.0 ang 0.0)
)
)
(setvar "hpname" ten)
(setvar "hpscale" sc)
(setvar "hpang" ang)
(initdia)
(command "hatch")
(while (< 0 (getvar "CMDACTIVE"))
(command pause)
)
(princ)
)Thảo luận gốc
Lisp được chia sẻ trong chủ đề [NHỜ CHỈNH SỬA] Về vấn đề lisp hatch nhanh. Xem đúng bài viết #437014 để đọc hướng dẫn và trao đổi thêm.