ZIZU
Bạn có muốn phản ứng với tin nhắn này? Vui lòng đăng ký diễn đàn trong một vài cú nhấp chuột hoặc đăng nhập để tiếp tục.


Diễn đàn giao thông
 
Trang ChínhTrang Chính  Tìm kiếmTìm kiếm  Latest imagesLatest images  Đăng kýĐăng ký  Đăng NhậpĐăng Nhập  
Đăng Nhập
Tên truy cập:
Mật khẩu:
Đăng nhập tự động mỗi khi truy cập: 
:: Quên mật khẩu
Top posters
Admin
TỔNG HỢP MỘT SỐ LISP CƠ BẢN Vote_lcapTỔNG HỢP MỘT SỐ LISP CƠ BẢN Voting_barTỔNG HỢP MỘT SỐ LISP CƠ BẢN Vote_rcap 
xhung0602
TỔNG HỢP MỘT SỐ LISP CƠ BẢN Vote_lcapTỔNG HỢP MỘT SỐ LISP CƠ BẢN Voting_barTỔNG HỢP MỘT SỐ LISP CƠ BẢN Vote_rcap 
sonmk2008
TỔNG HỢP MỘT SỐ LISP CƠ BẢN Vote_lcapTỔNG HỢP MỘT SỐ LISP CƠ BẢN Voting_barTỔNG HỢP MỘT SỐ LISP CƠ BẢN Vote_rcap 
philipdn
TỔNG HỢP MỘT SỐ LISP CƠ BẢN Vote_lcapTỔNG HỢP MỘT SỐ LISP CƠ BẢN Voting_barTỔNG HỢP MỘT SỐ LISP CƠ BẢN Vote_rcap 
TRANHOC2008
TỔNG HỢP MỘT SỐ LISP CƠ BẢN Vote_lcapTỔNG HỢP MỘT SỐ LISP CƠ BẢN Voting_barTỔNG HỢP MỘT SỐ LISP CƠ BẢN Vote_rcap 
vinhtg
TỔNG HỢP MỘT SỐ LISP CƠ BẢN Vote_lcapTỔNG HỢP MỘT SỐ LISP CƠ BẢN Voting_barTỔNG HỢP MỘT SỐ LISP CƠ BẢN Vote_rcap 
CIC.com
TỔNG HỢP MỘT SỐ LISP CƠ BẢN Vote_lcapTỔNG HỢP MỘT SỐ LISP CƠ BẢN Voting_barTỔNG HỢP MỘT SỐ LISP CƠ BẢN Vote_rcap 
vu hien
TỔNG HỢP MỘT SỐ LISP CƠ BẢN Vote_lcapTỔNG HỢP MỘT SỐ LISP CƠ BẢN Voting_barTỔNG HỢP MỘT SỐ LISP CƠ BẢN Vote_rcap 
moclantim
TỔNG HỢP MỘT SỐ LISP CƠ BẢN Vote_lcapTỔNG HỢP MỘT SỐ LISP CƠ BẢN Voting_barTỔNG HỢP MỘT SỐ LISP CƠ BẢN Vote_rcap 
cd2k44
TỔNG HỢP MỘT SỐ LISP CƠ BẢN Vote_lcapTỔNG HỢP MỘT SỐ LISP CƠ BẢN Voting_barTỔNG HỢP MỘT SỐ LISP CƠ BẢN Vote_rcap 
Latest topics
» C rack phần mềm TDT9.1
TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeSun Nov 26, 2023 4:33 pm by rong chau a

» Phần mềm cubiconst
TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeMon Nov 13, 2023 6:00 pm by Hunghoi1

»  Chuyển đổi giữa các phiên bản autocad
TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeWed Nov 01, 2023 2:16 pm by hoangphihong

» Phần mềm tdt9.1
TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeTue Aug 08, 2023 10:45 am by hoangphihong

» Chia sẻ Bộ Lisp rất hay: ”Kho báu của Minh”
TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeTue Jan 10, 2023 2:28 pm by hoangphihong

» Hướng dẫn vẽ bình đồ bằng phần mềm Sufer
TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeFri Jan 06, 2023 11:29 am by hoangphihong

»  SAN NỀN: PHẦN MỀM MIỄN PHÍ NXSOFT
TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeFri Jan 06, 2023 11:26 am by hoangphihong

» Bản tính kết cấu cống hộp theo 22TCN - 272 - 05
TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeTue Jan 03, 2023 11:09 pm by huynhcd29gtcc

» Lỗi AutoCAD Error Aborting Ads Civil
TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeTue Jan 03, 2023 1:50 pm by hoangphihong

» TẶNG KEY DPSURVEY 2.9
TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeMon Sep 07, 2020 10:58 am by longboy

Statistics
Diễn Đàn hiện có 10096 thành viên
Chúng ta cùng chào mừng thành viên mới đăng ký: Phuongkq

Tổng số bài viết đã gửi vào diễn đàn là 18519 in 3437 subjects
Keywords
topo alpha drad 2011 crack FAST toan hitosoft thiết ngang 2010 HHMAPS phan group 2016 2017 RDCAD bravo Sumac civil nova 2013 delta 2018 mapsite dcad
Social bookmarking
Social bookmarking reddit      

Bookmark and share the address of ZIZU on your social bookmarking website
LIÊN KẾT




TỔNG LƯỢT TRUY CẬP

 

 TỔNG HỢP MỘT SỐ LISP CƠ BẢN

Go down 
+13
trangkutehd
cd2k44
qkhs.live
ro88
batitus
thuancauduong
philong3112
ken"s
phuquang113
khaosat2009
philipdn
sonxaydung
Admin
17 posters
Chuyển đến trang : 1, 2  Next
Tác giảThông điệp
Admin
Admin
Admin
Admin


Nam Tổng số bài gửi : 475
Age : 46
Đến từ: : Việt Nam
Nghề nghiệp: : Kỹ sư
Ngày đăng ký : 02/03/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: TỔNG HỢP MỘT SỐ LISP CƠ BẢN   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeThu Apr 17, 2008 6:12 pm

Một bản vẽ mới được thiết lập. Vẫn những layer đó, vẫn những kiểu text đó, vẫn những kiểu dim đó...Bạn không cần thiết phải làm lại từ đầu vì quá mất thời gian. Vậy làm thế nào???

( Tất cả các LISP CODE bạn chỉ việc copy rồi save ra file cùng tên với lệnh lisp và có phần mở rộng la .LSP (ví dụ: TaoL.LSP) là ok )

Bài 1: Tạo Layer

Trích dẫn :
defun c:TaoL()
(command "layer" "m" "!tuong" "c" "2" "" "")
(command "layer" "m" "!tim" "c" "1" "" "")
(command "layer" "m" "!thay" "c" "7" "" "")
(command "layer" "m" "!noithat" "c" "8" "" "")
(command "layer" "m" "!hatch" "c" "8" "" "")
(command "layer" "m" "!chu" "c" "3" "" "")
(command "layer" "m" "!kichthuoc" "c" "8" "" "")
(princ)
)
Với lisp này lệnh để tạo layer sẽ là TaoL.

Bài 2: Tạo Text Style ( kiểu chữ )


Trích dẫn :
(defun c:TaoC()
(command "style" "!vnAvanH" ".VnAvantH" "" "" "" "" "")
(princ)
)


Với lisp này lệnh để tạo kiểu chữ sẽ là TaoC.
Bài 3: Tạo Dim Style ( kiểu kích thước )
CODE

(defun c:TaoK (/ scl fcal scal );dmasz dexo dexo dtxt dgap dclre dclrt dsn ao ad obj)
(vl-load-com)
(setq scl (getstring "\nTY LE BAN VE: "))
(setq fcal (atof (substr scl 1 1)))
(setq scal (atof (substr scl 3 3)))
(setq tyle (/ fcal scal))

(setq caochu (getint "\nCHIEU CAO CUA CHU: "))
(setvar "DIMALTF" 25)
(setvar "DIMALTTZ" 13)
(setvar "DIMALTZ" 13)
(setvar "DIMBLK" "ArchTick")
(setvar "DIMBLK1" "ArchTick")
(setvar "DIMBLK2" "ArchTick")
(setvar "DIMASZ" (/ caochu 2))
(setvar "DIMCEN" -50)
(setvar "DIMCLRD" 9)
(setvar "DIMDLE" (/ caochu 2))
(setvar "DIMTOFL" 1)
(setvar "DIMDLI" 0)
(setvar "DIMCLRE" 9)
(setvar "DIMEXE" (/ caochu 2))
(setvar "DIMEXO" 0)
(setvar "DIMTMOVE" 2)
(setvar "DIMLDRBLK" "ArchTick")
(setvar "DIMDEC" 0)
(setvar "DIMCLRT" 9)
(setvar "DIMTXT" caochu)
(setvar "DIMLFAC" TYLE)
(setvar "DIMTIX" 1)
(setvar "DIMTIH" 0)
(setvar "DIMGAP" (/ caochu 2))
(setvar "DIMTOH" 0)
(setvar "DIMTAD" 1)
(setvar "DIMTXSTY" "!vnAvanH")
(setvar "DIMTDEC" 0)
(setvar "DIMTZIN" 13)
(setvar "DIMZIN" 13)
;-------------------------------------------------------------
(setq dsn (getstring "\nTEN CUA KIEU DIM MOI: "))
(setq ao (vlax-get-acad-object))
(setq ad (vla-get-ActiveDocument ao))
(setq obj (vla-add (vla-get-dimstyles ad) dsn))
(vla-copyfrom Obj ad)
(vla-put-activedimstyle ad Obj)
(princ)
)

Với lisp này lệnh để tạo kiểu kích thước sẽ là TaoK.
Các thông số cần nhập
1. Tỷ lệ bản vẽ: (Thường là 1/1, cũng có thể là 1/2 tùy vào kiểu dim bạn muốn tạo)
2. Chiều cao chữ: (Tùy thuộc vào bản vẽ của bạn)
3. Tên kiểu dim mới: (Nên đặt theo chiều cao của chữ)
Xong phần khởi động. Giờ là bắt đấu vẽ với LINE, với ARC...
- Ồ! những đường Line này sao không phải là PLINE nhỉ? Vừa dễ quản lý vừa nhẹ bản vẽ. Phải làm sao đây? BO lại à ? OH không !!!

Bài 4. Nối LINE và ARC thành PLINE

