Chuyển đến nội dung
Diễn đàn CADViet
Nguyen Hoanh

Viết lisp theo yêu cầu [phần 2]

Các bài được khuyến nghị

Thiết lập cố định khoảng cách từ chân đường kích thước đến đường ghi kích thước,

Mình đã có lisp sau :


(defun GetDxf(n e) (cdr (assoc n e)))

(defun ModDxf(n v e)

(if (GetDxf n e)

(entmod (subst (cons n v) (assoc n e) e))

(entmod (append e (list (cons n v))))

)

)

(defun TSel(et ms) (if ms (princ ms)) (ssget (if et (list (cons 0 et)))) )

 

(defun DimSpace () (* 7 (getvar "dimscale")))

 

(defun AdjustDim1 (p l e / a)

(if (= 0 (logand 92 (GetDxf 70 e)))

(progn

(setq a (angle (GetDxf 14 e) (GetDxf 10 e)))

(ModDxf 10 (polar p a (if (= 1 (rem (GetDxf 70 e) 2)) l (/ l (abs (sin (- a (GetDxf 50 e))))))) e ) )

)

)

 

(defun AdjustDim(ss l / i p)

(if ss (progn

(setq p (trans (getpoint "\nBase point:")1 0) i -1)

(repeat (sslength ss)

(setq i (1+ i) ) (AdjustDim1 p l (entget (ssname ss i)))

) ) )(princ)

)

 

(defun C:AdjustDim() (AdjustDim (TSel "DIMENSION" "\nSelect Dimensions :") (DimSpace)))

 

(defun C:SelfAdjustDim( / e)

(setq i -1 ss (TSel "DIMENSION" "\nSelect Dimensions :") )

(if ss

(repeat (sslength ss)

(setq i (1+ i) e (entget (ssname ss i)) )

(AdjustDim1 (GetDxf 14 e) (DimSpace) e)

) )(princ)

)

Nay nhờ các cao thủ bố sung thêm tính năng sẽ gán được một giá trị chung bất kỳ cho đường dóng (chân dim) của tất cả các đối tượng đã được chọn thì thật hay! (măc định khoảng cách từ basepoint tới đường dim trong lips là 700 )

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác
Theo Tue_NV hiểu nội suy tuyến tính bác ạ

Điểm A có cao độ Za

Điểm B có cao độ Zb

Nội suy cao độ Zc với C nằm giữa A với B

 

Ta hoàn toàn nội suy được theo quy luật ve sự đồng dạng

Hề hề hề,

Chào bác Tue_NV,

Vấn đề chính là hai cái diểm A và B đó bác ạ. Nếu yêu cầu A,B,C thẳng hàng thì ta sẽ có cách làm khác và nếu A,B là các hình chiếu của C xuống các đường đồng mức thì ta sẽ có phương án xử lý khác bác ạ. Tất nhiên là kết quả nội suy của hai phương án này không hẳng đã hoàn toàn giống nhau bác ạ.

Ngay cả với phương án A,B,C thẳng hàng, nếu bác thay đổi cái điểm A trên một đường đồng mức thì kết quả nội suy cũng có thay đổi bác ạ, nếu như các đường đồng mức này không song song với nhau......

Ấy là chưa nói đến trường hợp khi điểm nội suy nằm về cùng một phía đối với các đường đồng mức......

Vì mình không làm trong ngành trắc địa và bản đồ nên không rõ cái quy luật này. Chỉ là sự suy luận theo hình học phổ thông, rất mong các bác chỉ giùm cái quy luật nội suy này.....

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác

Cảm ơn các anh nhiều!

Có điều là e tìm cao độ trong civil 3D, phần mềm này mô phỏng địa hình rồi nên cao độ tại các đỉnh của đối tượng kín đã có, vn61 đề chính ở đây là cần xác định xem đối tượng có bao nhiêu đình và lấy cao độ tại các đỉnh đó thôi, Bài toán này thì e vẫn chưa tìm ra lời giải. Nhờ các a giúp nhiều!

Thanks!

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác
Cảm ơn các anh nhiều!

Có điều là e tìm cao độ trong civil 3D, phần mềm này mô phỏng địa hình rồi nên cao độ tại các đỉnh của đối tượng kín đã có, vn61 đề chính ở đây là cần xác định xem đối tượng có bao nhiêu đình và lấy cao độ tại các đỉnh đó thôi, Bài toán này thì e vẫn chưa tìm ra lời giải. Nhờ các a giúp nhiều!

Thanks!

Việc này thì làm được nhưng mà bạn đưa cái file các đỉnh có cao độ để mọi người thử chứ file bạn đưa bây giờ các đỉnh ấy z=0 hết trọi.

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác
http://s.cadviet.com/oc

 

Tên lệnh là br3

 

Chọn line cần cắt, điểm cắt 1 và 2,

chnđối tượng muốn gán cho đối tượng giữa

 

Ko những chỉ có thể biến thành nét đứt mà thành gì cũng đc

 

 

hix làm theo bác nhưng không đc. bác xem lại giúp với. có cái nào hiệu quả hơn không. Chân thành cảm ơn !

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác

Mong các cao thủ giúp sức. số là em dùng phần mềm nova chạy tk đường. tính diện tích xong xuôi. tuy nhiên sau một thời gian files bản vẽ do chỉnh sửa nhiều nên bây giờ không thể xuất ra bảng khối lượng đc. e bị nhiều lần như vậy. thông thường e vẫn làm là nhập vào excel nhưng rất mất thời gian. Liệu có lisp nào có thể giúp lập lại bảng khối lượng không ? ( Khối lượng của e bao gồm: đất đào, đất đắp, bóc hữu cơ và đánh cấp ). Rất mong các cao thủ giúp 1 tay. Chân thành cảm ơn !

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác
E sử dụng 1 đoạn lisp nó báo lỗi : Cannot set CLAYER to that value.; error: Function cancelled*Invalid* Kính nhờ các bác xem và sửa giùm e.Thanks

http://www.cadviet.com/upfiles/3/mcs.rar

trước khi thực hiện lisp này bạn phải tạo ra các layer có tên như sau: 3 4 7 8 20 100

sửa dòng (command "setvar" "cmdecho" "0") thành (setvar "cmdecho" 0)

BS: sửa các dòng

(command "clayer" 3 "") -> (setvar "clayer" "3")

(command "clayer" 4 "") -> (setvar "clayer" "4")

(command "clayer" 7 "") -> (setvar "clayer" "7")

(command "clayer" 8 "") -> (setvar "clayer" "8")

(command "clayer" 20 "") -> (setvar "clayer" "20")

(command "clayer" 100 "") -> (setvar "clayer" "100")

xoá dòng (command ".select" mm mm1 mm2 "")

Lisp: ý tưởng hay nhưng lỗi nhiều quá.

  • Vote tăng 1

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác
trước khi thực hiện lisp này bạn phải tạo ra các layer có tên như sau: 3 4 7 8 20 100

sửa dòng (command "setvar" "cmdecho" "0") thành (setvar "cmdecho" 0)

BS: sửa các dòng

(command "clayer" 3 "") -> (setvar "clayer" "3")

(command "clayer" 4 "") -> (setvar "clayer" "4")

(command "clayer" 7 "") -> (setvar "clayer" "7")

(command "clayer" 8 "") -> (setvar "clayer" "8")

(command "clayer" 20 "") -> (setvar "clayer" "20")

(command "clayer" 100 "") -> (setvar "clayer" "100")

xoá dòng (command ".select" mm mm1 mm2 "")

Lisp: ý tưởng hay nhưng lỗi nhiều quá.

Cảm ơn bác rất nhiều.Tiện thể bác xem sửa giúp e 1 tí nữa.

http://www.cadviet.com/upfiles/3/drawing1_6.rar

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác
Cảm ơn bác rất nhiều.Tiện thể bác xem sửa giúp e 1 tí nữa.

http://www.cadviet.com/upfiles/3/drawing1_6.rar

Của bạn đây:

;=======================================================

