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 > : "))
(initget "P S")
(setq ansp (getkword "\n Chon kieu pick diem hay chon doi tuong < P/S > :"))
(setq p nil dt t)
;(WHILE (or (not p) (not dt))
(if (= ans "B")
(progn
(setq ten "AR-CONC" sc 20.0 ang 0.0
ten2 "ANSI32" sc2 200.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
(lh1 p ten2 sc2 ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
(lh dt ten2 sc2 ang)
)
)
)
)
)
(if (= ans "B1")
(progn
(setq ten "AR-CONC" sc 20.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "B2")
(progn
(setq ten "GRAVEL" sc 100.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "BK")
(progn
(setq ten "SOLID" sc 200.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "G")
(progn
(setq ten "ANSI31" sc 400.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "GD")
(progn
(setq ten "AR-B816" sc 10.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "GD1")
(progn
(setq ten "FLGSTONE" sc 500.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "GL")
(progn
(setq ten "NET" sc 1500.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "GL1")
(progn
(setq ten "ANGLE" sc 700.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "GL2")
(progn
(setq ten "AR-HBONE" sc 20.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "D")
(progn
(setq ten "HOUND" sc 500.0 ang 45.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "D1")
(progn
(setq ten "EARTH" sc 500.0 ang 45.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "C")
(progn
(setq ten "AR-SAND" sc 20.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "K")
(progn
(setq ten "AR-RROOF" sc 500.0 ang 45.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "N")
(progn
(setq ten "AR-RSHKE" sc 30.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "N1")
(progn
(setq ten "SPANTILE" sc 400.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "TO")
(progn
(setq ten "ANSI32" sc 200.0 ang 45.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "GO")
(progn
(setq ten "WOOD8" sc 700.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "GO1")
(progn
(setq ten "WOOD2" sc 500.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
;);WHILE
(princ)
)
;;;;;;;;
(defun lh1(p name tle goc)
(setvar "hpgaptol" 50.0)
(vl-cmdf "bhatch" "P" name tle goc p "")
)
;;;;;;;;;;
(defun lh(dt name tle goc)
(setvar "hpgaptol" 50.0)
(vl-cmdf "bhatch" "P" name tle goc "S" dt "" "")
)
Tình hình là mình có sưu tầm 1 Lisp hatch nhanh vật liệu nhưng mình gặp 1 vấn đề là hatch 2 vị trí khác nhau trở lên là mảng hatch không liền khối, mình ko rành lắm về Code chỉ chỉnh sửa lại sơ sơ thôi, nhờ anh em nào rành chỉnh thêm giúp mình với, xin cảm ơn
- Tải lisp
- 436997_sf.lsp
Cách dùng
- Tải tệp 436997_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 436997_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 > : "))
(initget "P S")
(setq ansp (getkword "\n Chon kieu pick diem hay chon doi tuong < P/S > :"))
(setq p nil dt t)
;(WHILE (or (not p) (not dt))
(if (= ans "B")
(progn
(setq ten "AR-CONC" sc 20.0 ang 0.0
ten2 "ANSI32" sc2 200.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
(lh1 p ten2 sc2 ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
(lh dt ten2 sc2 ang)
)
)
)
)
)
(if (= ans "B1")
(progn
(setq ten "AR-CONC" sc 20.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "B2")
(progn
(setq ten "GRAVEL" sc 100.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "BK")
(progn
(setq ten "SOLID" sc 200.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "G")
(progn
(setq ten "ANSI31" sc 400.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "GD")
(progn
(setq ten "AR-B816" sc 10.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "GD1")
(progn
(setq ten "FLGSTONE" sc 500.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "GL")
(progn
(setq ten "NET" sc 1500.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "GL1")
(progn
(setq ten "ANGLE" sc 700.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "GL2")
(progn
(setq ten "AR-HBONE" sc 20.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "D")
(progn
(setq ten "HOUND" sc 500.0 ang 45.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "D1")
(progn
(setq ten "EARTH" sc 500.0 ang 45.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "C")
(progn
(setq ten "AR-SAND" sc 20.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "K")
(progn
(setq ten "AR-RROOF" sc 500.0 ang 45.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "N")
(progn
(setq ten "AR-RSHKE" sc 30.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "N1")
(progn
(setq ten "SPANTILE" sc 400.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "TO")
(progn
(setq ten "ANSI32" sc 200.0 ang 45.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "GO")
(progn
(setq ten "WOOD8" sc 700.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
(if (= ans "GO1")
(progn
(setq ten "WOOD2" sc 500.0 ang 0.0)
(if (= ansp "P")
(progn
(while (setq p (getpoint "\n Chon 1 diem trong vung can hatch :"))
(lh1 p ten sc ang)
)
)
(progn
(princ "\n Chon doi tuong can hatch :")
(while (setq dt (ssget) )
(lh dt ten sc ang)
)
)
)
)
)
;);WHILE
(princ)
)
;;;;;;;;
(defun lh1(p name tle goc)
(setvar "hpgaptol" 50.0)
(vl-cmdf "bhatch" "P" name tle goc p "")
)
;;;;;;;;;;
(defun lh(dt name tle goc)
(setvar "hpgaptol" 50.0)
(vl-cmdf "bhatch" "P" name tle goc "S" dt "" "")
) 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 #436997 để đọc hướng dẫn và trao đổi thêm.