Trích dẫn :
(defun c:nn (/ tdt ssdt sodt index)
(defun ObjName (ssdt /)
(cdr (assoc '0 (entget ssdt)))
)
(defun MoPL (ssdt /)
(= (cdr (assoc '70 (entget ssdt))) 0)
)
(defun NoiPL (ssdt /)
(if (MoPL ssdt)
(command ".PEDIT" ssdt "J" "All" "" "X")
)
)
(defun NoiLC (ssdt /)
(command ".PEDIT" ssdt "Y" "J" "All" "" "X")
)
(setq
tdt (ssget)
sodt (sslength tdt)
index 0
)
(repeat sodt
(setq
ssdt (ssname tdt index)
index (1+ index)
)
(if (or (= (Objname ssdt) "LWPOLYLINE")
(= (Objname ssdt) "POLYLINE")
)
(NoiPL ssdt)
)
(if (or (= (Objname ssdt) "LINE") (= (Objname ssdt) "ARC"))
(NoiLC ssdt)
)
)
(princ)
)

Lệnh để nối LINE và ARC thành PLINE là nn
Nhanh quá! Cái lisp NN kia giúp tôi đỡ được bao nhiêu công khi phải BO line thanh PLINE.

Giờ đến vễ cửa, cửa đi, cửa sổ... nhiều quá. Copy từ thư viện ra thì lại phải SCALE rồi làng nhằng LAYER không đúng với bản vẽ của mình ! Vậy thì co cách nào không nhỉ?

(CADVIET)
Về Đầu Trang Go down
https://zizu.forumvi.com
Admin
Admin
Admin
Admin


Nam Tổng số bài gửi : 475
Age : 46
Đến từ: : Việt Nam
Nghề nghiệp: : Kỹ sư
Ngày đăng ký : 02/03/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Tiếp theo   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeThu Apr 17, 2008 6:15 pm

Bài 5: Vẽ cửa đi


;-------------------------------------------------------------------------------------
;ve cua di 1 canh
;-------------------------------------------------------------------------------------
Trích dẫn :

(defun c:c1 (/ p1 p2 p3 p4 p5 daicua x y)
(setq osm (getvar "osmode"))
(setq p1 (getpoint "\nHay vao diem goc cua: ")

p2 (getpoint p1 "\nHay vao diem mut cua: ")
p3 (getpoint p1 "\nHay vao huong cua: ")
daicua (distance p1 p2)
x (car p1)
y (car (cdr p1))
x 25
y daicua
p4 (list x y)
p5 (list daicua 0)
)
(setvar "OSMODE" 0)
(if (l3d_khongthanghang p1 p2 p3)
(progn
(command ".UCS" "3" p1 p2 p3)
(command ".rectangle" "0,0" p4)
(command ".Arc" p5 "C" "0,0" p4)
(command ".UCS" "P")
)
(princ "\n3 diem nhap vao khong duoc thang hang")
)
(setvar "osmode" osm)
)
;-------------------------------------------------------------------------------------
;ve cua di 2 canh
;-------------------------------------------------------------------------------------

Trích dẫn :

(defun c:c2 (/ p1 p2 p3 p4 p5 daicua x y)
(setq osm (getvar "osmode"))
(setq p1 (getpoint "\nHay vao diem goc cua: ")
p2 (getpoint p1 "\nHay vao diem mut cua: ")
p3 (getpoint p1 "\nHay vao huong cua: ")
daicua (/ (distance p1 p2) 2.0)
x (car p1)
y (car (cdr p1))
x 25
y daicua
p4 (list x y)
p5 (list daicua 0)
)
(setvar "OSMODE" 0)
(if (l3d_khongthanghang p1 p2 p3)
(progn
(command ".UCS" "3" p1 p2 p3)
(command ".rectangle" "0,0" p4)
(command ".Arc" p5 "C" "0,0" p4)
(command ".UCS" "P")

(command ".UCS" "3" p2 p1 p3)
(command ".rectangle" "0,0" p4)
(command ".Arc" p5 "C" "0,0" p4)
(command ".UCS" "P")

)

(princ "\n3 diem nhap vao khong duoc thang hang")
)
(setvar "osmode" osm)
)
;-------------------------------------------------------------------------------------
;ve cua di 4 canh
;-------------------------------------------------------------------------------------

Trích dẫn :

(defun c:c4 (/ p1 p2 p3 p4 p5 daicua x y)
(setq osm (getvar "osmode"))
(setq p1 (getpoint "\nHay vao diem goc cua: ")
p2 (getpoint p1 "\nHay vao diem mut cua: ")
p3 (getpoint p1 "\nHay vao huong cua: ")
daicua (/ (distance p1 p2) 4.0)
x (car p1)
y (car (cdr p1))
x 25
y daicua
p4 (list x y)
p5 (list daicua 0)
)
(setvar "OSMODE" 0)
(if (l3d_khongthanghang p1 p2 p3)
(progn

(setq diem1 (diemgiua p1 (diemgiua p1 p2)))
(setq diem2 (diemgiua p1 p2))
(setq diem3 (diemgiua p2 (diemgiua p1 p2)))

(command ".UCS" "3" p1 p2 p3)
(command ".rectangle" "0,0" p4)
(command ".Arc" p5 "C" "0,0" p4)
(command ".UCS" "P")

(command ".UCS" "3" diem1 p2 p3)
(command ".rectangle" "0,0" p4)
(command ".Arc" p5 "C" "0,0" p4)
(command ".UCS" "P")

(command ".UCS" "3" p2 p1 p3)
(command ".rectangle" "0,0" p4)
(command ".Arc" p5 "C" "0,0" p4)
(command ".UCS" "P")

(command ".UCS" "3" diem3 p1 p3)
(command ".rectangle" "0,0" p4)
(command ".Arc" p5 "C" "0,0" p4)
(command ".UCS" "P")

)

(princ "\n3 diem nhap vao khong duoc thang hang")
)
(setvar "osmode" osm)
)
;-----------------------------------------------------------------------------


Có 3 lệnh trong lisp này.
c1: vẽ cửa đi 1 cánh
c2: vẽ cửa đi 2 cánh
c4: vẽ cửa đi 4 cánh

Thế còn cửa sổ thì sao nhỉ ?
Về Đầu Trang Go down
https://zizu.forumvi.com
Admin
Admin
Admin
Admin


Nam Tổng số bài gửi : 475
Age : 46
Đến từ: : Việt Nam
Nghề nghiệp: : Kỹ sư
Ngày đăng ký : 02/03/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Tiếp theo   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeThu Apr 17, 2008 6:16 pm

Bài 6: Vẽ cửa sổ

Trích dẫn :

(defun c:w1(/ data_m l1 l2 p1 p2 check)

(defun wd_import(/ p3 p4 p5 p6)
(setq data_m (ssget))
(setq p1 (getpoint "\nfirst point :") p2 (getpoint "\nsecond point :"))
(setq l1 nil l2 nil check 1)
(if (not (= nil data_m)) (progn
(setq l1 (entget (ssname data_m 0)))
(setq l2 (entget (ssname data_m 1)))
(if (or (= nil l1) (not (= "LINE" (cdr (assoc 0 l1))))) (setq check 0))
(if (or (= nil l2) (not (= "LINE" (cdr (assoc 0 l2))))) (setq check 0))
(if (not (= 0 (-(sslength data_m) 2))) (setq check 0))
(if (= 1 check) (progn
(setq p3 (cdr (assoc 10 l1))) (setq p3 (list (nth 0 p3) (nth 1 p3)))
(setq p4 (cdr (assoc 11 l1))) (setq p4 (list (nth 0 p4) (nth 1 p4)))
(setq p5 (cdr (assoc 10 l2))) (setq p5 (list (nth 0 p5) (nth 1 p5)))
(setq p6 (cdr (assoc 11 l2))) (setq p6 (list (nth 0 p6) (nth 1 p6)))
(if (not (= nil (inters p3 p4 p5 p6 nil))) (setq check 0))
))
) (setq check 0))
(princ)
)

(defun wd_procced()

(defun mkv(/ p3 p4 p5 p6 p7 p8 p9 ls1 ls2 getom ll1)

(setq p3 (cdr (assoc 10 l1)))
(setq p4 (cdr (assoc 11 l1)))
(setq p5 (cdr (assoc 10 l2)))
(setq p6 (cdr (assoc 11 l2)))
(if (> (abs (- (nth 1 p1) (nth 1 p3)))
(abs (- (nth 1 p3) (nth 1 p4))) ) (setq check 0))
(if (> (abs (- (nth 1 p1) (nth 1 p4)))
(abs (- (nth 1 p3) (nth 1 p4))) ) (setq check 0))
(if (> (abs (- (nth 1 p2) (nth 1 p5)))
(abs (- (nth 1 p5) (nth 1 p6))) ) (setq check 0))
(if (> (abs (- (nth 1 p2) (nth 1 p6)))
(abs (- (nth 1 p5) (nth 1 p6))) ) (setq check 0))
(if (= 0 check) (princ "\ninvalid data") (progn
(setq ls1 (arlst (list (nth 1 p1) (nth 1 p2) (nth 1 p3) (nth 1 p4) )))
; (princ ls1)
(setq p7 (list (nth 0 p3) (nth 0 ls1) 0))
(setq p8 (list (nth 0 p3) (nth 1 ls1) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 0 p3) (nth 2 ls1) 0))
(setq p8 (list (nth 0 p3) (nth 3 ls1) 0))
(mkline p7 p8 l1)

(setq ls1 (arlst (list (nth 1 p1) (nth 1 p2) (nth 1 p5) (nth 1 p6) )))
; (princ ls1)
(setq p7 (list (nth 0 p5) (nth 0 ls1) 0))
(setq p8 (list (nth 0 p5) (nth 1 ls1) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 0 p5) (nth 2 ls1) 0))
(setq p8 (list (nth 0 p5) (nth 3 ls1) 0))
(mkline p7 p8 l1)

(setq p7 (list (nth 0 p3) (nth 1 ls1) 0))
(setq p8 (list (nth 0 p5) (nth 1 ls1) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 0 p3) (nth 2 ls1) 0))
(setq p8 (list (nth 0 p5) (nth 2 ls1) 0))
(mkline p7 p8 l1)

(setq getom (getvar "osmode"))
(setvar "osmode" 0)

(setq ls2 (arlst (list (nth 0 p3) (nth 0 p5))))
(setq p7 (list (nth 0 ls2) (nth 1 ls1) 0))
(setq p8 (list (nth 1 ls2) (nth 2 ls1) 0))

(setq ll1 (list
(cons 0 "line")
(cons 8 (getvar "clayer"))
))

(drawrt2 p7 p8 ll1)

(setvar "osmode" getom)
(command "erase" data_m "")

))
(princ)
)

(defun mkh(/ p3 p4 p5 p6 p7 p8 p9 ls1 ls2 getom ll1)

(setq p3 (cdr (assoc 10 l1)))
(setq p4 (cdr (assoc 11 l1)))
(setq p5 (cdr (assoc 10 l2)))
(setq p6 (cdr (assoc 11 l2)))

(if (> (abs (- (nth 0 p1) (nth 0 p3)))
(abs (- (nth 0 p3) (nth 0 p4))) ) (setq check 0))
(if (> (abs (- (nth 0 p1) (nth 0 p4)))
(abs (- (nth 0 p3) (nth 0 p4))) ) (setq check 0))
(if (> (abs (- (nth 0 p2) (nth 0 p5)))
(abs (- (nth 0 p5) (nth 0 p6))) ) (setq check 0))
(if (> (abs (- (nth 0 p2) (nth 0 p6)))
(abs (- (nth 0 p5) (nth 0 p6))) ) (setq check 0))

(if (= 0 check) (princ "\ninvalid data") (progn

(setq ls1 (arlst (list (nth 0 p1) (nth 0 p2) (nth 0 p3) (nth 0 p4) )))
; (princ ls1)
(setq p7 (list (nth 0 ls1) (nth 1 p3) 0))
(setq p8 (list (nth 1 ls1) (nth 1 p3) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 2 ls1) (nth 1 p3) 0))
(setq p8 (list (nth 3 ls1) (nth 1 p3) 0))
(mkline p7 p8 l1)

(setq ls1 (arlst (list (nth 0 p1) (nth 0 p2) (nth 0 p5) (nth 0 p6) )))
; (princ ls1)
(setq p7 (list (nth 0 ls1) (nth 1 p5) 0))
(setq p8 (list (nth 1 ls1) (nth 1 p5) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 2 ls1) (nth 1 p5) 0))
(setq p8 (list (nth 3 ls1) (nth 1 p5) 0))
(mkline p7 p8 l1)

(setq p7 (list (nth 1 ls1) (nth 1 p3) 0))
(setq p8 (list (nth 1 ls1) (nth 1 p5) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 2 ls1) (nth 1 p3) 0))
(setq p8 (list (nth 2 ls1) (nth 1 p5) 0))
(mkline p7 p8 l1)

(setq getom (getvar "osmode"))
(setvar "osmode" 0)

(setq ls2 (arlst (list (nth 1 p3) (nth 1 p5))))
(setq p7 (list (nth 1 ls1) (nth 0 ls2) 0))
(setq p8 (list (nth 2 ls1) (nth 1 ls2) 0))

(setq ll1 (list
(cons 0 "line")
(cons 8 (getvar "clayer"))
))

(drawrt3 p7 p8 ll1)

(setvar "osmode" getom)
(command "erase" data_m "")


))
(princ)
)

(setvar "cmdecho" 0) (command "undo" "mark") (setvar "cmdecho" 1)
(if (= 0 check) (princ "\ninvalid data") (progn
(if (< (abs (- (nth 0 (cdr (assoc 10 l1)))
(nth 0 (cdr (assoc 11 l1))) )) 0.00001) (mkv))
(if (< (abs (- (nth 1 (cdr (assoc 10 l1)))
(nth 1 (cdr (assoc 11 l1))) )) 0.00001) (mkh))


))

(princ)

)
(wd_import)
(ai_undo_push)
(wd_procced)
(ai_undo_pop)
)