;VE MAT CAT SAN
(defun c:Mcs (/ A1 A2 A3 A4 A5 A6 A7 AA AA1 AM4 B2 B3 B4 B5 B6 B66 B67 B7 BB
      BB11 BB12 BX BX1 C1 C2 C3 C4 C5 C6 CC CL1 DD1 DDAM DDT DY DY1 G1
      G10 G11 G12 G2 G7 G8 G9 GG7 GG8 J1 J10 J11 J12 J13 J14 J2 J3 J4
      J5 J6 J7 J8 J9 JJ1 JJ2 K12 K19 KC KC1 LX LX1 LXY1 LY LY1 MM MM1
      MM2 N10 N11 N12 N13 N14 N15 N16 N17 N18 N19 N7 N8 N9 NBC OD OU OV
      P1 P10 P67 P9 Q1 Q2 Q3 TDD TDD1 TIEP TONG TT1 TTR1 TTR2 TTR3 U1 U2 U3 V1 XG YG)
(taolayer)
 (SETQ NBC (GETVAR "CLAYER"))
 (setvar "osmode" 1)
(setq tiep "C")
  (setq tong 0)
 (setq ddam 350)
(setq dy1 (getreal (strcat "Chieu cao dam < " (itoa  ddam) " >: ")))
 (if (null dy1) (setq dy1 ddam))
 (setq ou 20)
 (setq od 100)
   (setq ov 200)
 (initget 6)
 (setq kc1 (getreal   (strcat "\nkhoang bao ve (mm) <" (itoa ou) ">: ")))
 (if (null kc1) (setq kc1 ou))
(setq dy (* dy1 5))
 (setq kc (* kc1 4))
 (while (= tiep "C")
(setvar "cmdecho" 1)
 (setq BB (getpoint "Diem chen :"))
(setq xg (car BB))
(setq yg (cadr BB))
     (initget 6)
 (setq Ly1 (getreal   (strcat "\nChieu day ban (mm) <" (itoa od) ">: ")))
 (if (null Ly1) (setq Ly1 od))  
   (setq Lxy1 (getreal "Chieu dai nhip(m) :"))
   (setq Lx1 (* Lxy1 1000))
  (setq Bx1 (getreal "Chieu dai thep am (mm):"))
(setq tdd1 (getreal   (strcat "\nKhoang cach cac thanh thep (mm) <" (itoa ov) ">: ")))
 (if (null tdd1) (setq tdd1 ov)) 
(SETQ TTR1 200)
       (setq TTR2 (RTOS TTR1 2 0))
   (setq Tt1 (RTOS TDD1 2 0))
   (setq dd1 (STRCAT "a"TT1""))
   (setq ddT (STRCAT "a"TTR2""))
     (setq Lx (* Lx1 4))
   (setq tong (+ tong Lx)) 
  (setq Ly (* Ly1 5))
     (setq Bx (* Bx1 4))
  (setq tdd (* tdd1 4))
   (setq TTR3 (* TTR1 4))
  (setq B2 (list xg (+ yg Ly)))
(setq B3 (list xg (+ (- yg dy) Ly)))
(setq B4 (polar B3 0 880))
(setq B5 (polar BB 0 880))
   (setq B6 (polar BB 0 Lx))
   (setq B66 (polar B6 (* Pi 1.5) (-  dy Ly)))
  (setq B67 (polar B66 0 440))
(setq B7 (polar B2 0 (+ Lx 440)))
 (setq p1 (/ Bx TTR3))
(setq g1 (fix p1))
(setq g2 (- g1 1))
(setq v1 (/ (- Lx 880) tdd))
(setq u1 (fix v1))
(setq u2 (+ u1 1))
  (setq u3 (- (/ (- Lx (* u1 tdd)) 2) 440))  
      (setq A1 (list (+ xg 440) (+ yg kc)))
       (setq A2 (list (+ xg 440) (- (cadr B2) kc)))
     (setq A3 (polar A2 0 Bx))
      (setq A4 (polar A1 0 Bx))
      (setq Am4 (polar A4 (* Pi 1.5) kc))
       (setq A5 (list (- (car A3) 50) (- (cadr A3) 50)))
(setq J5 A5)
   (setq A7 (list (+ (+ (car A1) 440) u3) (+ (cadr A1) 50)))
   (setq N7 (polar A7 0 tdd))
   (setq N8 (polar N7 0 tdd))
   (setq N9 (list (+ (car N7) (* 0.5 tdd)) (- (cadr n7) (+ 900 (* 1.5 KC)))))
   (setq N10 (polar N9 0 900))
   (setq N11 (polar N10 0 250))
   (setq N12 (list (+ (car N9) 450) (+ (cadr N9) 220)))
   (setq K12 (polar N12 (* Pi 1.5) 440))
   (setq N13 (list (+ (car a7) (* tdd 6.5)) (cadr a1)))
   (setq N14 (polar N13 (* Pi 1.25) kc))
   (setq N15 (polar N13 (* Pi 0.25) kc))
   (setq N16 (polar N13 (* Pi 1.5) (+ 900 kc)))
   (setq N17 (polar N16 0 900))
   (setq N18 (polar N17 0 250))
   (setq N19 (list (+ (car N16) 450) (+ (cadr N16) 220)))
   (setq K19 (polar N19 (* Pi 1.5) 440))
   (command "osmode" 0 "")
   (setvar "CLAYER" "8")
   (command ".line" N7 N9 N8 "")
   (command ".line" N10 N9 "")
   (command ".line" N14 N15 "")
   (command ".line" N13 N16 N17 "")
   (setvar "CLAYER" "3")
   (command ".text" "mc" N12 "250" "0" "/G10" "")
   (command ".text" "mc" N19 "250" "0" "/g10" "")
   (command ".text" "mc" K12 "250" "0" DD1 "")
   (command ".text" "mc" K19 "250" "0" DD1 "")
(setq A6 (polar A1 0 Lx))
      (setq AA1 (polar A3 (* 1.5 Pi) Ly))
      (setq AA (polar A2 (* 0.5 Pi) 1500))
      (setq C1 (polar B3 0 440))
     (setq C3 (polar C1 0 Lx))
      (setq C5 (polar C1 (* 1.5 Pi) 800))
     (setq C2 (polar C5 0 (/ Lx 2)))
      (setq C6 (polar C5 (* 1.5 Pi) 100))
     (setq C4 (polar C6 (* 1.5 Pi) 350))
      (setq CC (polar C2 (* 0.5 Pi) 250))
   (command "osmode" 0 "")
 (setvar "CLAYER" "3")
    (command "donut" "0" kc A5 A7"")
      (repeat g2
   (setq A5 (polar A5 Pi TTR3))
(command "donut" "0" kc A5 "")
   )
 (setq mm (ssget "W" A2 AA1))
   (setq J6 (polar J5 Pi TTR3))
   (setq J4 (polar A3 Pi (* TTR3 1.5)))
   (setq jj1 (polar j4 (* Pi 1.25) kc))
   (setq jj2 (polar j4 (* Pi 0.25) kc))
   (setvar "CLAYER" "8")
   (command ".line" JJ1 JJ2 "")
   (setq J7 (polar J6 0 (* TTR3 0.5)))
   (setq J8 (polar J7 (* 0.5 Pi) 800))
   (setq J3 (polar J4 (* 0.5 Pi) 800))
   (setq J2 (polar J3 Pi 900))
   (setq J9 (polar J8 0 900))
   (setq J10 (polar J9 0 250))
   (setq J1 (polar J2 Pi 250))
   (command ".line" J5 J8 J6 "")
   (command ".line" J8 J9 "")
   (command ".line" J4 J3 J2 "")
   (command ".circle" J1 "d" 500)
   (setq cl1 (entlast))
   (setq J11 (list (+ (car J2) 450) (+ (cadr J2) 220)))
   (setq J12 (polar J11 (* Pi 1.5) 440))
   (setq J13 (list (+ (car J8) 450) (+ (cadr J8) 220)))
   (setq J14 (polar J13 (* Pi 1.5) 440))
   (setvar "CLAYER" "3") 
   (command ".text" "mc" J11 "250" "0" "/G10" "")
   (command ".text" "mc" J13 "250" "0" "%%c6" "")
   (command ".text" "mc" J12 "250" "0" DDT "")
   (command ".text" "mc" J14 "250" "0" "a200" "")
   (command "-ATTDEF" ""  "+" "1" "1" "j" "mc" J1 "250" "")
   (if (= (tblsearch "block" "ghithep") nil)
   (command "block" "ghithep" J1 (entlast) cl1 "")
   )
   (if (/= (tblsearch "block" "ghithep") nil)
   (command "block" "ghithep" "y" J1 (entlast) cl1 "")
   )
   (repeat u1
   (setq A7 (polar A7 0 tdd))
   (command "donut" "0" kc A7 "")
   )
   (setvar "CLAYER" "7")
   (command ".line" BB B3 B4 B5 B6 "")
   (command ".line" B2 B7 "")
   (command ".line" B6 B66 B67 "")
   (command ".line" C5 C6 "")
   (setvar "CLAYER" "4")
   (command ".pline" A2 A3 Am4 "")
   (setq mm1 (ssget "L")) 
   (command ".line" A1 A6 "")
   (setvar "CLAYER" "100")
   (command ".DIMLINEAR" C1 C3 C2)
   (setq BB11 (polar BB (* 1 Pi) 500))
   (setq BB12 (polar BB11 (* 1 Pi) 700)) 
   (setvar "CLAYER" "20")
   (command ".DIMLINEAR" BB B2 BB11)
   (command ".DIMLINEAR" B3 B2 BB12)
   (setvar "CLAYER" "100")
   (command ".DIMLINEAR" A2 A3 AA)
   (setq mm2 (ssget "L"))
   (chenblock N11 1 1)
 (chenblock N18 1 1)
 (chenblock J1 "1" "1")
 (chenblock J10 "1" "1")
 (chenblock C4 "1.4" "1.4")
   (command ".select" mm mm1 mm2 "")
   (command ".mirror" "p" "" C2 CC "")
 (initget 1 "C K")
 (setq tiep (strcase (getkword "Lam tiep cau kien khac [1©/2(K)] :")))
   )
 (setq g7 (polar B67 (* Pi 0) 440))
 (setq g8 (polar g7 (* Pi 0.5) dy))
 (setq g9 (polar g8 (* Pi 1) 440))
 (setq g10 (polar g9 (* Pi 1.5) kc))
 (setq j10 (polar g9 (* Pi 1.5) (- Ly kc)))
 (setq g11 (polar g10 (* Pi 0) 360))
 (setq g12 (polar g11 (* Pi 1.5) (- Ly kc)))
 (setq p67 (polar b67 (* 1.5 Pi) 800))
 (setq p9 (polar p67 (* 1.5 Pi) 100))
 (setq p10 (polar p9 (* 1.5 Pi) 350))
 (setq j11 (polar j10 0 300))
 (setq j12 (polar j11 (* 0.5 Pi) 100))
 (setq j13 (polar j12 Pi 90))
 (chenblock p10 "1.4" "1.4")
 (setvar "CLAYER" "4")
 (command "pline" j13 j12 "a" "a" -180 j11 "l" j10 "")
  (setq Q1 (ssget "L")) 
 (command "pline" g10 g11 g12 "")
 (setq Q2 (ssget "L")) 
 (setvar "CLAYER" "7")
 (command ".line" B67 g7 "")
 (command ".line" g8 g9 "")
 (command ".line" g8 g7 "")
 (setq gG7 (polar G7 Pi (/ (+ tong 880) 2)))
 (setq gG8 (polar G8 Pi (/ (+ tong 880) 2)))
 (setq Q3 (ssget "L")) 
 (command ".line" p9 p67 "")
 (command ".select" Q1 Q2 Q3 "")
 (command ".mirror" "p" "" GG7 GG8 "")
 (setvar "osmode" 691)
 (SETVAR "CLAYER" NBC)
)
(defun taolayer ()
(if (= (tblsearch "layer" "3") nil) (command "layer" "n" "3" ""))
(if (= (tblsearch "layer" "4") nil) (command "layer" "n" "4" ""))
(if (= (tblsearch "layer" "7") nil) (command "layer" "n" "7" ""))
(if (= (tblsearch "layer" "8") nil) (command "layer" "n" "8" ""))
(if (= (tblsearch "layer" "20") nil) (command "layer" "n" "20" ""))
(if (= (tblsearch "layer" "100") nil) (command "layer" "n" "100" ""))
)
(defun chenblock ( dcb x y /)
(command "-insert" "ghithep" dcb x y "" "")
)

  • Vote tăng 2

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác
Của bạn đây:

