phôi cửa sổ 3D
Đấy là phôi của 1 cửa sổ 3D. Các bạn có thể phát triển thêm chi tiết tuỳ khả năng.
minh hoạ
https://www.cadviet.com/upfiles/3/cs.jpg
minh hoạ
https://www.cadviet.com/upfiles/3/cs.jpg
Tệp .lsp gốc không còn trên máy chủ. Hãy chép mã nguồn bên dưới (lấy từ bài viết gốc) vào một tệp văn bản, lưu với đuôi .lsp.
Cách dùng
- Chép mã nguồn, lưu thành tệp 153374_cs.lsp.
- 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 CS để chạy lisp.
Mã nguồn 153374_cs.lsp (trích từ bài viết gốc)
(defun c:cs()
(setq oldos (getvar "osmode"))
(setvar "osmode" 0)
(setq p1 (getpoint "\nChon diem chen cua: ")
dr (getreal "\nNhap rong cua: ")
dd (getreal "\nNhap dai cua: ")
p2 (polar p1 0 dr)
p3 (polar p2 (/ pi 2) dd)
p31 (list(-(car p3)60)(-(cadr p3)60)0.0)
p11 (list(+(car p1)60)(-(cadr p3)400)0.0)
p12 (list(+(car p1)60)(+(cadr p1)60)0.0)
p32 (list(car p31)(-(cadr p11)60)0.0)
p311 (list(+(car p32)10)(+(cadr p32)10)0.0)
p111 (list(-(car p12)10)(-(cadr p12)10)0.0)
p312 (list(+(car p31)10)(+(cadr p31)10)0.0)
p112 (list(-(car p11)10)(-(cadr p11)10)0.0)
p321 (list(-(car p311)100)(-(cadr p311)100)0.0)
p121 (list(+(car p111)100)(+(cadr p111)100)0.0)
p322 (list(-(car p312)100)(-(cadr p312)100)0.0)
p122 (list(+(car p112)100)(+(cadr p112)100)0.0)
)
(command "rectang" p1 p3)
(command "extrude" (entlast) "" 250)
(setq el1 (entlast))
(command "rectang" p11 p31)
(command "extrude" (entlast) "" 250)
(setq el2 (entlast))
(command "rectang" p12 p32)
(command "extrude" (entlast) "" 250)
(setq el3 (entlast))
(command "subtract" el1 "" el2 el3 "")
(setq el4 (entlast))
(command "rectang" p311 p111)
(command "extrude" (entlast) "" 50)
(setq el5 (entlast))
(command "rectang" p312 p112)
(command "extrude" (entlast) "" 50)
(setq el6 (entlast))
(command "subtract" el4 "" el5 el6 "")
(command "rectang" p311 p111)
(command "extrude" (entlast) "" 50)
(setq el5 (entlast))
(command "rectang" p312 p112)
(command "extrude" (entlast) "" 50)
(setq el6 (entlast))
(command "rectang" p321 p121)
(command "extrude" (entlast) "" 50)
(setq el7 (entlast))
(command "rectang" p322 p122)
(command "extrude" (entlast) "" 50)
(setq el8 (entlast))
(command "subtract" el5 el6 "" el7 el8 "")
(command "rectang" p321 p121)
(command "extrude" (entlast) "" 5)
(setq el7 (entlast))
(command "rectang" p322 p122)
(command "extrude" (entlast) "" 5)
(setq el8 (entlast))
(command "move" el7 el8 "" "0,0,0" "0,0,20")
(command "view" "swiso")
(acet-ss-zoom-extents (ssadd el4))
(command "vscurrent" "c")
(setvar "osmode" oldos)
)Thảo luận gốc
Lisp được chia sẻ trong chủ đề [Đã xong] phôi cửa sổ 3D. Xem đúng bài viết #153374 để đọc hướng dẫn và trao đổi thêm.