(defun c:w2(/ data_m l1 l2 p1 p2 check)

(defun wd_import(/ p3 p4 p5 p6)
(setq data_m (ssget))
(setq p1 (getpoint "\nfirst point :") p2 (getpoint "\nsecond point :"))
(setq l1 nil l2 nil check 1)
(if (not (= nil data_m)) (progn
(setq l1 (entget (ssname data_m 0)))
(setq l2 (entget (ssname data_m 1)))
(if (or (= nil l1) (not (= "LINE" (cdr (assoc 0 l1))))) (setq check 0))
(if (or (= nil l2) (not (= "LINE" (cdr (assoc 0 l2))))) (setq check 0))
(if (not (= 0 (-(sslength data_m) 2))) (setq check 0))
(if (= 1 check) (progn
(setq p3 (cdr (assoc 10 l1))) (setq p3 (list (nth 0 p3) (nth 1 p3)))
(setq p4 (cdr (assoc 11 l1))) (setq p4 (list (nth 0 p4) (nth 1 p4)))
(setq p5 (cdr (assoc 10 l2))) (setq p5 (list (nth 0 p5) (nth 1 p5)))
(setq p6 (cdr (assoc 11 l2))) (setq p6 (list (nth 0 p6) (nth 1 p6)))
(if (not (= nil (inters p3 p4 p5 p6 nil))) (setq check 0))
))
) (setq check 0))
(princ)
)

(defun wd_procced()

(defun mkv(/ p3 p4 p5 p6 p7 p8 p9 ls1 ls2 getom ll1)

(setq p3 (cdr (assoc 10 l1)))
(setq p4 (cdr (assoc 11 l1)))
(setq p5 (cdr (assoc 10 l2)))
(setq p6 (cdr (assoc 11 l2)))
(if (> (abs (- (nth 1 p1) (nth 1 p3)))
(abs (- (nth 1 p3) (nth 1 p4))) ) (setq check 0))
(if (> (abs (- (nth 1 p1) (nth 1 p4)))
(abs (- (nth 1 p3) (nth 1 p4))) ) (setq check 0))
(if (> (abs (- (nth 1 p2) (nth 1 p5)))
(abs (- (nth 1 p5) (nth 1 p6))) ) (setq check 0))
(if (> (abs (- (nth 1 p2) (nth 1 p6)))
(abs (- (nth 1 p5) (nth 1 p6))) ) (setq check 0))
(if (= 0 check) (princ "\ninvalid data") (progn
(setq ls1 (arlst (list (nth 1 p1) (nth 1 p2) (nth 1 p3) (nth 1 p4) )))
; (princ ls1)
(setq p7 (list (nth 0 p3) (nth 0 ls1) 0))
(setq p8 (list (nth 0 p3) (nth 1 ls1) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 0 p3) (nth 2 ls1) 0))
(setq p8 (list (nth 0 p3) (nth 3 ls1) 0))
(mkline p7 p8 l1)

(setq ls1 (arlst (list (nth 1 p1) (nth 1 p2) (nth 1 p5) (nth 1 p6) )))
; (princ ls1)
(setq p7 (list (nth 0 p5) (nth 0 ls1) 0))
(setq p8 (list (nth 0 p5) (nth 1 ls1) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 0 p5) (nth 2 ls1) 0))
(setq p8 (list (nth 0 p5) (nth 3 ls1) 0))
(mkline p7 p8 l1)

(setq p7 (list (nth 0 p3) (nth 1 ls1) 0))
(setq p8 (list (nth 0 p5) (nth 1 ls1) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 0 p3) (nth 2 ls1) 0))
(setq p8 (list (nth 0 p5) (nth 2 ls1) 0))
(mkline p7 p8 l1)

(setq ls2 (arlst (list (nth 0 p3) (nth 0 p5))))

(setq ll1 (list
(cons 0 "line")
(cons 8 (getvar "clayer"))
))

(if (< (nth 0 p1) (nth 0 ls2)) (progn
(setq p7 (list (nth 0 ls2) (nth 1 ls1) 0))
(setq p8 (list (nth 1 ls2) (nth 2 ls1) 0))
(setq p7 (list (* (+ (nth 0 p7) (nth 0 p8)) 0.5) (nth 1 p7) 0))
(drawrt2 p7 p8 ll1)

(setq p7 (list (- (nth 0 ls2) 70) (- (nth 1 ls1) 100) 0))
(setq p8 (list (- (nth 0 ls2) 70) (+ (nth 2 ls1) 100) 0))
(mkline p7 p8 ll1)

(setq p9 (list (+ (nth 0 p7) 70) (nth 1 p7) 0))
(mkline p7 p9 ll1)

(setq p9 (list (+ (nth 0 p8) 70) (nth 1 p8) 0))
(mkline p8 p9 ll1)
)(progn
(setq p7 (list (nth 0 ls2) (nth 1 ls1) 0))
(setq p8 (list (nth 1 ls2) (nth 2 ls1) 0))
(setq p8 (list (* (+ (nth 0 p7) (nth 0 p8)) 0.5) (nth 1 p8) 0))
(drawrt2 p7 p8 ll1)

(setq p7 (list (+ (nth 1 ls2) 70) (- (nth 1 ls1) 100) 0))
(setq p8 (list (+ (nth 1 ls2) 70) (+ (nth 2 ls1) 100) 0))
(mkline p7 p8 ll1)

(setq p9 (list (- (nth 0 p7) 70) (nth 1 p7) 0))
(mkline p7 p9 ll1)

(setq p9 (list (- (nth 0 p8) 70) (nth 1 p8) 0))
(mkline p8 p9 ll1)
))


(command "erase" data_m "")

))
(princ)
)

(defun mkh(/ p3 p4 p5 p6 p7 p8 p9 ls1 ls2 getom ll1)

(setq p3 (cdr (assoc 10 l1)))
(setq p4 (cdr (assoc 11 l1)))
(setq p5 (cdr (assoc 10 l2)))
(setq p6 (cdr (assoc 11 l2)))

(if (> (abs (- (nth 0 p1) (nth 0 p3)))
(abs (- (nth 0 p3) (nth 0 p4))) ) (setq check 0))
(if (> (abs (- (nth 0 p1) (nth 0 p4)))
(abs (- (nth 0 p3) (nth 0 p4))) ) (setq check 0))
(if (> (abs (- (nth 0 p2) (nth 0 p5)))
(abs (- (nth 0 p5) (nth 0 p6))) ) (setq check 0))
(if (> (abs (- (nth 0 p2) (nth 0 p6)))
(abs (- (nth 0 p5) (nth 0 p6))) ) (setq check 0))

(if (= 0 check) (princ "\ninvalid data") (progn

(setq ls1 (arlst (list (nth 0 p1) (nth 0 p2) (nth 0 p3) (nth 0 p4) )))
; (princ ls1)
(setq p7 (list (nth 0 ls1) (nth 1 p3) 0))
(setq p8 (list (nth 1 ls1) (nth 1 p3) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 2 ls1) (nth 1 p3) 0))
(setq p8 (list (nth 3 ls1) (nth 1 p3) 0))
(mkline p7 p8 l1)

(setq ls1 (arlst (list (nth 0 p1) (nth 0 p2) (nth 0 p5) (nth 0 p6) )))
; (princ ls1)
(setq p7 (list (nth 0 ls1) (nth 1 p5) 0))
(setq p8 (list (nth 1 ls1) (nth 1 p5) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 2 ls1) (nth 1 p5) 0))
(setq p8 (list (nth 3 ls1) (nth 1 p5) 0))
(mkline p7 p8 l1)

(setq p7 (list (nth 1 ls1) (nth 1 p3) 0))
(setq p8 (list (nth 1 ls1) (nth 1 p5) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 2 ls1) (nth 1 p3) 0))
(setq p8 (list (nth 2 ls1) (nth 1 p5) 0))
(mkline p7 p8 l1)

(setq getom (getvar "osmode"))
(setvar "osmode" 0)

(setq ll1 (list
(cons 0 "line")
(cons 8 (getvar "clayer"))
))
(setq ls2 (arlst (list (nth 1 p3) (nth 1 p5))))
;(princ ls2)