;=======================================================

;VE MAT CAT SAN
(defun c:Mcs (/ A1 A2 A3 A4 A5 A6 A7 AA AA1 AM4 B2 B3 B4 B5 B6 B66 B67 B7 BB
      BB11 BB12 BX BX1 C1 C2 C3 C4 C5 C6 CC CL1 DD1 DDAM DDT DY DY1 G1
      G10 G11 G12 G2 G7 G8 G9 GG7 GG8 J1 J10 J11 J12 J13 J14 J2 J3 J4
      J5 J6 J7 J8 J9 JJ1 JJ2 K12 K19 KC KC1 LX LX1 LXY1 LY LY1 MM MM1
      MM2 N10 N11 N12 N13 N14 N15 N16 N17 N18 N19 N7 N8 N9 NBC OD OU OV
      P1 P10 P67 P9 Q1 Q2 Q3 TDD TDD1 TIEP TONG TT1 TTR1 TTR2 TTR3 U1 U2 U3 V1 XG YG)
(taolayer)
 (SETQ NBC (GETVAR "CLAYER"))
 (setvar "osmode" 1)
(setq tiep "C")
  (setq tong 0)
 (setq ddam 350)
(setq dy1 (getreal (strcat "Chieu cao dam < " (itoa  ddam) " >: ")))
 (if (null dy1) (setq dy1 ddam))
 (setq ou 20)
 (setq od 100)
   (setq ov 200)
 (initget 6)
 (setq kc1 (getreal   (strcat "\nkhoang bao ve (mm) <" (itoa ou) ">: ")))
 (if (null kc1) (setq kc1 ou))
(setq dy (* dy1 5))
 (setq kc (* kc1 4))
 (while (= tiep "C")
(setvar "cmdecho" 1)
 (setq BB (getpoint "Diem chen :"))
(setq xg (car BB))
(setq yg (cadr BB))
     (initget 6)
 (setq Ly1 (getreal   (strcat "\nChieu day ban (mm) <" (itoa od) ">: ")))
 (if (null Ly1) (setq Ly1 od))  
   (setq Lxy1 (getreal "Chieu dai nhip(m) :"))
   (setq Lx1 (* Lxy1 1000))
  (setq Bx1 (getreal "Chieu dai thep am (mm):"))
(setq tdd1 (getreal   (strcat "\nKhoang cach cac thanh thep (mm) <" (itoa ov) ">: ")))
 (if (null tdd1) (setq tdd1 ov)) 
(SETQ TTR1 200)
       (setq TTR2 (RTOS TTR1 2 0))
   (setq Tt1 (RTOS TDD1 2 0))
   (setq dd1 (STRCAT "a"TT1""))
   (setq ddT (STRCAT "a"TTR2""))
     (setq Lx (* Lx1 4))
   (setq tong (+ tong Lx)) 
  (setq Ly (* Ly1 5))
     (setq Bx (* Bx1 4))
  (setq tdd (* tdd1 4))
   (setq TTR3 (* TTR1 4))
  (setq B2 (list xg (+ yg Ly)))
(setq B3 (list xg (+ (- yg dy) Ly)))
(setq B4 (polar B3 0 880))
(setq B5 (polar BB 0 880))
   (setq B6 (polar BB 0 Lx))
   (setq B66 (polar B6 (* Pi 1.5) (-  dy Ly)))
  (setq B67 (polar B66 0 440))
(setq B7 (polar B2 0 (+ Lx 440)))
 (setq p1 (/ Bx TTR3))
(setq g1 (fix p1))
(setq g2 (- g1 1))
(setq v1 (/ (- Lx 880) tdd))
(setq u1 (fix v1))
(setq u2 (+ u1 1))
  (setq u3 (- (/ (- Lx (* u1 tdd)) 2) 440))  
      (setq A1 (list (+ xg 440) (+ yg kc)))
       (setq A2 (list (+ xg 440) (- (cadr B2) kc)))
     (setq A3 (polar A2 0 Bx))
      (setq A4 (polar A1 0 Bx))
      (setq Am4 (polar A4 (* Pi 1.5) kc))
       (setq A5 (list (- (car A3) 50) (- (cadr A3) 50)))
(setq J5 A5)
   (setq A7 (list (+ (+ (car A1) 440) u3) (+ (cadr A1) 50)))
   (setq N7 (polar A7 0 tdd))
   (setq N8 (polar N7 0 tdd))
   (setq N9 (list (+ (car N7) (* 0.5 tdd)) (- (cadr n7) (+ 900 (* 1.5 KC)))))
   (setq N10 (polar N9 0 900))
   (setq N11 (polar N10 0 250))
   (setq N12 (list (+ (car N9) 450) (+ (cadr N9) 220)))
   (setq K12 (polar N12 (* Pi 1.5) 440))
   (setq N13 (list (+ (car a7) (* tdd 6.5)) (cadr a1)))
   (setq N14 (polar N13 (* Pi 1.25) kc))
   (setq N15 (polar N13 (* Pi 0.25) kc))
   (setq N16 (polar N13 (* Pi 1.5) (+ 900 kc)))
   (setq N17 (polar N16 0 900))
   (setq N18 (polar N17 0 250))
   (setq N19 (list (+ (car N16) 450) (+ (cadr N16) 220)))
   (setq K19 (polar N19 (* Pi 1.5) 440))
   (command "osmode" 0 "")
   (setvar "CLAYER" "8")
   (command ".line" N7 N9 N8 "")
   (command ".line" N10 N9 "")
   (command ".line" N14 N15 "")
   (command ".line" N13 N16 N17 "")
   (setvar "CLAYER" "3")
   (command ".text" "mc" N12 "250" "0" "/G10" "")
   (command ".text" "mc" N19 "250" "0" "/g10" "")
   (command ".text" "mc" K12 "250" "0" DD1 "")
   (command ".text" "mc" K19 "250" "0" DD1 "")
(setq A6 (polar A1 0 Lx))
      (setq AA1 (polar A3 (* 1.5 Pi) Ly))
      (setq AA (polar A2 (* 0.5 Pi) 1500))
      (setq C1 (polar B3 0 440))
     (setq C3 (polar C1 0 Lx))
      (setq C5 (polar C1 (* 1.5 Pi) 800))
     (setq C2 (polar C5 0 (/ Lx 2)))
      (setq C6 (polar C5 (* 1.5 Pi) 100))
     (setq C4 (polar C6 (* 1.5 Pi) 350))
      (setq CC (polar C2 (* 0.5 Pi) 250))
   (command "osmode" 0 "")
 (setvar "CLAYER" "3")
    (command "donut" "0" kc A5 A7"")
      (repeat g2
   (setq A5 (polar A5 Pi TTR3))
(command "donut" "0" kc A5 "")
   )
 (setq mm (ssget "W" A2 AA1))
   (setq J6 (polar J5 Pi TTR3))
   (setq J4 (polar A3 Pi (* TTR3 1.5)))
   (setq jj1 (polar j4 (* Pi 1.25) kc))
   (setq jj2 (polar j4 (* Pi 0.25) kc))
   (setvar "CLAYER" "8")
   (command ".line" JJ1 JJ2 "")
   (setq J7 (polar J6 0 (* TTR3 0.5)))
   (setq J8 (polar J7 (* 0.5 Pi) 800))
   (setq J3 (polar J4 (* 0.5 Pi) 800))
   (setq J2 (polar J3 Pi 900))
   (setq J9 (polar J8 0 900))
   (setq J10 (polar J9 0 250))
   (setq J1 (polar J2 Pi 250))
   (command ".line" J5 J8 J6 "")
   (command ".line" J8 J9 "")
   (command ".line" J4 J3 J2 "")
   (command ".circle" J1 "d" 500)
   (setq cl1 (entlast))
   (setq J11 (list (+ (car J2) 450) (+ (cadr J2) 220)))
   (setq J12 (polar J11 (* Pi 1.5) 440))
   (setq J13 (list (+ (car J8) 450) (+ (cadr J8) 220)))
   (setq J14 (polar J13 (* Pi 1.5) 440))
   (setvar "CLAYER" "3") 
   (command ".text" "mc" J11 "250" "0" "/G10" "")
   (command ".text" "mc" J13 "250" "0" "%%c6" "")
   (command ".text" "mc" J12 "250" "0" DDT "")
   (command ".text" "mc" J14 "250" "0" "a200" "")
   (command "-ATTDEF" ""  "+" "1" "1" "j" "mc" J1 "250" "")
   (if (= (tblsearch "block" "ghithep") nil)
   (command "block" "ghithep" J1 (entlast) cl1 "")
   )
   (if (/= (tblsearch "block" "ghithep") nil)
   (command "block" "ghithep" "y" J1 (entlast) cl1 "")
   )
   (repeat u1
   (setq A7 (polar A7 0 tdd))
   (command "donut" "0" kc A7 "")
   )
   (setvar "CLAYER" "7")
   (command ".line" BB B3 B4 B5 B6 "")
   (command ".line" B2 B7 "")
   (command ".line" B6 B66 B67 "")
   (command ".line" C5 C6 "")
   (setvar "CLAYER" "4")
   (command ".pline" A2 A3 Am4 "")
   (setq mm1 (ssget "L")) 
   (command ".line" A1 A6 "")
   (setvar "CLAYER" "100")
   (command ".DIMLINEAR" C1 C3 C2)
   (setq BB11 (polar BB (* 1 Pi) 500))
   (setq BB12 (polar BB11 (* 1 Pi) 700)) 
   (setvar "CLAYER" "20")
   (command ".DIMLINEAR" BB B2 BB11)
   (command ".DIMLINEAR" B3 B2 BB12)
   (setvar "CLAYER" "100")
   (command ".DIMLINEAR" A2 A3 AA)
   (setq mm2 (ssget "L"))
   (chenblock N11 1 1)
 (chenblock N18 1 1)
 (chenblock J1 "1" "1")
 (chenblock J10 "1" "1")
 (chenblock C4 "1.4" "1.4")
   (command ".select" mm mm1 mm2 "")
   (command ".mirror" "p" "" C2 CC "")
 (initget 1 "C K")
 (setq tiep (strcase (getkword "Lam tiep cau kien khac [1©/2(K)] :")))
   )
 (setq g7 (polar B67 (* Pi 0) 440))
 (setq g8 (polar g7 (* Pi 0.5) dy))
 (setq g9 (polar g8 (* Pi 1) 440))
 (setq g10 (polar g9 (* Pi 1.5) kc))
 (setq j10 (polar g9 (* Pi 1.5) (- Ly kc)))
 (setq g11 (polar g10 (* Pi 0) 360))
 (setq g12 (polar g11 (* Pi 1.5) (- Ly kc)))
 (setq p67 (polar b67 (* 1.5 Pi) 800))
 (setq p9 (polar p67 (* 1.5 Pi) 100))
 (setq p10 (polar p9 (* 1.5 Pi) 350))
 (setq j11 (polar j10 0 300))
 (setq j12 (polar j11 (* 0.5 Pi) 100))
 (setq j13 (polar j12 Pi 90))
 (chenblock p10 "1.4" "1.4")
 (setvar "CLAYER" "4")
 (command "pline" j13 j12 "a" "a" -180 j11 "l" j10 "")
  (setq Q1 (ssget "L")) 
 (command "pline" g10 g11 g12 "")
 (setq Q2 (ssget "L")) 
 (setvar "CLAYER" "7")
 (command ".line" B67 g7 "")
 (command ".line" g8 g9 "")
 (command ".line" g8 g7 "")
 (setq gG7 (polar G7 Pi (/ (+ tong 880) 2)))
 (setq gG8 (polar G8 Pi (/ (+ tong 880) 2)))
 (setq Q3 (ssget "L")) 
 (command ".line" p9 p67 "")
 (command ".select" Q1 Q2 Q3 "")
 (command ".mirror" "p" "" GG7 GG8 "")
 (setvar "osmode" 691)
 (SETVAR "CLAYER" NBC)
)
(defun taolayer ()
(if (= (tblsearch "layer" "3") nil) (command "layer" "n" "3" ""))
(if (= (tblsearch "layer" "4") nil) (command "layer" "n" "4" ""))
(if (= (tblsearch "layer" "7") nil) (command "layer" "n" "7" ""))
(if (= (tblsearch "layer" "8") nil) (command "layer" "n" "8" ""))
(if (= (tblsearch "layer" "20") nil) (command "layer" "n" "20" ""))
(if (= (tblsearch "layer" "100") nil) (command "layer" "n" "100" ""))
)
(defun chenblock ( dcb x y /)
(command "-insert" "ghithep" dcb x y "" "")
)

