World Coordinates of Secondary Point in Block

World Coordinates of Secondary Point in Block

schmr
Participant Participant
642 Views
6 Replies
Message 1 of 7

World Coordinates of Secondary Point in Block

schmr
Participant
Participant
I’m creating a LISP that needs to be able extract two points (using the world coordinate) from a dynamic block that will be used as the 2 points for aligning a viewport using the “ZOOM” “WINDOW” command.

The insertion point is easy to get by creating an attribute that uses the blocks position as its value. The second point has been more tricky. I am able to set up an attribute that displays the coordinates of second point but it is in relation to insertion point of the block instead of the world coordinate position. When the block is not rotated this works just fine but I want to allow the user rotate the block and my routine to still know the coordinates for the opposite corners of the block.

Hopefully explained my situation adequately.
0 Likes
Accepted solutions (2)
643 Views
6 Replies
Replies (6)
Message 2 of 7

Libbya
Mentor
Mentor

You should probably be asking this on the LISP forum.  There isn't any way within the dynamic block tools to give the world coordinates outside the block.  

0 Likes
Message 3 of 7

schmr
Participant
Participant

Thanks for the reply Libbya.  I think I’ve nailed down the LISP side of it, I just need to get the dynamic block to show the right attribute.  I was afraid what I needed was impossible but I was hopeful.  

0 Likes
Message 4 of 7

Libbya
Mentor
Mentor
Accepted solution

If you know the insertion point, the rotation of the block, and the coordinates of the second point within the block, then it is just simple math to compute the world coordinates of the second point based on those three variables.  The insertion point, rotation of the block, and the coordinates of the second point within the block are all available, I just do not know how to use LISP to access them and do the math.     

0 Likes
Message 5 of 7

schmr
Participant
Participant

Good point.  That thought occurred to me but I’m not sure how to do that math.  When the block has a rotation of 0 (not rotated) then I can simply subtract the coord2 x value from the insertion x value and do the same with y.  The math math for a rotation value other than 0 doesn’t seem as straight forward.  It may involve pi or something else like that which is far beyond me.   

 

Perhaps a math whiz will read this thread and offer the magic formula.

 

Until that point my LISP is relegated 0 rotation only:(

0 Likes
Message 6 of 7

Libbya
Mentor
Mentor

It's trigonometry.  I could suss it out if really required, but it's been long enough that I would suggest posting on the LISP forum first to see someone else is a bit more fresh on it.  🙂

0 Likes
Message 7 of 7

schmr
Participant
Participant
Accepted solution

After further research I found the trig formula I needed (see attached pic) and it works great!!

0 Likes