(if (> (nth 1 p1) (nth 1 ls2)) (progn

(setq p7 (list (nth 1 ls1) (nth 0 ls2) 0))
(setq p8 (list (nth 2 ls1) (nth 1 ls2) 0))
(setq p8 (list (nth 2 ls1) (* (+ (nth 1 p7) (nth 1 p8)) 0.5) 0))

(drawrt3 p7 p8 ll1)

(setq p7 (list (- (nth 1 ls1) 100) (+ (nth 1 ls2) 70) 0))
(setq p8 (list (+ (nth 2 ls1) 100) (+ (nth 1 ls2) 70) 0))
(mkline p7 p8 ll1)

(setq p9 (list (nth 0 p7) (- (nth 1 p7) 70) 0))
(mkline p7 p9 ll1)

(setq p9 (list (nth 0 p8) (- (nth 1 p8) 70) 0))
(mkline p8 p9 ll1)
)(progn
(setq p7 (list (nth 1 ls1) (nth 0 ls2) 0))
(setq p8 (list (nth 2 ls1) (nth 1 ls2) 0))
(setq p7 (list (nth 1 ls1) (* (+ (nth 1 p7) (nth 1 p8)) 0.5) 0))

(drawrt3 p7 p8 ll1)


(setq p7 (list (- (nth 1 ls1) 100) (- (nth 0 ls2) 70) 0))
(setq p8 (list (+ (nth 2 ls1) 100) (- (nth 0 ls2) 70) 0))
(mkline p7 p8 ll1)

(setq p9 (list (nth 0 p7) (+ (nth 1 p7) 70) 0))
(mkline p7 p9 ll1)

(setq p9 (list (nth 0 p8) (+ (nth 1 p8) 70) 0))
(mkline p8 p9 ll1)


))

(setvar "osmode" getom)

(command "erase" data_m "")


))
(princ)
)

(setvar "cmdecho" 0) (command "undo" "mark") (setvar "cmdecho" 1)
(if (= 0 check) (princ "\ninvalid data") (progn
(if (< (abs (- (nth 0 (cdr (assoc 10 l1)))
(nth 0 (cdr (assoc 11 l1))) )) 0.00001) (mkv))
(if (< (abs (- (nth 1 (cdr (assoc 10 l1)))
(nth 1 (cdr (assoc 11 l1))) )) 0.00001) (mkh))


))

(princ)

)
(wd_import)
(wd_procced)
)

Có 2 lệnh trong lisp này.
w1: vẽ cửa sổ kiểu 1
w2: vẽ cửa sổ kiểu 2
Về Đầu Trang Go down
https://zizu.forumvi.com
Admin
Admin
Admin
Admin


Nam Tổng số bài gửi : 475
Age : 46
Đến từ: : Việt Nam
Nghề nghiệp: : Kỹ sư
Ngày đăng ký : 02/03/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Tiếp theo   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeThu Apr 17, 2008 6:17 pm

Bài 6: Vẽ cửa sổ

Trích dẫn :

(defun c:w1(/ data_m l1 l2 p1 p2 check)

(defun wd_import(/ p3 p4 p5 p6)
(setq data_m (ssget))
(setq p1 (getpoint "\nfirst point :") p2 (getpoint "\nsecond point :"))
(setq l1 nil l2 nil check 1)
(if (not (= nil data_m)) (progn
(setq l1 (entget (ssname data_m 0)))
(setq l2 (entget (ssname data_m 1)))
(if (or (= nil l1) (not (= "LINE" (cdr (assoc 0 l1))))) (setq check 0))
(if (or (= nil l2) (not (= "LINE" (cdr (assoc 0 l2))))) (setq check 0))
(if (not (= 0 (-(sslength data_m) 2))) (setq check 0))
(if (= 1 check) (progn
(setq p3 (cdr (assoc 10 l1))) (setq p3 (list (nth 0 p3) (nth 1 p3)))
(setq p4 (cdr (assoc 11 l1))) (setq p4 (list (nth 0 p4) (nth 1 p4)))
(setq p5 (cdr (assoc 10 l2))) (setq p5 (list (nth 0 p5) (nth 1 p5)))
(setq p6 (cdr (assoc 11 l2))) (setq p6 (list (nth 0 p6) (nth 1 p6)))
(if (not (= nil (inters p3 p4 p5 p6 nil))) (setq check 0))
))
) (setq check 0))
(princ)
)

(defun wd_procced()

(defun mkv(/ p3 p4 p5 p6 p7 p8 p9 ls1 ls2 getom ll1)

(setq p3 (cdr (assoc 10 l1)))
(setq p4 (cdr (assoc 11 l1)))
(setq p5 (cdr (assoc 10 l2)))
(setq p6 (cdr (assoc 11 l2)))
(if (> (abs (- (nth 1 p1) (nth 1 p3)))
(abs (- (nth 1 p3) (nth 1 p4))) ) (setq check 0))
(if (> (abs (- (nth 1 p1) (nth 1 p4)))
(abs (- (nth 1 p3) (nth 1 p4))) ) (setq check 0))
(if (> (abs (- (nth 1 p2) (nth 1 p5)))
(abs (- (nth 1 p5) (nth 1 p6))) ) (setq check 0))
(if (> (abs (- (nth 1 p2) (nth 1 p6)))
(abs (- (nth 1 p5) (nth 1 p6))) ) (setq check 0))
(if (= 0 check) (princ "\ninvalid data") (progn
(setq ls1 (arlst (list (nth 1 p1) (nth 1 p2) (nth 1 p3) (nth 1 p4) )))
; (princ ls1)
(setq p7 (list (nth 0 p3) (nth 0 ls1) 0))
(setq p8 (list (nth 0 p3) (nth 1 ls1) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 0 p3) (nth 2 ls1) 0))
(setq p8 (list (nth 0 p3) (nth 3 ls1) 0))
(mkline p7 p8 l1)

(setq ls1 (arlst (list (nth 1 p1) (nth 1 p2) (nth 1 p5) (nth 1 p6) )))
; (princ ls1)
(setq p7 (list (nth 0 p5) (nth 0 ls1) 0))
(setq p8 (list (nth 0 p5) (nth 1 ls1) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 0 p5) (nth 2 ls1) 0))
(setq p8 (list (nth 0 p5) (nth 3 ls1) 0))
(mkline p7 p8 l1)

(setq p7 (list (nth 0 p3) (nth 1 ls1) 0))
(setq p8 (list (nth 0 p5) (nth 1 ls1) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 0 p3) (nth 2 ls1) 0))
(setq p8 (list (nth 0 p5) (nth 2 ls1) 0))
(mkline p7 p8 l1)

(setq getom (getvar "osmode"))
(setvar "osmode" 0)

(setq ls2 (arlst (list (nth 0 p3) (nth 0 p5))))
(setq p7 (list (nth 0 ls2) (nth 1 ls1) 0))
(setq p8 (list (nth 1 ls2) (nth 2 ls1) 0))

(setq ll1 (list
(cons 0 "line")
(cons 8 (getvar "clayer"))
))

(drawrt2 p7 p8 ll1)

(setvar "osmode" getom)
(command "erase" data_m "")

))
(princ)
)

(defun mkh(/ p3 p4 p5 p6 p7 p8 p9 ls1 ls2 getom ll1)

(setq p3 (cdr (assoc 10 l1)))
(setq p4 (cdr (assoc 11 l1)))
(setq p5 (cdr (assoc 10 l2)))
(setq p6 (cdr (assoc 11 l2)))

(if (> (abs (- (nth 0 p1) (nth 0 p3)))
(abs (- (nth 0 p3) (nth 0 p4))) ) (setq check 0))
(if (> (abs (- (nth 0 p1) (nth 0 p4)))
(abs (- (nth 0 p3) (nth 0 p4))) ) (setq check 0))
(if (> (abs (- (nth 0 p2) (nth 0 p5)))
(abs (- (nth 0 p5) (nth 0 p6))) ) (setq check 0))
(if (> (abs (- (nth 0 p2) (nth 0 p6)))
(abs (- (nth 0 p5) (nth 0 p6))) ) (setq check 0))

(if (= 0 check) (princ "\ninvalid data") (progn

(setq ls1 (arlst (list (nth 0 p1) (nth 0 p2) (nth 0 p3) (nth 0 p4) )))
; (princ ls1)
(setq p7 (list (nth 0 ls1) (nth 1 p3) 0))
(setq p8 (list (nth 1 ls1) (nth 1 p3) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 2 ls1) (nth 1 p3) 0))
(setq p8 (list (nth 3 ls1) (nth 1 p3) 0))
(mkline p7 p8 l1)

(setq ls1 (arlst (list (nth 0 p1) (nth 0 p2) (nth 0 p5) (nth 0 p6) )))
; (princ ls1)
(setq p7 (list (nth 0 ls1) (nth 1 p5) 0))
(setq p8 (list (nth 1 ls1) (nth 1 p5) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 2 ls1) (nth 1 p5) 0))
(setq p8 (list (nth 3 ls1) (nth 1 p5) 0))
(mkline p7 p8 l1)

(setq p7 (list (nth 1 ls1) (nth 1 p3) 0))
(setq p8 (list (nth 1 ls1) (nth 1 p5) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 2 ls1) (nth 1 p3) 0))
(setq p8 (list (nth 2 ls1) (nth 1 p5) 0))
(mkline p7 p8 l1)

(setq getom (getvar "osmode"))
(setvar "osmode" 0)

(setq ls2 (arlst (list (nth 1 p3) (nth 1 p5))))
(setq p7 (list (nth 1 ls1) (nth 0 ls2) 0))
(setq p8 (list (nth 2 ls1) (nth 1 ls2) 0))

(setq ll1 (list
(cons 0 "line")
(cons 8 (getvar "clayer"))
))

(drawrt3 p7 p8 ll1)

(setvar "osmode" getom)
(command "erase" data_m "")


))
(princ)
)

(setvar "cmdecho" 0) (command "undo" "mark") (setvar "cmdecho" 1)
(if (= 0 check) (princ "\ninvalid data") (progn
(if (< (abs (- (nth 0 (cdr (assoc 10 l1)))
(nth 0 (cdr (assoc 11 l1))) )) 0.00001) (mkv))
(if (< (abs (- (nth 1 (cdr (assoc 10 l1)))
(nth 1 (cdr (assoc 11 l1))) )) 0.00001) (mkh))


))

(princ)

)
(wd_import)
(ai_undo_push)
(wd_procced)
(ai_undo_pop)
)