Bác xem lại giúp,sau khi vẽ xong hỏi có vẽ tiếp không nếu CÓ thì tự động mất toàn bộ truy bắt điểm.Cảm ơn bác nhiều.

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác
Mong các cao thủ giúp sức. số là em dùng phần mềm nova chạy tk đường. tính diện tích xong xuôi. tuy nhiên sau một thời gian files bản vẽ do chỉnh sửa nhiều nên bây giờ không thể xuất ra bảng khối lượng đc. e bị nhiều lần như vậy. thông thường e vẫn làm là nhập vào excel nhưng rất mất thời gian. Liệu có lisp nào có thể giúp lập lại bảng khối lượng không ? ( Khối lượng của e bao gồm: đất đào, đất đắp, bóc hữu cơ và đánh cấp ). Rất mong các cao thủ giúp 1 tay. Chân thành cảm ơn !

 

Trong Nova có lệnh THB hiệu chỉnh xuất khối lượng qua EXCEL mà

Bạn thử xem

Nếu không được thì bạn gửi file lên tôi xem thử

  • Vote tăng 1

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác
Bác xem lại giúp,sau khi vẽ xong hỏi có vẽ tiếp không nếu CÓ thì tự động mất toàn bộ truy bắt điểm.Cảm ơn bác nhiều.

Của bạn đây. Cám ơn bạn vì lisp này cũng rất hay.

;; free lisp from cadviet.com

;=======================================================

