Hi all,
I have insert blocks in my dwg. It is the circle. While creating the block, i was just pick the point into the circle not exactly at the centre.
Now i want change the insertion point of the block at centre of the circle without moving the objects from the dwg.
Beacuse i had use block editor to change the insertion point. But after changing, all blocks were moved from the original position.
Thanks
@stevor wrote:
What is usally done: Move them ,all the INSERTs of that changed BLOCK, back to their original location. Keep track of the displacement created by the change in the insertion point in the BLOCK, and use it to move a selection set of 'them;' or, to modify each INSERT's data by other methods, which someone will likely detail soon.
Thats right. I worte a code for the OP, but i'm having trouble with rotated blocks and those with attributes.
(defun c:ChangeIns (/ adoc* doc* BlkObjct npt mpt or_pt) (setq adoc* (vlax-get-acad-object) doc* (vla-get-activedocument adoc*)) (if (setq BlkObjct (car (entsel "\nSelect Block:"))) (cond ((eq (cdr (assoc 0 (setq ent_b (entget BlkObjct)))) "INSERT") (setq npt (getpoint "\nSelect New Point:")) (ssget "_X" (list (setq bn (assoc 2 ent_b)))) (vlax-for bnm (vla-get-blocks doc*) (if (eq (vla-get-name bnm) (cdr bn)) (vlax-for nest_obj bnm (vla-move nest_obj (vlax-3d-point '(0.0 0.0 0.0)) (vlax-3d-point (setq mpt (mapcar '- (cdr (assoc 10 ent_b)) npt))) ) ) ) ) (vlax-for mo_bk (vla-get-activeselectionset doc*) (vla-move mo_bk (vlax-3d-point (mapcar '+ (vlax-safearray->list (variant-value (setq or_pt (vla-get-insertionpoint mo_bk)))) mpt)) or_pt) ) ) ) ) )
Change origin perhaps ? (vla-put-origin.....) not sure though.
Ideas anyone?
Well, just would like to share a lisp for as what you need..I also use to get the lisp from here in one of the threads..hope this help you..Thanks to the author who said this lisp out previously.