Jump to content

Block insertion point modify?


manirpg

Recommended Posts

Dear friends,

I need a lisp for change the insertion point of block.help me.

in my dwg having many blocks, but some of the blocks insertion point not specified correctly (on the object or near the object).if i select one of these block, insertion point not vissible (node).

so i want to change insertion point easily by two steps.

select block and specify insertion point. without makes any changes in oriantation of block used in the whole dwg.

Thanks in advance.:):)

Regards

Mani

Link to comment
Share on other sites

You could change the block insertion point for every block in the drawing by changing the block definition. Look into the 'Origin' property, or DXF group 10 of the block definition.

Link to comment
Share on other sites

Dear Lee ,

Sorry ,I can’t understand ur reply. I need to update in my existing drawing, so how can help the block definition window?

In my drawing had a blocks.

I am using this macro, this is working but each execution i am giving block name twise, so i want to avoid block name input?

help me.

I attached 2 examples.......

(without changing block orientation changed the insertion point)

help me anybody

macro:

^C^C-ren;b;\name;^C-insert;name;0,0;1;;0;^Cz;o;l;;_explode;L;^C^Cm;p;;\

^C^C-block;name1;@;p;;-insert;name1;@;1;;0;

-block;name;y;0,0;l;;^Cssx;;b;name;;^Cxplode;p;;g;e;^Cz;p;^C-ren;b;name1;\

^C-pu;b;name;n;^C

Thanks

Regards

mani

before1.jpg

after1.jpg

before2.jpg

after2.jpg

Link to comment
Share on other sites

1. Try _bedit _bsave and _bclose command

2.

Look into the 'Origin' property

Found here

(defun selobj ()
 (if (not (vl-catch-all-error-p (vl-catch-all-apply 
     '(lambda () (vla-getEntity util 'obj nil "Select Block: ")))));not
 obj
 (progn (alert "Nothibg Selected. Try Again!") (selobj)))
 (if (/= (vla-get-ObjectName obj) "AcDbBlockReference")
   (alert "This Is Not A Block! Try Again!") obj)
);selobj
;
(defun C:ChInsPt ( / adoc util bks bk prp)
 (setq adoc (vla-get-ActiveDocument (vlax-get-acad-object)))
 (mapcar '(lambda (x y) (set x (vlax-get-property adoc y))) '(util bks) '("Utility" "Blocks"))
 (vla-endundomark adoc) (vla-startundomark adoc)
 (vla-highlight (selobj) t)
 (setq prp (mapcar '(lambda (x) (vlax-get-property obj x))
             '(InsertionPoint XScaleFactor YScaleFactor Rotation))
       ip1 (vla-getPoint util nil "Select New Insertion Point")
       rv (mapcar '(lambda (y) (apply y (mapcar '(lambda (x) (vlax-safearray->list (vlax-variant-value x)))
                            (list (car prp) ip1)))) '(distance angle))
       bk (vla-item bks (vla-get-name obj)));setq
 (vla-put-origin bk (vlax-3d-point (polar (vlax-get bk 'Origin)
                                     (* (cadr rv) (/ (nth 1 prp) (nth 2 prp))) (- (car rv) (last prp)))))
 (vla-update obj)
 (vla-regen adoc acAllViewports)
 (vla-endundomark adoc) 
);end

Link to comment
Share on other sites

Dear VVA,

Thanks for reply but its not given proper output.but block objects location changed after execution.

see the attachment.

Thanks

Regards

mani

AFTER.jpg

BEFORE.jpg

Link to comment
Share on other sites

This seemed interesting so I thought I'd take a stab at it :)

 

Code does the same thing as that which VVA posted, but uses a different method :)

 

Edited by Lee Mac
Link to comment
Share on other sites

Dear Lee,

Your code also working same like code posted by VVA.

Both of giving same output.

otherwise i need a lisp for giving output block name which block i am selected, some one help me................

Thanks to all

Regards

mani

Link to comment
Share on other sites

Hi, Mr.LEE

still the result coming not proper.

my requirement is After changed the insertion point,blocks position should not change.

pls see my images.......

also my macro.

If any one want to check my macro here the procedure.

1.select the block

2.click macro button

3.block name input(which one selected)

4.click new insertion point

5.block name input(which one selected),same as step 3 input

 

now u get the result...........

Thanks lee

I am awaiting.......

 

Regards

mani:)

Link to comment
Share on other sites

Hi Lee,

Thank you very much........................

Now its working fine............

Also thanks to link...........(i think i got one more good forum)

Thanks for both

 

Regards

Mani:D:D:D

Link to comment
Share on other sites

  • 1 month later...
the CBI routine is great, many thanks for your work

 

Hi JCap, I'm glad you like it - I have removed the old code from my earlier post, see the link I posted for the latest code. :)

Link to comment
Share on other sites

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...