Author Topic: Insert text on Locate Point command  (Read 1580 times)

0 Members and 1 Guest are viewing this topic.

Rooster

  • Guest
Insert text on Locate Point command
« on: May 15, 2009, 04:35:45 AM »
I want to use something similar to the Locate Point command (the one that gives you the xyz of a point), and for the command to extract the y value and insert that value as text at the point clicked. Maybe to also insert a block at the same point too.

Can anyone think of a LISP already existing that will do this, and if not might some kind soul be able to help me out with one??

Thanks. Hope I have explained myself properly.....

Lee Mac

  • Seagull
  • Posts: 12921
  • London, England
Re: Insert text on Locate Point command
« Reply #1 on: May 15, 2009, 07:29:40 AM »
Perhaps:

Code: [Select]
(defun c:ty  (/ pt)
  (while (setq pt (getpoint "\nSelect Point: "))
    (Make_Text pt (rtos (cadr pt) 2 2) 0.0))
  (princ))

(defun Make_Text  (pt val rot)
  (entmake (list '(0 . "TEXT")
                 (cons 8 (getvar "CLAYER"))
                 (cons 10 pt)
                 (cons 40 (getvar "TEXTSIZE"))
                 (cons 1 val)
                 (cons 50 rot)
                 (cons 7 (getvar "TEXTSTYLE"))
                 '(71 . 0)
                 '(72 . 1) ; 0= left 1=center 2=right
                 '(73 . 1) ; 0= baseline 1=bottom 2=middle 3=top
                 (cons 11 pt))))