;VE MAT CAT SAN
(defun c:Mcs (/ A1 A2 A3 A4 A5 A6 A7 AA AA1 AM4 B2 B3 B4 B5 B6 B66 B67 B7 BB
BB11 BB12 BX BX1 C1 C2 C3 C4 C5 C6 CC CL1 DD1 DDAM DDT DY DY1 G1
G10 G11 G12 G2 G7 G8 G9 GG7 GG8 J1 J10 J11 J12 J13 J14 J2 J3 J4
J5 J6 J7 J8 J9 JJ1 JJ2 K12 K19 KC KC1 LX LX1 LXY1 LY LY1 MM MM1
MM2 N10 N11 N12 N13 N14 N15 N16 N17 N18 N19 N7 N8 N9 NBC OD OU OV
P1 P10 P67 P9 Q1 Q2 Q3 TDD TDD1 TIEP TONG TT1 TTR1 TTR2 TTR3 U1 U2 U3 V1 XG YG)
(taolayer)
(SETQ NBC (GETVAR "CLAYER"))
(setvar "osmode" 1)
(setq tiep "C")
(setq tong 0)
(setq ddam 350)
(setq dy1 (getreal (strcat "Chieu cao dam < " (itoa ddam) " >: ")))
(if (null dy1) (setq dy1 ddam))
(setq ou 20)
(setq od 100)
(setq ov 200)
(initget 6)
(setq kc1 (getreal (strcat "\nkhoang bao ve (mm) <" (itoa ou) ">: ")))
(if (null kc1) (setq kc1 ou))
(setq dy (* dy1 5))
(setq kc (* kc1 4))
(while (= tiep "C")
(setvar "cmdecho" 0)
(setvar "osmode" 15359)
(setq BB (getpoint "Diem chen :"))
(setvar "osmode" 0)
(setq xg (car BB))
(setq yg (cadr BB))
(initget 6)
(setq Ly1 (getreal (strcat "\nChieu day ban (mm) <" (itoa od) ">: ")))
(if (null Ly1) (setq Ly1 od)) 
(setq Lxy1 (getreal "Chieu dai nhip(m) :"))
(setq Lx1 (* Lxy1 1000))
(setq Bx1 (getreal "Chieu dai thep am (mm):"))
(setq tdd1 (getreal (strcat "\nKhoang cach cac thanh thep (mm) <" (itoa ov) ">: ")))
(if (null tdd1) (setq tdd1 ov)) 
(SETQ TTR1 200)
(setq TTR2 (RTOS TTR1 2 0))
(setq Tt1 (RTOS TDD1 2 0))
(setq dd1 (STRCAT "a"TT1""))
(setq ddT (STRCAT "a"TTR2""))
(setq Lx (* Lx1 4))
(setq tong (+ tong Lx)) 
(setq Ly (* Ly1 5))
(setq Bx (* Bx1 4))
(setq tdd (* tdd1 4))
(setq TTR3 (* TTR1 4))
(setq B2 (list xg (+ yg Ly)))
(setq B3 (list xg (+ (- yg dy) Ly)))
(setq B4 (polar B3 0 880))
(setq B5 (polar BB 0 880))
(setq B6 (polar BB 0 Lx))
(setq B66 (polar B6 (* Pi 1.5) (- dy Ly)))
(setq B67 (polar B66 0 440))
(setq B7 (polar B2 0 (+ Lx 440)))
(setq p1 (/ Bx TTR3))
(setq g1 (fix p1))
(setq g2 (- g1 1))
(setq v1 (/ (- Lx 880) tdd))
(setq u1 (fix v1))
(setq u2 (+ u1 1))
(setq u3 (- (/ (- Lx (* u1 tdd)) 2) 440)) 
(setq A1 (list (+ xg 440) (+ yg kc)))
(setq A2 (list (+ xg 440) (- (cadr B2) kc)))
(setq A3 (polar A2 0 Bx))
(setq A4 (polar A1 0 Bx))
(setq Am4 (polar A4 (* Pi 1.5) kc))
(setq A5 (list (- (car A3) 50) (- (cadr A3) 50)))
(setq J5 A5)
(setq A7 (list (+ (+ (car A1) 440) u3) (+ (cadr A1) 50)))
(setq N7 (polar A7 0 tdd))
(setq N8 (polar N7 0 tdd))
(setq N9 (list (+ (car N7) (* 0.5 tdd)) (- (cadr n7) (+ 900 (* 1.5 KC)))))
(setq N10 (polar N9 0 900))
(setq N11 (polar N10 0 250))
(setq N12 (list (+ (car N9) 450) (+ (cadr N9) 220)))
(setq K12 (polar N12 (* Pi 1.5) 440))
(setq N13 (list (+ (car a7) (* tdd 6.5)) (cadr a1)))
(setq N14 (polar N13 (* Pi 1.25) kc))
(setq N15 (polar N13 (* Pi 0.25) kc))
(setq N16 (polar N13 (* Pi 1.5) (+ 900 kc)))
(setq N17 (polar N16 0 900))
(setq N18 (polar N17 0 250))
(setq N19 (list (+ (car N16) 450) (+ (cadr N16) 220)))
(setq K19 (polar N19 (* Pi 1.5) 440))
(command "osmode" 0 "")
(setvar "CLAYER" "8")
(command ".line" N7 N9 N8 "")
(command ".line" N10 N9 "")
(command ".line" N14 N15 "")
(command ".line" N13 N16 N17 "")
(setvar "CLAYER" "3")
(command ".text" "mc" N12 "250" "0" "/G10" "")
(command ".text" "mc" N19 "250" "0" "/g10" "")
(command ".text" "mc" K12 "250" "0" DD1 "")
(command ".text" "mc" K19 "250" "0" DD1 "")
(setq A6 (polar A1 0 Lx))
(setq AA1 (polar A3 (* 1.5 Pi) Ly))
(setq AA (polar A2 (* 0.5 Pi) 1500))
(setq C1 (polar B3 0 440))
(setq C3 (polar C1 0 Lx))
(setq C5 (polar C1 (* 1.5 Pi) 800))
(setq C2 (polar C5 0 (/ Lx 2)))
(setq C6 (polar C5 (* 1.5 Pi) 100))
(setq C4 (polar C6 (* 1.5 Pi) 350))
(setq CC (polar C2 (* 0.5 Pi) 250))
(command "osmode" 0 "")
(setvar "CLAYER" "3")
(command "donut" "0" kc A5 A7"")
(repeat g2
(setq A5 (polar A5 Pi TTR3))
(command "donut" "0" kc A5 "")
)
(setq mm (ssget "W" A2 AA1))
(setq J6 (polar J5 Pi TTR3))
(setq J4 (polar A3 Pi (* TTR3 1.5)))
(setq jj1 (polar j4 (* Pi 1.25) kc))
(setq jj2 (polar j4 (* Pi 0.25) kc))
(setvar "CLAYER" "8")
(command ".line" JJ1 JJ2 "")
(setq J7 (polar J6 0 (* TTR3 0.5)))
(setq J8 (polar J7 (* 0.5 Pi) 800))
(setq J3 (polar J4 (* 0.5 Pi) 800))
(setq J2 (polar J3 Pi 900))
(setq J9 (polar J8 0 900))
(setq J10 (polar J9 0 250))
(setq J1 (polar J2 Pi 250))
(command ".line" J5 J8 J6 "")
(command ".line" J8 J9 "")
(command ".line" J4 J3 J2 "")
(command ".circle" J1 "d" 500)
(setq cl1 (entlast))
(setq J11 (list (+ (car J2) 450) (+ (cadr J2) 220)))
(setq J12 (polar J11 (* Pi 1.5) 440))
(setq J13 (list (+ (car J8) 450) (+ (cadr J8) 220)))
(setq J14 (polar J13 (* Pi 1.5) 440))
(setvar "CLAYER" "3") 
(command ".text" "mc" J11 "250" "0" "/G10" "")
(command ".text" "mc" J13 "250" "0" "%%c6" "")
(command ".text" "mc" J12 "250" "0" DDT "")
(command ".text" "mc" J14 "250" "0" "a200" "")
(command "-ATTDEF" "" "+" "1" "1" "j" "mc" J1 "250" "")
(if (= (tblsearch "block" "ghithep") nil)
(command "block" "ghithep" J1 (entlast) cl1 "")
)
(if (/= (tblsearch "block" "ghithep") nil)
(command "block" "ghithep" "y" J1 (entlast) cl1 "")
)
(repeat u1
(setq A7 (polar A7 0 tdd))
(command "donut" "0" kc A7 "")
)
(setvar "CLAYER" "7")
(command ".line" BB B3 B4 B5 B6 "")
(command ".line" B2 B7 "")
(command ".line" B6 B66 B67 "")
(command ".line" C5 C6 "")
(setvar "CLAYER" "4")
(command ".pline" A2 A3 Am4 "")
(setq mm1 (ssget "L")) 
(command ".line" A1 A6 "")
(setvar "CLAYER" "100")
(command ".DIMLINEAR" C1 C3 C2)
(setq BB11 (polar BB (* 1 Pi) 500))
(setq BB12 (polar BB11 (* 1 Pi) 700)) 
(setvar "CLAYER" "20")
(command ".DIMLINEAR" BB B2 BB11)
(command ".DIMLINEAR" B3 B2 BB12)
(setvar "CLAYER" "100")
(command ".DIMLINEAR" A2 A3 AA)
(setq mm2 (ssget "L"))
(chenblock N11 1 1)
(chenblock N18 1 1)
(chenblock J1 "1" "1")
(chenblock J10 "1" "1")
(chenblock C4 "1.4" "1.4")
(command ".select" mm mm1 mm2 "")
(command ".mirror" "p" "" C2 CC "")
(initget 1 "C K")
(setq tiep (strcase (getkword "Lam tiep cau kien khac [1©/2(K)] :")))
)
(setq g7 (polar B67 (* Pi 0) 440))
(setq g8 (polar g7 (* Pi 0.5) dy))
(setq g9 (polar g8 (* Pi 1) 440))
(setq g10 (polar g9 (* Pi 1.5) kc))
(setq j10 (polar g9 (* Pi 1.5) (- Ly kc)))
(setq g11 (polar g10 (* Pi 0) 360))
(setq g12 (polar g11 (* Pi 1.5) (- Ly kc)))
(setq p67 (polar b67 (* 1.5 Pi) 800))
(setq p9 (polar p67 (* 1.5 Pi) 100))
(setq p10 (polar p9 (* 1.5 Pi) 350))
(setq j11 (polar j10 0 300))
(setq j12 (polar j11 (* 0.5 Pi) 100))
(setq j13 (polar j12 Pi 90))
(chenblock p10 "1.4" "1.4")
(setvar "CLAYER" "4")
(command "pline" j13 j12 "a" "a" -180 j11 "l" j10 "")
(setq Q1 (ssget "L")) 
(command "pline" g10 g11 g12 "")
(setq Q2 (ssget "L")) 
(setvar "CLAYER" "7")
(command ".line" B67 g7 "")
(command ".line" g8 g9 "")
(command ".line" g8 g7 "")
(setq gG7 (polar G7 Pi (/ (+ tong 880) 2)))
(setq gG8 (polar G8 Pi (/ (+ tong 880) 2)))
(setq Q3 (ssget "L")) 
(command ".line" p9 p67 "")
(command ".select" Q1 Q2 Q3 "")
(command ".mirror" "p" "" GG7 GG8 "")
(setvar "osmode" 691)
(SETVAR "CLAYER" NBC)
)
(defun taolayer ()
(if (= (tblsearch "layer" "3") nil) (command "layer" "n" "3" ""))
(if (= (tblsearch "layer" "4") nil) (command "layer" "n" "4" ""))
(if (= (tblsearch "layer" "7") nil) (command "layer" "n" "7" ""))
(if (= (tblsearch "layer" "8") nil) (command "layer" "n" "8" ""))
(if (= (tblsearch "layer" "20") nil) (command "layer" "n" "20" ""))
(if (= (tblsearch "layer" "100") nil) (command "layer" "n" "100" ""))
)
(defun chenblock ( dcb x y /)
(command "-insert" "ghithep" dcb x y "" "")
)

  • Vote tăng 1

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác
Của bạn đây. Cám ơn bạn vì lisp này cũng rất hay.

;; free lisp from cadviet.com

;=======================================================

