Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted

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

Posted

If BEDIT, REFEDIT and BLOCKREPLACE will not help much in your "small problem", then follow ReMark's suggestion.

Posted

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")
)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...