Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Auto Update of XY coord in Model Space onto Paper Space (Layout Tab) block

24 REPLIES 24
SOLVED
Reply
Message 1 of 25
skintsubby
4075 Views, 24 Replies

Auto Update of XY coord in Model Space onto Paper Space (Layout Tab) block

 

Hi Folks.

 

I've tried doing a block that automatically updates the X and Y coordinates from its moveable leader. I can get it to work in model space or paper space. But my problem is I want it to work in PS, but update with the MS coordinates through the viewport.

 

I can get it to update, by LISP, by picking a point and passing the points to the blocks attributes. At the moment I have a LISP when actioned it locks the viewports, activates the viewport, and asks you to select a point. Once selected it de-activates the viewport (going back into layout tab) then asks which block you want to update. Where you now select the block and it updates the coordinates.  I.e. manually pick the point in MS, switch to PS and then manually pick the block. Then I have to manually modify the leader to the correct location.

 

I'm hoping that I can (In PS) move the end of the leader to snap to a position in MS and the coord updates to reflect the correct MS coordinates. I'm thinking that maybe this can't be done automatically and that I maybe can move the leader but I'm not sure how I can do it without running a LISP to update the block?

 

I'd be happy moving the leader then just running a single command and the leader coordinates updating without having to select the points and the block again.

  

I've attached the block showing the auto update of the attributes (fields).

 

I've also posted this on the Dynamic Blocks forum to see if it can be done through dynamic route.

 

I've also posted this on the Dynamic Blocks Forum, to see if it's possible through that option only.

 

Any thoughts?

 

Thanks

 

Mark

24 REPLIES 24
Message 21 of 25
skintsubby
in reply to: jamesdcc

Jamesdcc

 

Welcome to the forums.

 

Are you using Ajilal's code version on his post dated 07-11-2013 10:57 AM?

 

Do you have multiple viewports? Or just one?

 

Is your viewport rotated?

 

Mark

Message 22 of 25
jamesdcc
in reply to: skintsubby

Hi,

 

Thanks for the reply

 

I was using Lee Mac's one as I felt it was the most appropriate one to use but I'm open to correction. I'll explain.........

 

We are doing land transfer maps that must have the coords of bottom left and top right of the viewport.

There is at the minute only 1 non rotated viewport (tab) but this will eventually be up to the max allowable.

 

I have a dummy setup that all other tabs will be generated from.

 

Any help appreciated

 

James

Message 23 of 25
skintsubby
in reply to: jamesdcc

jamesdcc

 

Lee's code works fine for me.. if you use the block that Ajilal fixed for me in his post at 06-11-2013 09:42 the X co-ord is the bottom one, and the Y co-ord is the top one.

 

Also. The co-ords returned are for the World UCS not any other user defined one that you may be using.

 

Does this solve your problem?

 

If not, can you be a bit more specific on what is wrong? How are the co-ords wrong etc?

 

Mark

Message 24 of 25
jamesdcc
in reply to: skintsubby

Hi Mark,

 

Yes I got that now. The problem was that I was mismatching the code with the incorrect block with the wrong insertion point.

I wonder if there is a way (handily done) that the values could be swapped and a prefix (E) for the "X" values and (N) for the "Y" Values?

 

I'm reluctant to go messing about too much at block editing before I know more of what I'm dealing with

 

Thanks for the help

 

James

Message 25 of 25

How to create autocad block

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost