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

duvanngoc

Thành viên
  • Số lượng nội dung

    8
  • Đã tham gia

  • Lần ghé thăm cuối

Bài đăng được đăng bởi duvanngoc


  1.  

    Xin lỗi các bạn hôm trước mình đã sửa rồi quên up lại nên bị sai tí chút

    code fix

    (defun c:dt ()
      (setq oldos (getvar "osmode"))
      (setvar "osmode" 0)
      (command "undo" "be")
      (setq ten (cdr(assoc 2 (entget(car(entsel "\nChon block dien hinh: "))))))
      (princ "\nChon block can doi ten: ")
      (setq	ssc (ssget (list(cons 0 "INSERT")(cons 2 ten)))
    	tm (getstring "\nNhap ten moi: ")
    	)
      (command "rename" "b" ten tm)
      (command "copyclip" ssc "")
      (command "block" "block_temp" "0,0" ssc "")
      (command "insert" "block_temp" "0,0" 1 1 0)
      (setq el (entlast))
      (setq pt (car(acet-ent-geomextents el)))
      (command "undo" "e"
    	   "undo" 1)
      (command "erase" ssc "")
      (command "pasteclip" pt)
      (setvar "osmode" oldos)
      )
    

    Bạn cho hiển thị tên block cũ vào trước đoạn chèn tên block mới thì tốt, dễ kiểm soát (xem hình đính kèm)

    1609588_638393552882417_6017030616240096

    Mình trích

    (vl-load-com)
    (or *kpblc-activedoc*
        (setq *kpblc-activedoc* (vla-get-activedocument (vlax-get-acad-object)))
        ) ;_ end of or
    
    (defun c:vla-rename (/ ent name)
      (vla-startundomark *kpblc-activedoc*)
      (if
        (and (not (vl-catch-all-error-p
    		(vl-catch-all-apply
    		  '(lambda ()
    		     (setq ent (car (entsel "\nSelect a block to be renamed")))
    		     ) ;_ end of lambda
    		  ) ;_ end of vl-catch-all-apply
    		) ;_ end of vl-catch-all-error-p
    	      ) ;_ end of not
    	 ent
    	 (= (cdr (assoc 0 (entget ent))) "INSERT")
    	 (/= (substr (cdr (assoc 2 (entget ent))) 1 2) "*U")
    	 (not (vl-catch-all-error-p
    		(vl-catch-all-apply
    		  '(lambda ()
    		     (setq name	(getstring t
    					   (strcat "\nEnter new name <"
    						   (cdr (assoc 2 (entget ent)))
    						   "> : "
    						   ) ;_ end of strcat
    					   ) ;_ end of getstring
    			   ) ;_ end of setq
    		     ) ;_ end of lambda
    		  ) ;_ end of vl-catch-all-apply
    		) ;_ end of vl-catch-all-error-p
    	      ) ;_ end of not
    	 (/= (vl-string-trim " " name))
    	 ) ;_ end of and
         (if (vl-catch-all-error-p
    	   (vl-catch-all-apply
    	     '(lambda ()
    		(vla-put-name
    		  (vla-item (vla-get-blocks *kpblc-activedoc*)
    			    (cdr (assoc 2 (entget ent)))
    			    ) ;_ end of vla-item
    		  name
    		  ) ;_ end of vla-put-name
    		) ;_ end of lambda
    	     ) ;_ end of vl-catch-all-apply
    	   ) ;_ end of vl-catch-all-error-p
           (princ (strcat "\nCan't rename a block "
    		      (cdr (assoc 2 (entget ent)))
    		      " with new name "
    		      name
    		      ) ;_ end of strcat
    	      ) ;_ end of princ
           ) ;_ end of if
         (princ (strcat "\nA error has been catched:"
    		    "\nSelection error | Selected entity isn't a block "
    		    "| It's a unnamed or dynamic block"
    		    ) ;_ end of strcat
    	    ) ;_ end of princ
         ) ;_ end of if
      (vla-endundomark *kpblc-activedoc*)
      (princ)
      ) ;_ end of defun 

     

    đoạn code có tính năng đó lên cho bạn tham khảo:


  2. Chào các bạn,

    Mình gặp một số vấn đề về gõ tiếng việt kiểu Telex với font shx:

    1, Đã cài đặt font univn2 của bro Bowxman chọn romans.shx cho font name, font type là univn2. bật Unikey chế độ Unicode nhưng khi gõ lại bị nhảy font sang Arial

    2, Dùng font romans1 của bro Cuongtk2 http://www.cadviet.c...MANS1.shx&w=419

    nhưng lại chỉ gõ được chữ hoa mà không gõ được chữ thường

     

    Bạn nào biết cách sửa giúp mình hoặc bộ font shx có thể gõ tốt được không. Thank all

×