;VE MAT CAT SAN
(defun c:Mcs (/ A1 A2 A3 A4 A5 A6 A7 AA AA1 AM4 B2 B3 B4 B5 B6 B66 B67 B7 BB
BB11 BB12 BX BX1 C1 C2 C3 C4 C5 C6 CC CL1 DD1 DDAM DDT DY DY1 G1
G10 G11 G12 G2 G7 G8 G9 GG7 GG8 J1 J10 J11 J12 J13 J14 J2 J3 J4
J5 J6 J7 J8 J9 JJ1 JJ2 K12 K19 KC KC1 LX LX1 LXY1 LY LY1 MM MM1
MM2 N10 N11 N12 N13 N14 N15 N16 N17 N18 N19 N7 N8 N9 NBC OD OU OV
P1 P10 P67 P9 Q1 Q2 Q3 TDD TDD1 TIEP TONG TT1 TTR1 TTR2 TTR3 U1 U2 U3 V1 XG YG)
(taolayer)
(SETQ NBC (GETVAR "CLAYER"))
(setvar "osmode" 1)
(setq tiep "C")
(setq tong 0)
(setq ddam 350)
(setq dy1 (getreal (strcat "Chieu cao dam < " (itoa ddam) " >: ")))
(if (null dy1) (setq dy1 ddam))
(setq ou 20)
(setq od 100)
(setq ov 200)
(initget 6)
(setq kc1 (getreal (strcat "\nkhoang bao ve (mm) <" (itoa ou) ">: ")))
(if (null kc1) (setq kc1 ou))
(setq dy (* dy1 5))
(setq kc (* kc1 4))
(while (= tiep "C")
(setvar "cmdecho" 0)
(setvar "osmode" 15359)
(setq BB (getpoint "Diem chen :"))
(setvar "osmode" 0)
(setq xg (car BB))
(setq yg (cadr BB))
(initget 6)
(setq Ly1 (getreal (strcat "\nChieu day ban (mm) <" (itoa od) ">: ")))
(if (null Ly1) (setq Ly1 od)) 
(setq Lxy1 (getreal "Chieu dai nhip(m) :"))
(setq Lx1 (* Lxy1 1000))
(setq Bx1 (getreal "Chieu dai thep am (mm):"))
(setq tdd1 (getreal (strcat "\nKhoang cach cac thanh thep (mm) <" (itoa ov) ">: ")))
(if (null tdd1) (setq tdd1 ov)) 
(SETQ TTR1 200)
(setq TTR2 (RTOS TTR1 2 0))
(setq Tt1 (RTOS TDD1 2 0))
(setq dd1 (STRCAT "a"TT1""))
(setq ddT (STRCAT "a"TTR2""))
(setq Lx (* Lx1 4))
(setq tong (+ tong Lx)) 
(setq Ly (* Ly1 5))
(setq Bx (* Bx1 4))
(setq tdd (* tdd1 4))
(setq TTR3 (* TTR1 4))
(setq B2 (list xg (+ yg Ly)))
(setq B3 (list xg (+ (- yg dy) Ly)))
(setq B4 (polar B3 0 880))
(setq B5 (polar BB 0 880))
(setq B6 (polar BB 0 Lx))
(setq B66 (polar B6 (* Pi 1.5) (- dy Ly)))
(setq B67 (polar B66 0 440))
(setq B7 (polar B2 0 (+ Lx 440)))
(setq p1 (/ Bx TTR3))
(setq g1 (fix p1))
(setq g2 (- g1 1))
(setq v1 (/ (- Lx 880) tdd))
(setq u1 (fix v1))
(setq u2 (+ u1 1))
(setq u3 (- (/ (- Lx (* u1 tdd)) 2) 440)) 
(setq A1 (list (+ xg 440) (+ yg kc)))
(setq A2 (list (+ xg 440) (- (cadr B2) kc)))
(setq A3 (polar A2 0 Bx))
(setq A4 (polar A1 0 Bx))
(setq Am4 (polar A4 (* Pi 1.5) kc))
(setq A5 (list (- (car A3) 50) (- (cadr A3) 50)))
(setq J5 A5)
(setq A7 (list (+ (+ (car A1) 440) u3) (+ (cadr A1) 50)))
(setq N7 (polar A7 0 tdd))
(setq N8 (polar N7 0 tdd))
(setq N9 (list (+ (car N7) (* 0.5 tdd)) (- (cadr n7) (+ 900 (* 1.5 KC)))))
(setq N10 (polar N9 0 900))
(setq N11 (polar N10 0 250))
(setq N12 (list (+ (car N9) 450) (+ (cadr N9) 220)))
(setq K12 (polar N12 (* Pi 1.5) 440))
(setq N13 (list (+ (car a7) (* tdd 6.5)) (cadr a1)))
(setq N14 (polar N13 (* Pi 1.25) kc))
(setq N15 (polar N13 (* Pi 0.25) kc))
(setq N16 (polar N13 (* Pi 1.5) (+ 900 kc)))
(setq N17 (polar N16 0 900))
(setq N18 (polar N17 0 250))
(setq N19 (list (+ (car N16) 450) (+ (cadr N16) 220)))
(setq K19 (polar N19 (* Pi 1.5) 440))
(command "osmode" 0 "")
(setvar "CLAYER" "8")
(command ".line" N7 N9 N8 "")
(command ".line" N10 N9 "")
(command ".line" N14 N15 "")
(command ".line" N13 N16 N17 "")
(setvar "CLAYER" "3")
(command ".text" "mc" N12 "250" "0" "/G10" "")
(command ".text" "mc" N19 "250" "0" "/g10" "")
(command ".text" "mc" K12 "250" "0" DD1 "")
(command ".text" "mc" K19 "250" "0" DD1 "")
(setq A6 (polar A1 0 Lx))
(setq AA1 (polar A3 (* 1.5 Pi) Ly))
(setq AA (polar A2 (* 0.5 Pi) 1500))
(setq C1 (polar B3 0 440))
(setq C3 (polar C1 0 Lx))
(setq C5 (polar C1 (* 1.5 Pi) 800))
(setq C2 (polar C5 0 (/ Lx 2)))
(setq C6 (polar C5 (* 1.5 Pi) 100))
(setq C4 (polar C6 (* 1.5 Pi) 350))
(setq CC (polar C2 (* 0.5 Pi) 250))
(command "osmode" 0 "")
(setvar "CLAYER" "3")
(command "donut" "0" kc A5 A7"")
(repeat g2
(setq A5 (polar A5 Pi TTR3))
(command "donut" "0" kc A5 "")
)
(setq mm (ssget "W" A2 AA1))
(setq J6 (polar J5 Pi TTR3))
(setq J4 (polar A3 Pi (* TTR3 1.5)))
(setq jj1 (polar j4 (* Pi 1.25) kc))
(setq jj2 (polar j4 (* Pi 0.25) kc))
(setvar "CLAYER" "8")
(command ".line" JJ1 JJ2 "")
(setq J7 (polar J6 0 (* TTR3 0.5)))
(setq J8 (polar J7 (* 0.5 Pi) 800))
(setq J3 (polar J4 (* 0.5 Pi) 800))
(setq J2 (polar J3 Pi 900))
(setq J9 (polar J8 0 900))
(setq J10 (polar J9 0 250))
(setq J1 (polar J2 Pi 250))
(command ".line" J5 J8 J6 "")
(command ".line" J8 J9 "")
(command ".line" J4 J3 J2 "")
(command ".circle" J1 "d" 500)
(setq cl1 (entlast))
(setq J11 (list (+ (car J2) 450) (+ (cadr J2) 220)))
(setq J12 (polar J11 (* Pi 1.5) 440))
(setq J13 (list (+ (car J8) 450) (+ (cadr J8) 220)))
(setq J14 (polar J13 (* Pi 1.5) 440))
(setvar "CLAYER" "3") 
(command ".text" "mc" J11 "250" "0" "/G10" "")
(command ".text" "mc" J13 "250" "0" "%%c6" "")
(command ".text" "mc" J12 "250" "0" DDT "")
(command ".text" "mc" J14 "250" "0" "a200" "")
(command "-ATTDEF" "" "+" "1" "1" "j" "mc" J1 "250" "")
(if (= (tblsearch "block" "ghithep") nil)
(command "block" "ghithep" J1 (entlast) cl1 "")
)
(if (/= (tblsearch "block" "ghithep") nil)
(command "block" "ghithep" "y" J1 (entlast) cl1 "")
)
(repeat u1
(setq A7 (polar A7 0 tdd))
(command "donut" "0" kc A7 "")
)
(setvar "CLAYER" "7")
(command ".line" BB B3 B4 B5 B6 "")
(command ".line" B2 B7 "")
(command ".line" B6 B66 B67 "")
(command ".line" C5 C6 "")
(setvar "CLAYER" "4")
(command ".pline" A2 A3 Am4 "")
(setq mm1 (ssget "L")) 
(command ".line" A1 A6 "")
(setvar "CLAYER" "100")
(command ".DIMLINEAR" C1 C3 C2)
(setq BB11 (polar BB (* 1 Pi) 500))
(setq BB12 (polar BB11 (* 1 Pi) 700)) 
(setvar "CLAYER" "20")
(command ".DIMLINEAR" BB B2 BB11)
(command ".DIMLINEAR" B3 B2 BB12)
(setvar "CLAYER" "100")
(command ".DIMLINEAR" A2 A3 AA)
(setq mm2 (ssget "L"))
(chenblock N11 1 1)
(chenblock N18 1 1)
(chenblock J1 "1" "1")
(chenblock J10 "1" "1")
(chenblock C4 "1.4" "1.4")
(command ".select" mm mm1 mm2 "")
(command ".mirror" "p" "" C2 CC "")
(initget 1 "C K")
(setq tiep (strcase (getkword "Lam tiep cau kien khac [1©/2(K)] :")))
)
(setq g7 (polar B67 (* Pi 0) 440))
(setq g8 (polar g7 (* Pi 0.5) dy))
(setq g9 (polar g8 (* Pi 1) 440))
(setq g10 (polar g9 (* Pi 1.5) kc))
(setq j10 (polar g9 (* Pi 1.5) (- Ly kc)))
(setq g11 (polar g10 (* Pi 0) 360))
(setq g12 (polar g11 (* Pi 1.5) (- Ly kc)))
(setq p67 (polar b67 (* 1.5 Pi) 800))
(setq p9 (polar p67 (* 1.5 Pi) 100))
(setq p10 (polar p9 (* 1.5 Pi) 350))
(setq j11 (polar j10 0 300))
(setq j12 (polar j11 (* 0.5 Pi) 100))
(setq j13 (polar j12 Pi 90))
(chenblock p10 "1.4" "1.4")
(setvar "CLAYER" "4")
(command "pline" j13 j12 "a" "a" -180 j11 "l" j10 "")
(setq Q1 (ssget "L")) 
(command "pline" g10 g11 g12 "")
(setq Q2 (ssget "L")) 
(setvar "CLAYER" "7")
(command ".line" B67 g7 "")
(command ".line" g8 g9 "")
(command ".line" g8 g7 "")
(setq gG7 (polar G7 Pi (/ (+ tong 880) 2)))
(setq gG8 (polar G8 Pi (/ (+ tong 880) 2)))
(setq Q3 (ssget "L")) 
(command ".line" p9 p67 "")
(command ".select" Q1 Q2 Q3 "")
(command ".mirror" "p" "" GG7 GG8 "")
(setvar "osmode" 691)
(SETVAR "CLAYER" NBC)
)
(defun taolayer ()
(if (= (tblsearch "layer" "3") nil) (command "layer" "n" "3" ""))
(if (= (tblsearch "layer" "4") nil) (command "layer" "n" "4" ""))
(if (= (tblsearch "layer" "7") nil) (command "layer" "n" "7" ""))
(if (= (tblsearch "layer" "8") nil) (command "layer" "n" "8" ""))
(if (= (tblsearch "layer" "20") nil) (command "layer" "n" "20" ""))
(if (= (tblsearch "layer" "100") nil) (command "layer" "n" "100" ""))
)
(defun chenblock ( dcb x y /)
(command "-insert" "ghithep" dcb x y "" "")
)

