engineer0405 2 Báo cáo bài đăng Đã đăng Tháng 8 7, 2013 em chào các anh ạ em có 1 lisp như thế này ạ (defun c:eb (/ blk) ;;;---------------------------------------------------------------------;;; ;;;A rewrite of the entsel function. ;;; ;;;---------------------------------------------------------------------;;; (defun ent_sel (msg / ent) (while (not ent) (cond ((setq ent (entsel msg))) ((= (getvar "ErrNo") 7) (princ "\nSelection missed. Please try again.") ) ((= (getvar "ErrNo") 52) (exit)) ) ) ent ) ;;; ;;; ;;; (while (not blk) (setq blk (car (ent_sel "\nSelect Block: "))) ) (mapcar '(lambda (x) (and (vlax-property-available-p x 'explodable) (eq (vlax-get-property x 'explodable) :vlax-false) (not (vlax-put-property x 'explodable :vlax-true)) (princ "\nThe selected Block is now Explodable! ") ) ) (list (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)) ) (cdr (assoc 2 (entget blk))) ) ) ) (princ) ) nhưng phần chọn ban đầu em chưa thấy hợp lý lắm (chỉ chọn đc từng block 1) mong các anh chỉnh giúp em với -Phần chọn đối tượng: b1:chọn đối tượng(đoạn này mình chọn tất cả ( gồm line, text, block,....) b2:lọc các đối tượng mình vừa chọn chỉ giữ lại các block b3:thực hiện lệnh b4:kết thúc mong các anh hoàn chỉnh giúp em 2 bước đầu với ạ em cảm ơn các anh (defun c:eb (/ blk) ;;;---------------------------------------------------------------------;;; ;;;A rewrite of the entsel function. ;;; ;;;---------------------------------------------------------------------;;; (defun ent_sel (msg / ent) (while (not ent) (cond ((setq ent (entsel msg))) ((= (getvar "ErrNo") 7) (princ "\nSelection missed. Please try again.") ) ((= (getvar "ErrNo") 52) (exit)) ) ) ent ) ;;; ;;; ;;; (while (not blk) (setq blk (car (ent_sel "\nSelect Block: "))) ) (mapcar '(lambda (x) (and (vlax-property-available-p x 'explodable) (eq (vlax-get-property x 'explodable) :vlax-false) (not (vlax-put-property x 'explodable :vlax-true)) (princ "\nThe selected Block is now Explodable! ") ) ) (list (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)) ) (cdr (assoc 2 (entget blk))) ) ) ) (princ) ) (defun c:eb (/ blk) ;;;---------------------------------------------------------------------;;; ;;;A rewrite of the entsel function. ;;; ;;;---------------------------------------------------------------------;;; (defun ent_sel (msg / ent) (while (not ent) (cond ((setq ent (entsel msg))) ((= (getvar "ErrNo") 7) (princ "\nSelection missed. Please try again.") ) ((= (getvar "ErrNo") 52) (exit)) ) ) ent ) ;;; ;;; ;;; (while (not blk) (setq blk (car (ent_sel "\nSelect Block: "))) ) (mapcar '(lambda (x) (and (vlax-property-available-p x 'explodable) (eq (vlax-get-property x 'explodable) :vlax-false) (not (vlax-put-property x 'explodable :vlax-true)) (princ "\nThe selected Block is now Explodable! ") ) ) (list (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)) ) (cdr (assoc 2 (entget blk))) ) ) ) (princ) ) (defun c:eb (/ blk) ;;;---------------------------------------------------------------------;;; ;;;A rewrite of the entsel function. ;;; ;;;---------------------------------------------------------------------;;; (defun ent_sel (msg / ent) (while (not ent) (cond ((setq ent (entsel msg))) ((= (getvar "ErrNo") 7) (princ "\nSelection missed. Please try again.") ) ((= (getvar "ErrNo") 52) (exit)) ) ) ent ) ;;; ;;; ;;; (while (not blk) (setq blk (car (ent_sel "\nSelect Block: "))) ) (mapcar '(lambda (x) (and (vlax-property-available-p x 'explodable) (eq (vlax-get-property x 'explodable) :vlax-false) (not (vlax-put-property x 'explodable :vlax-true)) (princ "\nThe selected Block is now Explodable! ") ) ) (list (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)) ) (cdr (assoc 2 (entget blk))) ) ) ) (princ) ) 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
engineer0405 2 Báo cáo bài đăng Đã đăng Tháng 8 8, 2013 các anh giúp em với ạ em cảm ơn các anh 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