(defun c:w2(/ data_m l1 l2 p1 p2 check)

(defun wd_import(/ p3 p4 p5 p6)
(setq data_m (ssget))
(setq p1 (getpoint "\nfirst point :") p2 (getpoint "\nsecond point :"))
(setq l1 nil l2 nil check 1)
(if (not (= nil data_m)) (progn
(setq l1 (entget (ssname data_m 0)))
(setq l2 (entget (ssname data_m 1)))
(if (or (= nil l1) (not (= "LINE" (cdr (assoc 0 l1))))) (setq check 0))
(if (or (= nil l2) (not (= "LINE" (cdr (assoc 0 l2))))) (setq check 0))
(if (not (= 0 (-(sslength data_m) 2))) (setq check 0))
(if (= 1 check) (progn
(setq p3 (cdr (assoc 10 l1))) (setq p3 (list (nth 0 p3) (nth 1 p3)))
(setq p4 (cdr (assoc 11 l1))) (setq p4 (list (nth 0 p4) (nth 1 p4)))
(setq p5 (cdr (assoc 10 l2))) (setq p5 (list (nth 0 p5) (nth 1 p5)))
(setq p6 (cdr (assoc 11 l2))) (setq p6 (list (nth 0 p6) (nth 1 p6)))
(if (not (= nil (inters p3 p4 p5 p6 nil))) (setq check 0))
))
) (setq check 0))
(princ)
)

(defun wd_procced()

(defun mkv(/ p3 p4 p5 p6 p7 p8 p9 ls1 ls2 getom ll1)

(setq p3 (cdr (assoc 10 l1)))
(setq p4 (cdr (assoc 11 l1)))
(setq p5 (cdr (assoc 10 l2)))
(setq p6 (cdr (assoc 11 l2)))
(if (> (abs (- (nth 1 p1) (nth 1 p3)))
(abs (- (nth 1 p3) (nth 1 p4))) ) (setq check 0))
(if (> (abs (- (nth 1 p1) (nth 1 p4)))
(abs (- (nth 1 p3) (nth 1 p4))) ) (setq check 0))
(if (> (abs (- (nth 1 p2) (nth 1 p5)))
(abs (- (nth 1 p5) (nth 1 p6))) ) (setq check 0))
(if (> (abs (- (nth 1 p2) (nth 1 p6)))
(abs (- (nth 1 p5) (nth 1 p6))) ) (setq check 0))
(if (= 0 check) (princ "\ninvalid data") (progn
(setq ls1 (arlst (list (nth 1 p1) (nth 1 p2) (nth 1 p3) (nth 1 p4) )))
; (princ ls1)
(setq p7 (list (nth 0 p3) (nth 0 ls1) 0))
(setq p8 (list (nth 0 p3) (nth 1 ls1) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 0 p3) (nth 2 ls1) 0))
(setq p8 (list (nth 0 p3) (nth 3 ls1) 0))
(mkline p7 p8 l1)

(setq ls1 (arlst (list (nth 1 p1) (nth 1 p2) (nth 1 p5) (nth 1 p6) )))
; (princ ls1)
(setq p7 (list (nth 0 p5) (nth 0 ls1) 0))
(setq p8 (list (nth 0 p5) (nth 1 ls1) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 0 p5) (nth 2 ls1) 0))
(setq p8 (list (nth 0 p5) (nth 3 ls1) 0))
(mkline p7 p8 l1)

(setq p7 (list (nth 0 p3) (nth 1 ls1) 0))
(setq p8 (list (nth 0 p5) (nth 1 ls1) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 0 p3) (nth 2 ls1) 0))
(setq p8 (list (nth 0 p5) (nth 2 ls1) 0))
(mkline p7 p8 l1)

(setq ls2 (arlst (list (nth 0 p3) (nth 0 p5))))

(setq ll1 (list
(cons 0 "line")
(cons 8 (getvar "clayer"))
))

(if (< (nth 0 p1) (nth 0 ls2)) (progn
(setq p7 (list (nth 0 ls2) (nth 1 ls1) 0))
(setq p8 (list (nth 1 ls2) (nth 2 ls1) 0))
(setq p7 (list (* (+ (nth 0 p7) (nth 0 p8)) 0.5) (nth 1 p7) 0))
(drawrt2 p7 p8 ll1)

(setq p7 (list (- (nth 0 ls2) 70) (- (nth 1 ls1) 100) 0))
(setq p8 (list (- (nth 0 ls2) 70) (+ (nth 2 ls1) 100) 0))
(mkline p7 p8 ll1)

(setq p9 (list (+ (nth 0 p7) 70) (nth 1 p7) 0))
(mkline p7 p9 ll1)

(setq p9 (list (+ (nth 0 p8) 70) (nth 1 p8) 0))
(mkline p8 p9 ll1)
)(progn
(setq p7 (list (nth 0 ls2) (nth 1 ls1) 0))
(setq p8 (list (nth 1 ls2) (nth 2 ls1) 0))
(setq p8 (list (* (+ (nth 0 p7) (nth 0 p8)) 0.5) (nth 1 p8) 0))
(drawrt2 p7 p8 ll1)

(setq p7 (list (+ (nth 1 ls2) 70) (- (nth 1 ls1) 100) 0))
(setq p8 (list (+ (nth 1 ls2) 70) (+ (nth 2 ls1) 100) 0))
(mkline p7 p8 ll1)

(setq p9 (list (- (nth 0 p7) 70) (nth 1 p7) 0))
(mkline p7 p9 ll1)

(setq p9 (list (- (nth 0 p8) 70) (nth 1 p8) 0))
(mkline p8 p9 ll1)
))


(command "erase" data_m "")

))
(princ)
)

(defun mkh(/ p3 p4 p5 p6 p7 p8 p9 ls1 ls2 getom ll1)

(setq p3 (cdr (assoc 10 l1)))
(setq p4 (cdr (assoc 11 l1)))
(setq p5 (cdr (assoc 10 l2)))
(setq p6 (cdr (assoc 11 l2)))

(if (> (abs (- (nth 0 p1) (nth 0 p3)))
(abs (- (nth 0 p3) (nth 0 p4))) ) (setq check 0))
(if (> (abs (- (nth 0 p1) (nth 0 p4)))
(abs (- (nth 0 p3) (nth 0 p4))) ) (setq check 0))
(if (> (abs (- (nth 0 p2) (nth 0 p5)))
(abs (- (nth 0 p5) (nth 0 p6))) ) (setq check 0))
(if (> (abs (- (nth 0 p2) (nth 0 p6)))
(abs (- (nth 0 p5) (nth 0 p6))) ) (setq check 0))

(if (= 0 check) (princ "\ninvalid data") (progn

(setq ls1 (arlst (list (nth 0 p1) (nth 0 p2) (nth 0 p3) (nth 0 p4) )))
; (princ ls1)
(setq p7 (list (nth 0 ls1) (nth 1 p3) 0))
(setq p8 (list (nth 1 ls1) (nth 1 p3) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 2 ls1) (nth 1 p3) 0))
(setq p8 (list (nth 3 ls1) (nth 1 p3) 0))
(mkline p7 p8 l1)

(setq ls1 (arlst (list (nth 0 p1) (nth 0 p2) (nth 0 p5) (nth 0 p6) )))
; (princ ls1)
(setq p7 (list (nth 0 ls1) (nth 1 p5) 0))
(setq p8 (list (nth 1 ls1) (nth 1 p5) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 2 ls1) (nth 1 p5) 0))
(setq p8 (list (nth 3 ls1) (nth 1 p5) 0))
(mkline p7 p8 l1)

(setq p7 (list (nth 1 ls1) (nth 1 p3) 0))
(setq p8 (list (nth 1 ls1) (nth 1 p5) 0))
(mkline p7 p8 l1)
(setq p7 (list (nth 2 ls1) (nth 1 p3) 0))
(setq p8 (list (nth 2 ls1) (nth 1 p5) 0))
(mkline p7 p8 l1)

(setq getom (getvar "osmode"))
(setvar "osmode" 0)

(setq ll1 (list
(cons 0 "line")
(cons 8 (getvar "clayer"))
))
(setq ls2 (arlst (list (nth 1 p3) (nth 1 p5))))
;(princ ls2)

(if (> (nth 1 p1) (nth 1 ls2)) (progn

(setq p7 (list (nth 1 ls1) (nth 0 ls2) 0))
(setq p8 (list (nth 2 ls1) (nth 1 ls2) 0))
(setq p8 (list (nth 2 ls1) (* (+ (nth 1 p7) (nth 1 p8)) 0.5) 0))

(drawrt3 p7 p8 ll1)

(setq p7 (list (- (nth 1 ls1) 100) (+ (nth 1 ls2) 70) 0))
(setq p8 (list (+ (nth 2 ls1) 100) (+ (nth 1 ls2) 70) 0))
(mkline p7 p8 ll1)

(setq p9 (list (nth 0 p7) (- (nth 1 p7) 70) 0))
(mkline p7 p9 ll1)

(setq p9 (list (nth 0 p8) (- (nth 1 p8) 70) 0))
(mkline p8 p9 ll1)
)(progn
(setq p7 (list (nth 1 ls1) (nth 0 ls2) 0))
(setq p8 (list (nth 2 ls1) (nth 1 ls2) 0))
(setq p7 (list (nth 1 ls1) (* (+ (nth 1 p7) (nth 1 p8)) 0.5) 0))

(drawrt3 p7 p8 ll1)


(setq p7 (list (- (nth 1 ls1) 100) (- (nth 0 ls2) 70) 0))
(setq p8 (list (+ (nth 2 ls1) 100) (- (nth 0 ls2) 70) 0))
(mkline p7 p8 ll1)

(setq p9 (list (nth 0 p7) (+ (nth 1 p7) 70) 0))
(mkline p7 p9 ll1)

(setq p9 (list (nth 0 p8) (+ (nth 1 p8) 70) 0))
(mkline p8 p9 ll1)


))

(setvar "osmode" getom)

(command "erase" data_m "")


))
(princ)
)

(setvar "cmdecho" 0) (command "undo" "mark") (setvar "cmdecho" 1)
(if (= 0 check) (princ "\ninvalid data") (progn
(if (< (abs (- (nth 0 (cdr (assoc 10 l1)))
(nth 0 (cdr (assoc 11 l1))) )) 0.00001) (mkv))
(if (< (abs (- (nth 1 (cdr (assoc 10 l1)))
(nth 1 (cdr (assoc 11 l1))) )) 0.00001) (mkh))


))

(princ)

)
(wd_import)
(wd_procced)
)

Có 2 lệnh trong lisp này.
w1: vẽ cửa sổ kiểu 1
w2: vẽ cửa sổ kiểu 2
Ờ nhỉ tí quên. Thế khi vẽ tim và tường thì làm thế nào cho nhanh. Có người thì dùng MLine, có người thì dùng Line. MLine thì không bàn, nhanh, nhưng không phải ai cũng quen. Vậy làm thế nào khi đã ve xong tim tường rồi? OFFSET ?
Về Đầu Trang Go down
https://zizu.forumvi.com
Admin
Admin
Admin
Admin


Nam Tổng số bài gửi : 475
Age : 46
Đến từ: : Việt Nam
Nghề nghiệp: : Kỹ sư
Ngày đăng ký : 02/03/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Tiếp theo   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeThu Apr 17, 2008 6:19 pm

Bài 7: Offset line sang 2 bên

Trích dẫn :

