Print Page | Close Window

Move block, keep it at 0,0

Printed From: CAD Forum
Category: EN
Forum Name: AutoCAD
Forum Description: Discussion about AutoCAD and AutoCAD LT, viewers, DWG and DWF formats, Design Review, AutoCAD 360, add-ons
URL: https://www.cadforum.cz/forum_en/forum_posts.asp?TID=9056
Printed Date: 23.Apr.2026 at 11:34


Topic: Move block, keep it at 0,0
Posted By: StevieD
Subject: Move block, keep it at 0,0
Date Posted: 18.Mar.2013 at 15:43
I have many blocks in a drawing, each with a different name, and all are positioned at 0,0. I need to move the blocks around, and then rebuild them to position 0,0. Anyone know how to automate the rebuilds?



Replies:
Posted By: CarlB
Date Posted: 18.Mar.2013 at 17:26
Not sure what you mean by "rebuild to 0,0", sounds like they are already at 0,0.
Maybe could be automated, what would ne the method to determine how much to move them? Are you just changing the insert point?


Posted By: StevieD
Date Posted: 18.Mar.2013 at 17:55
CarlB: My blocks start out with a base point at 0,0,0. Then I move these blocks around. So, now I need to explode, and rebuild each block so it's base point is once again back at 0,0,0. There are about 80 individual blocks in my drawing, each with its own name. Doing manually is a killer.


Posted By: StevieD
Date Posted: 18.Mar.2013 at 18:18
I should have said Insertion point, not base point. Sorry.


Posted By: CarlB
Date Posted: 18.Mar.2013 at 18:43
I think I follow what you need to do.  You need to reposition blocks, change their definition so that their insert point is 0,0 but block definition is at the new location.  It sounds kind of bizarre, you must have a good reason for needing to do this?
 
You could do this with a lisp routine, which would have the user select all the blocks; routine would individually explode each block, create a new block with the original name (thus redefine it), select all the exploded elements, and give it a new insert/base point of 0,0.
 
 
 
 


Posted By: StevieD
Date Posted: 18.Mar.2013 at 19:16
You got the idea. And the reason is, we have analysis software that requires the 0,0 location. Long story. i will refresh my knowledge of lisp routines and see what i can do. Thanks for your help.


Posted By: CarlB
Date Posted: 18.Mar.2013 at 22:43
Here's my shot at it:
(defun c:Reblock ()
   (setvar "cmdecho" 0)
   (setq b_set (ssget '((0 . "INSERT"))))
   (setq i 0)
   (repeat (sslength b_set)
      (setq ename (ssname b_set i))
      (setq edata (entget ename))
      (setq Bk_Name (cdr (assoc 2 edata)))
      (setq Inspt (cdr (assoc 10 edata)))
      (setq bkselect (ssget "x" (list (cons 2 Bk_Name))))
      (command "explode" Bkselect)
      (command "_-block" Bk_Name "Y" "0,0" "_p" "")
      (command "_-insert" Bk_Name "0,0" 1.0 1.0 0.0)
      (setq i (+ 1 i))
   )
   (setvar "cmdecho" 1)
   (princ)
 )
 (princ "\nStart with Reblock")
 (princ)      
  



Print Page | Close Window