Paste coordinates in display by macro

Paste coordinates in display by macro

Anonymous
Not applicable
1,937 Views
6 Replies
Message 1 of 7

Paste coordinates in display by macro

Anonymous
Not applicable

I want to put the coordinates on display on a point with text. Because its a lot of coordinates so i want o do it with macro. Does anyone know the command to fix this?

0 Likes
Accepted solutions (1)
1,938 Views
6 Replies
Replies (6)
Message 2 of 7

ВeekeeCZ
Consultant
Consultant

Welcome to the comunity!

 

Try the code bellow.

 

(defun c:coo ( / pnt)

  (while (setq pnt (getpoint "\nPick a point: "))

    (princ (strcat "\nx=" (rtos (car pnt) 2 2)
		   "\ny=" (rtos (cadr pnt) 2 2)
		   "\nz=" (rtos (last pnt) 2 2)))

    (entmakex (list (cons 0 "MTEXT")
		    (cons 100 "AcDbEntity")
                    (cons 100 "AcDbMText")
                    (cons 10 pnt)
                    (cons 1 (strcat "x=" (rtos (car pnt) 2 2) "\\P"
				    "y=" (rtos (cadr pnt) 2 2) "\\P"
				    "z=" (rtos (last pnt) 2 2))))))
  (princ)
)

Next time you might post a dwg example to see how you imagine the solution.

 

0 Likes
Message 3 of 7

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

I want to put the coordinates on display on a point with text. Because its a lot of coordinates so i want o do it with macro. Does anyone know the command to fix this?


Since the maximum number of coordinates a point can have is three, and three doesn't sound like "a lot" of coordinates, I assume you mean a lot of points at which you want to put text of their coordinates.  From that, I assume you are talking about Point entities, not mere locations.  Is that correct?

Kent Cooper, AIA
0 Likes
Message 4 of 7

Anonymous
Not applicable

I am a surveyor and i am an amateur when it comes to auto-cad and i want to show coordinates point  i´ve marked yellow on the picture i sent. And i want to show the coordinates on the picture. I hope that picture show what i am trying to do.

0 Likes
Message 5 of 7

Anonymous
Not applicable

I am a surveyor and i am an amateur when it comes to auto-cad and i want to show coordinates point  i´ve marked yellow on the picture i sent. And i want to show the coordinates on the picture. I hope that picture show what i am trying to do.

0 Likes
Message 6 of 7

ВeekeeCZ
Consultant
Consultant
Accepted solution

Following code is a LISP. Since you're a student, I'm presuming you know how to google to get to know how to use a LISP.

 

Routine workflow:

- select a multileader containing a number. Routine will take the number and the coordinates of the head of mleader (the arrow)

- then you pick 2 points to place new mleader on the photo.

- routine take current mleader style - so it's up to you to set correct settings.

 

(defun c:COO ( / ent pnt txt num)
  (while (and (setq ent (car (entsel "\nSelect mleader containing number <done>: ")))
	      (= (cdr (assoc 0 (entget ent))) "MULTILEADER")
	      )
    (setq pnt (cdr (assoc 110 (entget ent)))
	  num (cdr (assoc 304 (entget ent)))
	  txt (strcat "(" num ")"
		      "\nx=" (rtos (car pnt) 2 2)
		      "\ny=" (rtos (cadr pnt) 2 2)
		      "\nz=" (rtos (last pnt) 2 2)))
    (command "_.MLEADER" PAUSE PAUSE txt))
  (princ)
)

And Student, learn to program!! Unless you have the money to pay for it.

0 Likes
Message 7 of 7

john.uhden
Mentor
Mentor

It looks like he/she wants to label the photo.  Don't we need to know its UCS data?

John F. Uhden

0 Likes