(defun c:oo(/ data_m)

(defun import_data(/ i)
(setq data_m (ssget))
(if (= nil distan_m) (setq distan_m 110.0))
(princ "Distance (")
(princ distan_m)
(princ "):")
(setq i (getreal ))
(if (not (= nil i)) (setq distan_m i))
)

(defun process(/ ent check)

(defun p_check()
(setq check 0)
(if (= "LINE" (cdr (assoc 0 ent))) (setq check 1))
(princ)
)

(defun p_d_offset(/ p1 p2 p3 p4)

(defun makeline(/ e2 e5)
; (princ ent)
; (setq e5 nil)
; (setq e5 (cdr (assoc 5 ent)))
; (princ e5)
; (if (= nil e5) (setq e5 ))

(setq la (list (cons 0 "LINE")
(cons 5 (cdr (assoc 5 ent)) )
(cons 8 (cdr (assoc 8 ent)) )
(cons 10 p3)
(cons 11 p4)
))
; (princ la)
(entmake la)
(princ)
)

(setq p1 (cdr (assoc 10 ent)) p2 (cdr (assoc 11 ent)) )
(if (not (= p1 p2)) (progn
(if (< (abs (- (nth 0 p1) (nth 0 p2))) 0.000001) (progn
(setq p3 (list (+ (nth 0 p1) distan_m) (nth 1 p1) (nth 2 p1) ) )
(setq p4 (list (+ (nth 0 p2) distan_m) (nth 1 p2) (nth 2 p2) ) )
(makeline)
(setq p3 (list (- (nth 0 p1) distan_m) (nth 1 p1) (nth 2 p1) ) )
(setq p4 (list (- (nth 0 p2) distan_m) (nth 1 p2) (nth 2 p2) ) )
(makeline)
))
(if (< (abs (- (nth 1 p1) (nth 1 p2))) 0.000001) (progn
(setq p3 (list (nth 0 p1) (+ (nth 1 p1) distan_m) (nth 2 p1) ) )
(setq p4 (list (nth 0 p2) (+ (nth 1 p2) distan_m) (nth 2 p2) ) )
(makeline)
(setq p3 (list (nth 0 p1) (- (nth 1 p1) distan_m) (nth 2 p1) ) )
(setq p4 (list (nth 0 p2) (- (nth 1 p2) distan_m) (nth 2 p2) ) )
(makeline)
))

))
(princ)
)

(if (not (= nil data_m)) (progn
(setq i 0)
(while (< i (sslength data_m)) (progn
(setq ent (entget (ssname data_m i)))
(p_check)
(if (= 1 check) (p_d_offset))
(setq i (+ i 1))
))
))
(princ)
)
(import_data)
(ai_undo_push)
(process)
(ai_undo_pop)
(princ)
)

Lênh để offset line sang 2 bên là oo.
Bản vẽ cũng ổn rồi. chuẩn bị viết TEXT và Dim thôi. Nhưng trước khi chuyển sang phần mới. Tôi muốn cho cho các bạn biết thêm 2 mẹo nữa khi vẽ.

Bài 8: Break đối tượng
Nhiều người sẽ bảo có lệnh Break (br) rồi cần gì LISP. Nhưng không! Lệnh BR thường không chặt điểm mà chặt đoạn nếu ta không cẩn trọng.

Trích dẫn :

(defun c:bf (/ dt diem)
(setq dt (car (entsel "\nVao doi tuong can chat")))
(if dt
(progn
(redraw dt 3)
(setq diem (getpoint "\nVao diem chat: "))
(redraw dt 4)
)
)
(if (and dt diem)
(command ".break" dt diem diem)
)
)

Lệnh bf sẽ giúp ta chặt đối tượng tại một điểm.

Bài 9: Nối 2 đường Line bị ngặt quãng

Hãy tưởng tượng bạn có 1 đương Line. Bạn Br nó. Đường Line giờ đã trở thành 2 đường riêng biệt, cách nhau 1 đoạn. Không cần thiết phải xoa 1 đường và EX đường kia khi bạn muốn 2 đường làm 1.

Trích dẫn :