Cảm ơn bác.Cho e hỏi bác có nick yahoo k?Để có gì không hiểu e hỏi cho nhanh.e mới đang tìm hiểu về lisp mà chưa có thời gian nhiều.

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác
Cảm ơn bác.Cho e hỏi bác có nick yahoo k?Để có gì không hiểu e hỏi cho nhanh.e mới đang tìm hiểu về lisp mà chưa có thời gian nhiều.

Bạn vào profile có nick yahoo trong đó. Mình cũng ít khi online lắm có gì bạn cứ nhắn tin. Còn nếu muốn mọi người trả lợi bạn thì bạn nên lập 1 topic riêng. Bạn nên tìm kiếm trên diễn đàn trước khi đặt câu hỏi. Mình thấy trên diễn đàn hầu như không thiếu thứ gì.

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác
Của bạn đây. Cám ơn bạn vì lisp này cũng rất hay.

;; free lisp from cadviet.com

;=======================================================

;VE MAT CAT SAN
(defun c:Mcs (/ A1 A2 A3 A4 A5 A6 A7 AA AA1 AM4 B2 B3 B4 B5 B6 B66 B67 B7 BB
BB11 BB12 BX BX1 C1 C2 C3 C4 C5 C6 CC CL1 DD1 DDAM DDT DY DY1 G1
G10 G11 G12 G2 G7 G8 G9 GG7 GG8 J1 J10 J11 J12 J13 J14 J2 J3 J4
J5 J6 J7 J8 J9 JJ1 JJ2 K12 K19 KC KC1 LX LX1 LXY1 LY LY1 MM MM1
MM2 N10 N11 N12 N13 N14 N15 N16 N17 N18 N19 N7 N8 N9 NBC OD OU OV
P1 P10 P67 P9 Q1 Q2 Q3 TDD TDD1 TIEP TONG TT1 TTR1 TTR2 TTR3 U1 U2 U3 V1 XG YG)
(taolayer)
(SETQ NBC (GETVAR "CLAYER"))
(setvar "osmode" 1)
(setq tiep "C")
(setq tong 0)
(setq ddam 350)
(setq dy1 (getreal (strcat "Chieu cao dam < " (itoa ddam) " >: ")))
(if (null dy1) (setq dy1 ddam))
(setq ou 20)
(setq od 100)
(setq ov 200)
(initget 6)
(setq kc1 (getreal (strcat "\nkhoang bao ve (mm) <" (itoa ou) ">: ")))
(if (null kc1) (setq kc1 ou))
(setq dy (* dy1 5))
(setq kc (* kc1 4))
(while (= tiep "C")
(setvar "cmdecho" 0)
(setvar "osmode" 15359)
(setq BB (getpoint "Diem chen :"))
(setvar "osmode" 0)
(setq xg (car BB))
(setq yg (cadr BB))
(initget 6)
(setq Ly1 (getreal (strcat "\nChieu day ban (mm) <" (itoa od) ">: ")))
(if (null Ly1) (setq Ly1 od)) 
(setq Lxy1 (getreal "Chieu dai nhip(m) :"))
(setq Lx1 (* Lxy1 1000))
(setq Bx1 (getreal "Chieu dai thep am (mm):"))
(setq tdd1 (getreal (strcat "\nKhoang cach cac thanh thep (mm) <" (itoa ov) ">: ")))
(if (null tdd1) (setq tdd1 ov)) 
(SETQ TTR1 200)
(setq TTR2 (RTOS TTR1 2 0))
(setq Tt1 (RTOS TDD1 2 0))
(setq dd1 (STRCAT "a"TT1""))
(setq ddT (STRCAT "a"TTR2""))
(setq Lx (* Lx1 4))
(setq tong (+ tong Lx)) 
(setq Ly (* Ly1 5))
(setq Bx (* Bx1 4))
(setq tdd (* tdd1 4))
(setq TTR3 (* TTR1 4))
(setq B2 (list xg (+ yg Ly)))
(setq B3 (list xg (+ (- yg dy) Ly)))
(setq B4 (polar B3 0 880))
(setq B5 (polar BB 0 880))
(setq B6 (polar BB 0 Lx))
(setq B66 (polar B6 (* Pi 1.5) (- dy Ly)))
(setq B67 (polar B66 0 440))
(setq B7 (polar B2 0 (+ Lx 440)))
(setq p1 (/ Bx TTR3))
(setq g1 (fix p1))
(setq g2 (- g1 1))
(setq v1 (/ (- Lx 880) tdd))
(setq u1 (fix v1))
(setq u2 (+ u1 1))
(setq u3 (- (/ (- Lx (* u1 tdd)) 2) 440)) 
(setq A1 (list (+ xg 440) (+ yg kc)))
(setq A2 (list (+ xg 440) (- (cadr B2) kc)))
(setq A3 (polar A2 0 Bx))
(setq A4 (polar A1 0 Bx))
(setq Am4 (polar A4 (* Pi 1.5) kc))
(setq A5 (list (- (car A3) 50) (- (cadr A3) 50)))
(setq J5 A5)
(setq A7 (list (+ (+ (car A1) 440) u3) (+ (cadr A1) 50)))
(setq N7 (polar A7 0 tdd))
(setq N8 (polar N7 0 tdd))
(setq N9 (list (+ (car N7) (* 0.5 tdd)) (- (cadr n7) (+ 900 (* 1.5 KC)))))
(setq N10 (polar N9 0 900))
(setq N11 (polar N10 0 250))
(setq N12 (list (+ (car N9) 450) (+ (cadr N9) 220)))
(setq K12 (polar N12 (* Pi 1.5) 440))
(setq N13 (list (+ (car a7) (* tdd 6.5)) (cadr a1)))
(setq N14 (polar N13 (* Pi 1.25) kc))
(setq N15 (polar N13 (* Pi 0.25) kc))
(setq N16 (polar N13 (* Pi 1.5) (+ 900 kc)))
(setq N17 (polar N16 0 900))
(setq N18 (polar N17 0 250))
(setq N19 (list (+ (car N16) 450) (+ (cadr N16) 220)))
(setq K19 (polar N19 (* Pi 1.5) 440))
(command "osmode" 0 "")
(setvar "CLAYER" "8")
(command ".line" N7 N9 N8 "")
(command ".line" N10 N9 "")
(command ".line" N14 N15 "")
(command ".line" N13 N16 N17 "")
(setvar "CLAYER" "3")
(command ".text" "mc" N12 "250" "0" "/G10" "")
(command ".text" "mc" N19 "250" "0" "/g10" "")
(command ".text" "mc" K12 "250" "0" DD1 "")
(command ".text" "mc" K19 "250" "0" DD1 "")
(setq A6 (polar A1 0 Lx))
(setq AA1 (polar A3 (* 1.5 Pi) Ly))
(setq AA (polar A2 (* 0.5 Pi) 1500))
(setq C1 (polar B3 0 440))
(setq C3 (polar C1 0 Lx))
(setq C5 (polar C1 (* 1.5 Pi) 800))
(setq C2 (polar C5 0 (/ Lx 2)))
(setq C6 (polar C5 (* 1.5 Pi) 100))
(setq C4 (polar C6 (* 1.5 Pi) 350))
(setq CC (polar C2 (* 0.5 Pi) 250))
(command "osmode" 0 "")
(setvar "CLAYER" "3")
(command "donut" "0" kc A5 A7"")
(repeat g2
(setq A5 (polar A5 Pi TTR3))
(command "donut" "0" kc A5 "")
)
(setq mm (ssget "W" A2 AA1))
(setq J6 (polar J5 Pi TTR3))
(setq J4 (polar A3 Pi (* TTR3 1.5)))
(setq jj1 (polar j4 (* Pi 1.25) kc))
(setq jj2 (polar j4 (* Pi 0.25) kc))
(setvar "CLAYER" "8")
(command ".line" JJ1 JJ2 "")
(setq J7 (polar J6 0 (* TTR3 0.5)))
(setq J8 (polar J7 (* 0.5 Pi) 800))
(setq J3 (polar J4 (* 0.5 Pi) 800))
(setq J2 (polar J3 Pi 900))
(setq J9 (polar J8 0 900))
(setq J10 (polar J9 0 250))
(setq J1 (polar J2 Pi 250))
(command ".line" J5 J8 J6 "")
(command ".line" J8 J9 "")
(command ".line" J4 J3 J2 "")
(command ".circle" J1 "d" 500)
(setq cl1 (entlast))
(setq J11 (list (+ (car J2) 450) (+ (cadr J2) 220)))
(setq J12 (polar J11 (* Pi 1.5) 440))
(setq J13 (list (+ (car J8) 450) (+ (cadr J8) 220)))
(setq J14 (polar J13 (* Pi 1.5) 440))
(setvar "CLAYER" "3") 
(command ".text" "mc" J11 "250" "0" "/G10" "")
(command ".text" "mc" J13 "250" "0" "%%c6" "")
(command ".text" "mc" J12 "250" "0" DDT "")
(command ".text" "mc" J14 "250" "0" "a200" "")
(command "-ATTDEF" "" "+" "1" "1" "j" "mc" J1 "250" "")
(if (= (tblsearch "block" "ghithep") nil)
(command "block" "ghithep" J1 (entlast) cl1 "")
)
(if (/= (tblsearch "block" "ghithep") nil)
(command "block" "ghithep" "y" J1 (entlast) cl1 "")
)
(repeat u1
(setq A7 (polar A7 0 tdd))
(command "donut" "0" kc A7 "")
)
(setvar "CLAYER" "7")
(command ".line" BB B3 B4 B5 B6 "")
(command ".line" B2 B7 "")
(command ".line" B6 B66 B67 "")
(command ".line" C5 C6 "")
(setvar "CLAYER" "4")
(command ".pline" A2 A3 Am4 "")
(setq mm1 (ssget "L")) 
(command ".line" A1 A6 "")
(setvar "CLAYER" "100")
(command ".DIMLINEAR" C1 C3 C2)
(setq BB11 (polar BB (* 1 Pi) 500))
(setq BB12 (polar BB11 (* 1 Pi) 700)) 
(setvar "CLAYER" "20")
(command ".DIMLINEAR" BB B2 BB11)
(command ".DIMLINEAR" B3 B2 BB12)
(setvar "CLAYER" "100")
(command ".DIMLINEAR" A2 A3 AA)
(setq mm2 (ssget "L"))
(chenblock N11 1 1)
(chenblock N18 1 1)
(chenblock J1 "1" "1")
(chenblock J10 "1" "1")
(chenblock C4 "1.4" "1.4")
(command ".select" mm mm1 mm2 "")
(command ".mirror" "p" "" C2 CC "")
(initget 1 "C K")
(setq tiep (strcase (getkword "Lam tiep cau kien khac [1©/2(K)] :")))
)
(setq g7 (polar B67 (* Pi 0) 440))
(setq g8 (polar g7 (* Pi 0.5) dy))
(setq g9 (polar g8 (* Pi 1) 440))
(setq g10 (polar g9 (* Pi 1.5) kc))
(setq j10 (polar g9 (* Pi 1.5) (- Ly kc)))
(setq g11 (polar g10 (* Pi 0) 360))
(setq g12 (polar g11 (* Pi 1.5) (- Ly kc)))
(setq p67 (polar b67 (* 1.5 Pi) 800))
(setq p9 (polar p67 (* 1.5 Pi) 100))
(setq p10 (polar p9 (* 1.5 Pi) 350))
(setq j11 (polar j10 0 300))
(setq j12 (polar j11 (* 0.5 Pi) 100))
(setq j13 (polar j12 Pi 90))
(chenblock p10 "1.4" "1.4")
(setvar "CLAYER" "4")
(command "pline" j13 j12 "a" "a" -180 j11 "l" j10 "")
(setq Q1 (ssget "L")) 
(command "pline" g10 g11 g12 "")
(setq Q2 (ssget "L")) 
(setvar "CLAYER" "7")
(command ".line" B67 g7 "")
(command ".line" g8 g9 "")
(command ".line" g8 g7 "")
(setq gG7 (polar G7 Pi (/ (+ tong 880) 2)))
(setq gG8 (polar G8 Pi (/ (+ tong 880) 2)))
(setq Q3 (ssget "L")) 
(command ".line" p9 p67 "")
(command ".select" Q1 Q2 Q3 "")
(command ".mirror" "p" "" GG7 GG8 "")
(setvar "osmode" 691)
(SETVAR "CLAYER" NBC)
)
(defun taolayer ()
(if (= (tblsearch "layer" "3") nil) (command "layer" "n" "3" ""))
(if (= (tblsearch "layer" "4") nil) (command "layer" "n" "4" ""))
(if (= (tblsearch "layer" "7") nil) (command "layer" "n" "7" ""))
(if (= (tblsearch "layer" "8") nil) (command "layer" "n" "8" ""))
(if (= (tblsearch "layer" "20") nil) (command "layer" "n" "20" ""))
(if (= (tblsearch "layer" "100") nil) (command "layer" "n" "100" ""))
)
(defun chenblock ( dcb x y /)
(command "-insert" "ghithep" dcb x y "" "")
)

