CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.
Please abide by the
rules of this forum.
How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
Author |
Topic Search Topic Options
|
StevieD
Newbie
Joined: 03.Nov.2011
Location: United States
Using: AutoCAD Mech 2012
Status: Offline
Points: 5
|
Topic: Move block, keep it at 0,0 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?
|
|
CarlB
Senior Member
Joined: 16.Oct.2009
Location: United States
Status: Offline
Points: 321
|
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?
|
|
StevieD
Newbie
Joined: 03.Nov.2011
Location: United States
Using: AutoCAD Mech 2012
Status: Offline
Points: 5
|
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.
|
|
StevieD
Newbie
Joined: 03.Nov.2011
Location: United States
Using: AutoCAD Mech 2012
Status: Offline
Points: 5
|
Posted: 18.Mar.2013 at 18:18 |
I should have said Insertion point, not base point. Sorry.
|
|
CarlB
Senior Member
Joined: 16.Oct.2009
Location: United States
Status: Offline
Points: 321
|
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.
|
|
StevieD
Newbie
Joined: 03.Nov.2011
Location: United States
Using: AutoCAD Mech 2012
Status: Offline
Points: 5
|
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.
|
|
CarlB
Senior Member
Joined: 16.Oct.2009
Location: United States
Status: Offline
Points: 321
|
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) |
|
|