(defun c:jl (/ p1 p2 p3 ssdt entla entlb tt p1a p2a tt p1b p2b layermoi TAPLINEMOI TENLAYERMOI)
(defun thanghang (p0 p1 p2 / dx1 dy1 dx2 dy2 x1 y1 x2 y2 x0 y0)
(setq
x0 (car p0)
y0 (cadr p0)
x1 (car p1)
y1 (cadr p1)
x2 (car p2)
y2 (cadr p2)
dx1 (- x1 x0)
dy1 (- y1 y0)
dx2 (- x2 x0)
dy2 (- y2 y0)
)
(if (equal (* dx1 dy2) (* dx2 dy1) 0.01)
t
nil
)
)
(defun noiline (p1 p2 p3 p4 / kq dmax)
(if (and (thanghang p1 p2 p3) (thanghang p1 p2 p4))
(progn
(setq d1 (distance p1 p3)
d2 (distance p1 p4)
d3 (distance p2 p3)
d4 (distance p2 p4)
dmax (max d1 d2 d3 d4)
kq (cond
((= dmax d1) (list p1 p3))
((= dmax d2) (list p1 p4))
((= dmax d3) (list p2 p3))
((= dmax d4) (list p2 p4))
(t nil)
)
)
kq
)
nil
)
)
(init)
(setq
p1 (getpoint "\ngocdau: ")
p2 (getcorner p1 "\ngocsau: ")
ssdt (ssget "c" p1 p2 '((0 . "LINE")))
entla (ssname ssdt 0)
entlb (ssname ssdt 1)
tt (entget entla)
p1a (cdr (assoc 10 tt))
p2a (cdr (assoc 11 tt))
tt (entget entlb)
p1b (cdr (assoc 10 tt))
p2b (cdr (assoc 11 tt))
tenlayermoi (cdr (assoc 8 (entget entla)))
)
(if (setq taplinemoi (noiline p1a p2a p1b p2b))
(progn
(command ".erase" ssdt "")
(entmake
(list
(cons 0 "LINE")
(cons 8 tenlayermoi)
(cons 10 (car taplinemoi))
(cons 11 (cadr taplinemoi))
)
)
(traos)
)
(princ "\nKhong the noi line duoc !")
)
(done)
)

Lệnh jl rất tiện. Bạn thử dùng mà xem...

Bài 10: Hiệu chỉnh Hatch

Trích dẫn :

(defun c:hc ()
(setq elist (entget (car (entsel "\nLUA CHON MAU HATCH DE SAO CHEP: ")))
etyp (cdr (assoc 0 elist))
old (getvar "clayer")
);setq

(if (/= etyp "HATCH")
(prompt "\nKHONG PHAI DOI TUONG HATCH! HAY THU LAI!")
(progn
(setq layn (cdr (assoc 8 elist)))
(setvar "HPNAME" (cdr (assoc 2 elist)))
(setvar "HPSCALE" (cdr (assoc 41 elist)))
(setvar "HPANG" (cdr (assoc 52 elist)))
(setq pt1 (getpoint "\nCHON MOT DIEM TRONG VUNG SE HATCH: "))
(setvar "clayer" layn)
(command "bhatch" pt1 "")
(setvar "clayer" old)
);progn
);if
(princ)
);defun
;****** mk ****** mk ****** mk ****** mk ****** mk ****** mk ******
(defun c:hm ()
(setq ename (entsel "\nLUA CHON MAU HATCH DE DI CHUYEN: ")
elist (entget (car ename))
etyp (cdr (assoc 0 elist))
old (getvar "clayer")
);setq

(if (/= etyp "HATCH")
(prompt "\nKHONG PHAI DOI TUONG HATCH! HAY THU LAI!")
(progn
(setq layn (cdr (assoc 8 elist)))
(setvar "HPNAME" (cdr (assoc 2 elist)))
(setvar "HPSCALE" (cdr (assoc 41 elist)))
(setvar "HPANG" (cdr (assoc 52 elist)))
(setq pt1 (getpoint "\nCHON MOT DIEM TRONG VUNG SE HATCH: "))
(setvar "clayer" layn)
(entdel (car ename))
(command "bhatch" pt1 "")
(setvar "clayer" old)
);progn
);if
(princ)
);defun
;****** mk ****** mk ****** mk ****** mk ****** mk ****** mk ******
(defun c:ha ()
(setq ename(entsel "\nLUA CHON MAU HATCH DE THAY DOI GOC : ")
elist(entget (car ename))
etyp(cdr (assoc 0 elist))
oang(assoc 52 elist)
);setq

(if (/= etyp "HATCH")
(prompt "\nKHONG PHAI DOI TUONG HATCH! HAY THU LAI!")
(progn
(setq ang (getangle (strcat "\nSO DO GOC MOI <" (rtos (cdr oang) 2) ">:"))
nang (cons 52 ang)
nlst (subst nang oang elist)
)
(entmod nlst)
(command "hatchedit" ename "" "" "" "")
);progn
);if
(princ)
);defun
;****** mk ****** mk ****** mk ****** mk ****** mk ****** mk ******
(defun c:hs ()
(setq ename (entsel "\nLUA CHON MAU HATCH DE THAY DOI TY LE : ")
elist (entget (car ename))
etyp (cdr (assoc 0 elist))
oscl (assoc 41 elist)
);setq

(if (/= etyp "HATCH")
(prompt "\nKHONG PHAI DOI TUONG HATCH! HAY THU LAI!")
(progn
(setq hscl (getreal (strcat "\nTY LE MAU HATCH MOI <" (rtos (cdr oscl) 2) ">:"))
nscl (cons 41 hscl)
nlst (subst nscl oscl elist)
)
(entmod nlst)
(command "hatchedit" ename "" "" "" "")
);progn
);if
(princ)
);defun

Trong lisp này cung cấp cho chúng ta những lệnh sau
1. hc: Copy Hatch
1. hm: Move Hatch
1. ha: Chỉnh góc của mấu Hatch
1. hs: Chỉnh độ Scale của mẫu Hatch
Về Đầu Trang Go down
https://zizu.forumvi.com
Admin
Admin
Admin
Admin


Nam Tổng số bài gửi : 475
Age : 46
Đến từ: : Việt Nam
Nghề nghiệp: : Kỹ sư
Ngày đăng ký : 02/03/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Tiếp theo   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeThu Apr 17, 2008 6:24 pm

-------------------------------------------------@@@@@@@@@@@@@@@@@--------
* Để chạy một đoạn mã lấy từ diễn đàn về:
- Nếu đoạn mã đã là 1 file lsp thì bạn chỉ việc download về và dùng chức năng appload lên để sử dụng (như đã nói ở trên).
- Nếu đoạn mã nằm trong bài viết của diễn đàn, mở notepad (hoặc một chương trình soạn thảo nào đó cho phép bạn soạn file text) rồi paste nội dung vào. Sau đó save file này thành một file có đuôi là lsp. Sau đó appload lên dùng.
- Nếu chương trình có sử dụng file ngoài như dcl, sld, dwg thì bạn có 2 lựa chọn:
. Copy các file này vào thư mục support của AutoCAD
. Copy vào một thư mục nào đó rồi khai báo thư mục này với AutoCAD bằng cách vào Menu: Tools > Options > Files > Support file search path > Add rồi thêm đường dẫn của bạn vào.

* Để biết tên lệnh là gì?
Bạn mở file lsp ra, tìm đến các dòng mã (defun c:, phía sau c: là tên lệnh. Ví dụ: (defun c:NOILINE thì tên lệnh là NOILINE.
Về Đầu Trang Go down
https://zizu.forumvi.com
sonxaydung
Thành viên chính thức
Thành viên chính thức



Tổng số bài gửi : 3
Ngày đăng ký : 04/08/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Re: TỔNG HỢP MỘT SỐ LISP CƠ BẢN   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeWed Oct 29, 2008 1:35 pm

lisp jl bi loi roi ban oi!
minh ko dung duoc
Về Đầu Trang Go down
philipdn
Moderator
Moderator
philipdn


Nam Tổng số bài gửi : 320
Age : 40
Đến từ: : Việt Nam
Nghề nghiệp: : Xây dựng cầu đường
Sở thích : Học tập, nghiên cứu và vi tính
Ngày đăng ký : 16/11/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Re: TỔNG HỢP MỘT SỐ LISP CƠ BẢN   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeThu Feb 26, 2009 4:35 pm

Các bác nào có lisp Scale đối tượng tại tâm của nó ko? (Chọn multi nhé)
Very Happy
Về Đầu Trang Go down
http://vn.myblog.yahoo.com/alonestar.cafe
khaosat2009
Thành viên năng động
Thành viên năng động



Tổng số bài gửi : 91
Ngày đăng ký : 29/04/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Re: TỔNG HỢP MỘT SỐ LISP CƠ BẢN   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeFri Feb 27, 2009 6:49 pm

Bạn có Lisp Tổng các số cho mình xin với.
Lisp yêu cầu chọn tất cả các số ( kể cả nằn rải rác không theo thứ tự), chọn điểm ghi kết qủa và cho ra kết quả các số đó được sắp theo hàng dọc xuống có đường gạch ngang số tổng
Về Đầu Trang Go down
philipdn
Moderator
Moderator
philipdn


Nam Tổng số bài gửi : 320
Age : 40
Đến từ: : Việt Nam
Nghề nghiệp: : Xây dựng cầu đường
Sở thích : Học tập, nghiên cứu và vi tính
Ngày đăng ký : 16/11/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Re: TỔNG HỢP MỘT SỐ LISP CƠ BẢN   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeSat Feb 28, 2009 7:38 pm

khaosat2009 đã viết:
Bạn có Lisp Tổng các số cho mình xin với.
Lisp yêu cầu chọn tất cả các số ( kể cả nằn rải rác không theo thứ tự), chọn điểm ghi kết qủa và cho ra kết quả các số đó được sắp theo hàng dọc xuống có đường gạch ngang số tổng
Bạn nói rõ hơn hoặc có ví dụ được ko? Chưa hiểu hết ý của bạn.
\Hoặc bạn vào mục:
https://zizu.forumvi.com/forum-f13/topic-t380.htm
download bọ cài UFC V22009 của mình về dùng lệnh SUM thử đúng ý bạn ko?
Về Đầu Trang Go down
http://vn.myblog.yahoo.com/alonestar.cafe
khaosat2009
Thành viên năng động
Thành viên năng động



Tổng số bài gửi : 91
Ngày đăng ký : 29/04/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Re: TỔNG HỢP MỘT SỐ LISP CƠ BẢN   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeSun Mar 01, 2009 9:25 am

À ĐÚNG RỒI MÌNH MUỐN XIN LISP LỆNH SUM CỦA UFC V22009
RẤT MONG ĐƯỢC BẠN GIÚP.
Về Đầu Trang Go down
phuquang113
Thành viên năng động
Thành viên năng động



Nam Tổng số bài gửi : 189
Nghề nghiệp: : Ky su cau duong
Ngày đăng ký : 18/05/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Re: TỔNG HỢP MỘT SỐ LISP CƠ BẢN   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeSun Mar 01, 2009 9:38 am

À! Mình cũng đang cần xin lisp của lệnh XTE trong bộ UFC không biết Admin có không? Mong được giúp đỡ!
Về Đầu Trang Go down
philipdn
Moderator
Moderator
philipdn


Nam Tổng số bài gửi : 320
Age : 40
Đến từ: : Việt Nam
Nghề nghiệp: : Xây dựng cầu đường
Sở thích : Học tập, nghiên cứu và vi tính
Ngày đăng ký : 16/11/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Re: TỔNG HỢP MỘT SỐ LISP CƠ BẢN   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeSun Mar 01, 2009 11:25 pm

khaosat2009 đã viết:
À ĐÚNG RỒI MÌNH MUỐN XIN LISP LỆNH SUM CỦA UFC V22009
RẤT MONG ĐƯỢC BẠN GIÚP.

phuquang113 đã viết:
À! Mình cũng đang cần xin lisp của lệnh XTE trong bộ UFC không biết Admin có không? Mong được giúp đỡ!
Các bác cài UFC lên dùng đc rồi mà, cần thiết gì fải xin mã nguồn. Giờ ko đem theo, khi nào tiện up lên cho các bác sau nhé
Về Đầu Trang Go down
http://vn.myblog.yahoo.com/alonestar.cafe
phuquang113
Thành viên năng động
Thành viên năng động



Nam Tổng số bài gửi : 189
Nghề nghiệp: : Ky su cau duong
Ngày đăng ký : 18/05/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Re: TỔNG HỢP MỘT SỐ LISP CƠ BẢN   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeMon Mar 02, 2009 7:28 am

philipdn đã viết:
Trích dẫn :
Các bác cài UFC lên dùng đc rồi mà, cần thiết gì fải xin mã nguồn. Giờ ko đem theo, khi nào tiện up lên cho các bác sau nhé
Thực ra bộ cài UFC của bạn rất hay nhưng thực sự mình chỉ cần lệnh XTE trong bộ UFC của bạn thôi mong bạn giúp đỡ!
Về Đầu Trang Go down
khaosat2009
Thành viên năng động
Thành viên năng động



Tổng số bài gửi : 91
Ngày đăng ký : 29/04/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Re: TỔNG HỢP MỘT SỐ LISP CƠ BẢN   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeMon Mar 02, 2009 8:15 am

Các Anh có biết Lisp của lệnh Alinge ( lệnh quay và nắn đối tượng ) cho em xin với, vì em cần làm công việc nắn các đối tượng vào một hình cho trước. Rất cám ơn.
Về Đầu Trang Go down
philipdn
Moderator
Moderator
philipdn


Nam Tổng số bài gửi : 320
Age : 40
Đến từ: : Việt Nam
Nghề nghiệp: : Xây dựng cầu đường
Sở thích : Học tập, nghiên cứu và vi tính
Ngày đăng ký : 16/11/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Re: TỔNG HỢP MỘT SỐ LISP CƠ BẢN   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeTue Mar 03, 2009 4:29 pm

khaosat2009 đã viết:
Các Anh có biết Lisp của lệnh Alinge ( lệnh quay và nắn đối tượng ) cho em xin với, vì em cần làm công việc nắn các đối tượng vào một hình cho trước. Rất cám ơn.
bác nói mình ko hiểu tí nào, dùng Alinge (AL) thì dùng trong cad có rồi mà. Đâu fải thứ gì cũng viết lisp đâu???
Về Đầu Trang Go down
http://vn.myblog.yahoo.com/alonestar.cafe
khaosat2009
Thành viên năng động
Thành viên năng động



Tổng số bài gửi : 91
Ngày đăng ký : 29/04/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Re: TỔNG HỢP MỘT SỐ LISP CƠ BẢN   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeTue Mar 03, 2009 4:55 pm

VẬY BÁC CHỈ GIÚP LISP AL NẰM Ở ĐÂU VẬY BÁC
Về Đầu Trang Go down
Admin
Admin
Admin
Admin


Nam Tổng số bài gửi : 475
Age : 46
Đến từ: : Việt Nam
Nghề nghiệp: : Kỹ sư
Ngày đăng ký : 02/03/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Re: TỔNG HỢP MỘT SỐ LISP CƠ BẢN   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeThu Mar 05, 2009 5:53 pm

khaosat2009 đã viết:
VẬY BÁC CHỈ GIÚP LISP AL NẰM Ở ĐÂU VẬY BÁC

ALIGN(lệnh tắc: AL) là lệnh của Cad có sẳn. Không phải tìm lipsp làm gì. Bản thân lệnh này kết hợp được cả 3 lênh: M, RO, SC.
Cách dùng
Command: AL (enter)
Select opjects: Chọn các đối tượng cần "quay và nắn đối tượng" (Enter)
Specify first source point: Điểm thứ của đối tượng được chọn
Specify first destination point:Điểm đến của điểm thứ 1 của đối tượng được chọn
Specify second source point: Điểm thứ 2 của đối tượng được chọn
Specify second destination point:Điểm đến của điểm thứ 2 của đối tượng được chọn
Specify third source point or : Điểm thứ 3 của đối tượng được chọn. kết thúc chọn điểm suorce để tiếp tục.
Scale objects based on alignment points? [Yes/No] : Chọn Y để Scale đối tượng or chon N để giữ nguyên kích thước đối tượng (lúc này đối tương sẽ được xoay theo hướng trục của điểm 1 và 2 với góc góc xoay là điểm 1)
Về Đầu Trang Go down
https://zizu.forumvi.com
ken"s
Thành viên chính thức
Thành viên chính thức
ken


Nam Tổng số bài gửi : 18
Age : 39
Nghề nghiệp: : kỹ sư cầu đường
Ngày đăng ký : 08/05/2009

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Re: TỔNG HỢP MỘT SỐ LISP CƠ BẢN   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeMon May 11, 2009 1:12 pm

khaosat2009 đã viết:
Các Anh có biết Lisp của lệnh Alinge ( lệnh quay và nắn đối tượng ) cho em xin với, vì em cần làm công việc nắn các đối tượng vào một hình cho trước. Rất cám ơn.
em nghĩ anh làm khảo sát thì hay phải chỉnh sưả bình đồ, Nhiêù khi các đường đồng mức bị nổ ra thành nhiều đối tượng, Muốn để cacs đôí tượng này nối thành một đừơng PL thì theo em anh nên quan tâm đến lisp nôí Arc,L,Pl cuả anh admin(bằng lệnh NN)
Về Đầu Trang Go down
philong3112
Thành viên chính thức
Thành viên chính thức
philong3112


Tổng số bài gửi : 49
Ngày đăng ký : 22/07/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Re: TỔNG HỢP MỘT SỐ LISP CƠ BẢN   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeTue May 12, 2009 7:18 pm

CÁC BÁC CHỈ EM DÙNG LỆNH UCS VỚI
Về Đầu Trang Go down
philipdn
Moderator
Moderator
philipdn


Nam Tổng số bài gửi : 320
Age : 40
Đến từ: : Việt Nam
Nghề nghiệp: : Xây dựng cầu đường
Sở thích : Học tập, nghiên cứu và vi tính
Ngày đăng ký : 16/11/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Re: TỔNG HỢP MỘT SỐ LISP CƠ BẢN   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeWed May 13, 2009 8:58 pm

bạn đánh lệnh USC rùi xem hướng dẫn ngay trên dòng lệnh mà dùng có khó gì đâu?
===============================================================
UCS toolbar:

Tools menu: New UCS

Command line: ucs

Enter an option [New/Move/orthoGraphic/Prev/Restore/Save/Del/Apply/?/World] :

===============================================================
*New
Defines a new coordinate system by one of six methods.

Specify origin of new UCS or [ZAxis/3point/OBject/Face/View/X/Y/Z] <0,0,0>:

Origin

Defines a new UCS by shifting the origin of the current UCS, leaving the direction of its X, Y, and Z axes unchanged.

Specify new origin point <0,0,0>: Specify a point

===============================================================
*Move
Redefines a UCS by shifting the origin or changing the Z-depth of the current UCS, leaving the orientation of its XY plane unchanged. Changing the Zdepth moves the UCS along its Z axis in a positive or negative direction relative to the current origin.

Specify new origin point or [Zdepth] <0,0,0>: Specify a point or enter z

New Origin

Changes the origin of the UCS.

Zdepth

Specifies the distance along the Z axis to move the UCS origin.

Specify Zdepth <0>: Enter a distance or press ENTER

If you have multiple viewports active, and you change viewports to specify a new origin or Z-depth, the change is applied to the UCS of the viewport that was current when the command was started and that viewport becomes current once the command has finished.

Note The UCS Move option does not add a UCS to the Previous list.

===============================================================
*Orthographic
Specifies one of the six orthographic UCSs provided with AutoCAD. These UCS settings are typically used when viewing and editing 3D models.

Enter an option [Top/Bottom/Front/BAck/Left/Right] : Enter an option or press ENTER



By default the orthographic UCS settings orient the current UCS relative to the world coordinate system (WCS) origin and orientation. The UCSBASE system variable controls the UCS upon which the orthographic settings are based. The origin or Zdepth of the orthographic UCS settings can be changed using the Move option of the UCS command


===============================================================
*Prev
Restores the previous UCS. AutoCAD retains the last 10 coordinate systems created in paper space and the last 10 coordinate systems created in model space. Repeating the Prev option steps back through one set or the other, depending on which space is current.

If you have saved different UCS settings in individual viewports and you switch between viewports, AutoCAD does not retain the different UCSs in the Previous list. However, if you change a UCS setting within a viewport, AutoCAD does retain the last UCS setting in the Previous list. For example, changing the UCS from World to UCS1 would retain World at the top of the Previous list. If you then switch viewports with Front as the current UCS, and then change the UCS to Right, the Front UCS is retained at the top of the Previous list. If you then choose the UCS Previous option twice in this viewport, the UCS setting changes to Front, and then back to World. See the UCSVP system variable.

===============================================================
*Restore
Restores a saved UCS so that it becomes the current UCS. Restoring a saved UCS does not reestablish the viewing direction in effect when the UCS was saved.

Enter name of UCS to restore or [?]: Enter a name or enter ?

Name

Specifies a named UCS.

?—List UCSs

Lists the names of currently defined UCSs. AutoCAD prompts:

Enter UCS name(s) to list <*>: Enter a name list or press ENTER to list all UCSs

===============================================================
*Save
Saves the current UCS to a specified name. The name can have up to 255 characters and can include letters, numbers, blank spaces, and any special character not used by Microsoft® Windows® and AutoCAD for other purposes.

Enter name to save current UCS or [?]: Enter a name or enter ?

Name

Saves the current UCS with the specified name.

===============================================================
?—List UCSs

Lists the names of currently defined UCSs. AutoCAD prompts:

UCS name(s) to list <*>: Enter a name list or press ENTER to list all UCSs

===============================================================
*Del
Removes the specified UCS from the list of saved user coordinate systems.

Enter UCS name(s) to delete : Enter a name list or press ENTER

AutoCAD deletes the named UCS you enter. If you delete a named UCS that is current, AutoCAD renames the current UCS UNNAMED.
===============================================================
*Apply
Applies the current UCS setting to a specified viewport or all active viewports when other viewports have a different UCS saved in the viewport. The UCSVP system variable determines whether a UCS is saved with a viewport.

Pick viewport to apply current UCS or [All] : Specify a viewport by clicking inside it, enter a, or press ENTER

Viewport

Applies the current UCS to the specified viewport and ends the UCS command.

All

Applies the current UCS to all active viewports.

===============================================================
?—List UCSs
Lists names of user coordinate systems and provides the origin and X, Y, and Z axes for each saved UCS relative to the current UCS. If the current UCS is unnamed, it is listed as WORLD or UNNAMED, depending on whether it's the same as the WCS.

UCS name(s) to list <*>: Enter a name list

===============================================================
World
Sets the current user coordinate system to the world coordinate system. The WCS is the basis for all user coordinate systems and cannot be redefined.


===============================================================
*Save
Saves the current UCS to a specified name. The name can have up to 255 characters and can include letters, numbers, blank spaces, and any special character not used by Microsoft® Windows® and AutoCAD for other purposes.

Enter name to save current UCS or [?]: Enter a name or enter ?

Name

Saves the current UCS with the specified name.

?—List UCSs

Lists the names of currently defined UCSs. AutoCAD prompts:

UCS name(s) to list <*>: Enter a name list or press ENTER to list all UCSs

===============================================================
*Del
Removes the specified UCS from the list of saved user coordinate systems.

Enter UCS name(s) to delete : Enter a name list or press ENTER

AutoCAD deletes the named UCS you enter. If you delete a named UCS that is current, AutoCAD renames the current UCS UNNAMED.

===============================================================
*Apply
Applies the current UCS setting to a specified viewport or all active viewports when other viewports have a different UCS saved in the viewport. The UCSVP system variable determines whether a UCS is saved with a viewport.

Pick viewport to apply current UCS or [All] : Specify a viewport by clicking inside it, enter a, or press ENTER

Viewport

Applies the current UCS to the specified viewport and ends the UCS command.

All

Applies the current UCS to all active viewports.


*?—List UCSs
Lists names of user coordinate systems and provides the origin and X, Y, and Z axes for each saved UCS relative to the current UCS. If the current UCS is unnamed, it is listed as WORLD or UNNAMED, depending on whether it's the same as the WCS.

UCS name(s) to list <*>: Enter a name list

===============================================================
*World
Sets the current user coordinate system to the world coordinate system. The WCS is the basis for all user coordinate systems and cannot be redefined.
Về Đầu Trang Go down
http://vn.myblog.yahoo.com/alonestar.cafe
philong3112
Thành viên chính thức
Thành viên chính thức
philong3112


Tổng số bài gửi : 49
Ngày đăng ký : 22/07/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Re: TỔNG HỢP MỘT SỐ LISP CƠ BẢN   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeWed Mar 24, 2010 2:21 pm

GÌ MÀ DÀI DÒNG WA EM CHANG HIỂU GI HẾT TRƠN,HICHIC
Về Đầu Trang Go down
thuancauduong
Thành viên chính thức
Thành viên chính thức



Tổng số bài gửi : 38
Ngày đăng ký : 29/04/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Re: TỔNG HỢP MỘT SỐ LISP CƠ BẢN   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeWed Mar 24, 2010 5:13 pm

philong3112 đã viết:
GÌ MÀ DÀI DÒNG WA EM CHANG HIỂU GI HẾT TRƠN,HICHIC

philipdn đã trích dẫn lệnh HELP của AutoCAD để trả lời cho bạn. Người dùng phần mềm nói chung đều dựa vào phần trợ giúp của nó. Các sách hướng dẫn đa phần đều dịch từ HELP ra cả. Bạn nghĩ xem CAD có bao nhiêu là lệnh, mỗi lệnh lại có các tùy chọn khác nhau, bởi vậy, việc nhớ hết là không tưởng. Trong AutoCAD, chỉ cần gõ lệnh muốn tìm hiểu, enter và nhấn F1 là bạn có ngay hướng dẫn chi tiết cho lệnh đó, đồng thời có cả các ví dụ nữa. Dĩ nhiên, hướng dẫn được viết bằng tiếng Anh, do đó bạn cần phải hiểu được nó. Theo kinh nghiệm của mình, việc đó không cao siêu lắm đâu. Mình cũng bập bõm vài câu tiếng Anh sai chính tả ngữ pháp nhưng đọc hiểu thì có thể từ từ làm được.

Trở lại vấn đề của bạn, nếu bạn muốn giúp đỡ về lệnh USC, bạn có thể nói cụ thể hơn bạn cần nó làm gì không?
Về Đầu Trang Go down
philipdn
Moderator
Moderator
philipdn


Nam Tổng số bài gửi : 320
Age : 40
Đến từ: : Việt Nam
Nghề nghiệp: : Xây dựng cầu đường
Sở thích : Học tập, nghiên cứu và vi tính
Ngày đăng ký : 16/11/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Re: TỔNG HỢP MỘT SỐ LISP CƠ BẢN   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeWed Mar 24, 2010 5:46 pm

Hoan hô anh thuancauduong đã tái xuất gian hồ, Very Happy
Mọi người co nhu cầu, ý kiến gì cứ post bài, anh thuancauduong là một người đầy kinh nghiệm và chuyên nghiệp, nhất là món Autolisp Razz
Về Đầu Trang Go down
http://vn.myblog.yahoo.com/alonestar.cafe
thuancauduong
Thành viên chính thức
Thành viên chính thức



Tổng số bài gửi : 38
Ngày đăng ký : 29/04/2008

TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Re: TỔNG HỢP MỘT SỐ LISP CƠ BẢN   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitimeThu Mar 25, 2010 5:12 pm

philipdn đã viết:
Hoan hô anh thuancauduong đã tái xuất gian hồ, Very Happy
Mọi người co nhu cầu, ý kiến gì cứ post bài, anh thuancauduong là một người đầy kinh nghiệm và chuyên nghiệp, nhất là món Autolisp Razz

philipdn quá lời rồi, mình chỉ biết chút ít, mong có thể giúp đỡ mọi người.
Về Đầu Trang Go down
Sponsored content





TỔNG HỢP MỘT SỐ LISP CƠ BẢN Empty
Bài gửiTiêu đề: Re: TỔNG HỢP MỘT SỐ LISP CƠ BẢN   TỔNG HỢP MỘT SỐ LISP CƠ BẢN Icon_minitime

Về Đầu Trang Go down
 
TỔNG HỢP MỘT SỐ LISP CƠ BẢN
Về Đầu Trang 
Trang 1 trong tổng số 2 trangChuyển đến trang : 1, 2  Next
 Similar topics
-
» Lisp Hỗ trợ in ấn
» Chia sẻ Bộ Lisp rất hay: ”Kho báu của Minh”
» Xin lisp dai taluy !
» SỬA FILE LISP DÙM
» Lisp tính lý trình của 1 hoặc 2 điểm trên 1 polyline và ghi kết quả vào 1 text có sẵn

Permissions in this forum:Bạn không có quyền trả lời bài viết
ZIZU :: CLB AUTO CAD :: Auto lisp & Visua Lisp-
Chuyển đến