Bác giải thích giùm e trong đoạn code này chỗ nào gán đường kính của các chấm tròn thép và khoảng cách từ tâm chấm tròn này đến thanh thép phía dưới.Và tạo cho các vòng tròn là block ATT.Thanks

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác
Các bác nào có Lisp chuyển PL Sang SPL . Cám ơn các bác nhiều(.em tìm mà ko thấy.)

 

Cái này dễ mà

chọn dt

dùng lệnh Pedit chuyển qua SPL

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác
Cái này dễ mà

chọn dt

dùng lệnh Pedit chuyển qua SPL

Việc vẽ 1 Spline bằng lệnh SPL qua các đỉnh của 1 pline hoàn toàn khác với việc Convert 1 pline sang Spline bằng lệnh PEdit, hàm số biểu diễn 2 đuờng này là khác nhau

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác
Cám ơn Bác !

Những dỉnh của spl khác với pl mong các bác giúp em

Chào bạn Phamvanthiet108,

Bạn cần nói rõ việc bạn muốn chuyển 1 polyline thành Spline nhằm mục tiêu gì và cái Spline bạn muốn có những đặc điểm gì so với cái polyline ban đầu. Như vậy họa may mới có cách giúp bạn được. Còn trình bày như bạn đã thấy có các cách hiểu khác nhau về yêu cầu của bạn rồi đó, và như thế thì cái kết quả có nhẽ cũng khó mà đúng ý bạn được.

Nếu không bí mật bạn hãy thử post bản vẽ 1 cái polyline ban đầu và cái Spline cuối cùng mà bạn muốn có để mọi người tham khảo bạn nhé...

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác
Bạn thử cái này nhé:

(defun c:qsd(/ ss)
(setq ss(ssget (list  (cons 0 "DIMENSION") 
		  (cons 1 (strcat (getstring t "\n Nhap tien to :")
			"<>"
				  (getstring t "\n Nhap hau to :")
			  )
		  )
	   )
)
)
(sssetfirst ss ss)
(princ)
)

 

Bạn Tue_NV ơi, giúp mình với, đoạn lisp bạn viết giúp mình, trước vẫn dùng được nhưng bây giờ không dùng được nữa nó cứ báo là "Select objects: Specify opposite corner: 0 found, 0 total" không hiểu giá trị hệ thống của Cad có bị thay đổi gì không. Mình kiểm tra thuộc tính của dim thì nó chỉ hiện là (1 . "") chứ nó không hiểu (1 . "a<>") như mình lọc. Thanks

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác
Bạn Tue_NV ơi, giúp mình với, đoạn lisp bạn viết giúp mình, trước vẫn dùng được nhưng bây giờ không dùng được nữa nó cứ báo là "Select objects: Specify opposite corner: 0 found, 0 total" không hiểu giá trị hệ thống của Cad có bị thay đổi gì không. Mình kiểm tra thuộc tính của dim thì nó chỉ hiện là (1 . "") chứ nó không hiểu (1 . "a") như mình lọc. Thanks

Mình vẫn chưa rõ bạn bị tình trạng như thế nào nữa?

Phiền bạn upload file .dwg có Dim như trên và nói rõ hơn nhé

Chào bạn :iluvyousmiley:

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác
Chào bạn nguyenh001,

Để lấy tiền tố của một đối tượng dimension, bạn có thể sử dụng hàm (vla-get-Alttextprefix obj)

Để lấy hậu tố của một đối tượng dimension, bạn có thể sử dụng hàm (vla-get-Alttextsuffix obj)

Trong đó obj là tên đối tượng VLA-OBJECT. Bạn có thể lấy nó từ hàm sau (vlax-ename->vla-object ent) với ent là tên cúng cơm của cái dimension bạn chọn trong CAD thường được gọi là entity name đó. Có nhiều cách để lấy dược thằng ent này, tùy thoe bạn lựa chọn.

Nếu bạn thấy khó khăn thì hãy post lên mọi người sẽ giúp bạn hoàn thành nguyện vọng thôi.

 

Chào bạn phamthanhbinh

mình đã sử dụng hàm như bạn chỉ dẫn

(defun c:dd1(/ s1 s2)

(setq s1 (vlax-ename->vla-object (car (entsel))))

(setq s2 (vla-get-Alttextprefix s1))

(princ s1)

(princ s2)

(princ)

)

nhưng kết quả vẫn không lấy được giá trị của thuộc tính prefix, nó chỉ hiện ""

Bạn xem giúp mình với nhé, cám ơn bạn nhiều

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác
Mình vẫn chưa rõ bạn bị tình trạng như thế nào nữa?

Phiền bạn upload file .dwg có Dim như trên và nói rõ hơn nhé

Chào bạn :iluvyousmiley:

 

đây là file cad http://www.cadviet.com/upfiles/3/dim1.dwg

đây là file ảnh thao tác mình thực hiện http://www.cadviet.com/upfiles/3/dim_1.jpg

vẫn đoạn lisp lần trước bạn viết cho mình

(defun c:qsd(/ ss)

(setq ss (ssget (list (cons 0 "DIMENSION")

(cons 1 (strcat (getstring t "\n Nhap tien to :")

"<>"

(getstring t "\n Nhap hau to :")

)

)

)

)

)

(sssetfirst ss ss)

(princ)

)

 

trước mình đã dùng được nhưng bây giờ không dùng được nữa, sau khi nhập tiền tố, hậu tố, select đối tượng thì không trả kết quả các dim có cùng thuộc tính prefix và suffix giống nhau nữa chỉ báo là "0 found"

mình cũng đã thử dùng hàm vla-get-Alttextprefix như bạn phamthanhbinh hướng dẫn nhưng nó cũng trả kết quả là ""

(defun c:dd1(/ s1 s2)

(setq s1 (vlax-ename->vla-object (car (entsel))))

(setq s2 (vla-get-Alttextprefix s1))

(princ)

)

cám ơn bạn

Chia sẻ bài đăng này


Liên kết tới bài đăng
Chia sẻ trên các trang web khác
Khách
Chủ đề này bây giờ đã bị đóng lại để trả lời thêm.

×