Message 1 of 15

Not applicable
09-15-2015
03:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to write a lisp to centralise a text item between two picked points
Finding the midpoint beween two picked points is easy, but how the devil can I find the coordinates of an text entity?
What I have so far is:
(defun c:test1 ( / ang dist newcoord oldcoord pt1 pt2 txt) (setq txt (nentsel "\nselect text item to move")) (setq oldcoord (entget (assoc 10 txt))); Get old coordinates (setvar "osmode" 55) (setq pt1 (getpoint "\npick first point: ")) (setq pt2 (getpoint "\npick second point: ")) (setq dist (distance pt1 pt2)) (setq ang (angle pt1 pt2)) (setq newcoord (polar pt1 ang (/ dist 2))); Get new coordinates (command "_.move" txt oldcoord newcoord) (setvar "osmode" 16439) )
The
(assoc 10 txt)
bit is obviously wrong, I was trying to get the coordinates of txt
Please don't rewrite the code completly, I'm trying to learn
I'd prefer no V functions either, I'm not that advanced (yet)
Thank you in advance,
Simon
Solved! Go to Solution.