blommin Posted February 23, 2009 Posted February 23, 2009 Hello, I have a small problem. I have made a block and now I need to replace the object with another. (change style) Is this possible to select all the blocks(like 1000) automatically or do I have to insert all the blocks manually? thanks Quote
NBC Posted February 23, 2009 Posted February 23, 2009 you could use BLOCKREPLACE However, this presumes that you have at least 2 blocks already in the drawing that you wish to replace one with the other. Quote
ReMark Posted February 23, 2009 Posted February 23, 2009 Different types of block replacement Lisp routines can be found at the CAD Tips section of Cadalyst magazine. Maybe there is one that suits your needs. Visit... www.cadalyst.com Quote
totzky Posted February 24, 2009 Posted February 24, 2009 If BEDIT, REFEDIT and BLOCKREPLACE will not help much in your "small problem", then follow ReMark's suggestion. Quote
uddfl Posted February 24, 2009 Posted February 24, 2009 I use this cheap and dirty one I wrote a couple of years ago, maybe it will be of use to you. ;;; BLOCK REPLACER (defun c:bre (/ new_block new_blk_name selection_set count entity insertion_point scale-x scale-y scale-z rotation) (setvar "cmdecho" 0) (command "_.undo" "be") (setq old_block (entget (car (entsel "\nPick instance of block to be replaced: ")))) (setq new_block (entget (car (entsel "\nPick instance of new block: ")))) (setq new_blk_name (cdr (assoc 2 new_block))) (setq selection_set (ssget (list '(0 . "INSERT") (assoc 2 old_block)))) (setq count 0);begin cycle (repeat (sslength selection_set) (setq entity (ssname selection_set count)) (setq insertion_point (cdr (assoc 10 (entget entity)))) (setq scale-x (cdr (assoc 41 (entget entity)))) (setq scale-y (cdr (assoc 41 (entget entity)))) (setq scale-z (cdr (assoc 41 (entget entity)))) (setq rotation (/ (* 180.0 (cdr (assoc 50 (entget entity)))) pi )) (entdel entity) (setvar "osmode" 0) (command "_.insert" new_blk_name "x" scale-x "y" scale-y "z" scale-z "r" rotation (trans insertion_point 0 1)) (setq count (1+ count)) );end cycle (command "_.undo" "end") ) Quote
blommin Posted February 24, 2009 Author Posted February 24, 2009 Thanks for the help! Work with blockreplace Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.