Jump to content

Recommended Posts

Posted

any one know a lisp to click at a point and read xyz after that it convert that corrdinat to mtext

  • Replies 23
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    8

  • aryanarch

    4

  • ttsadaf

    2

  • stevesfr

    2

Posted

Quick one:

 

(defun c:mpt (/ M-Point M-Text pt)

 (defun M-Point (pt)
   (entmakex (list (cons 0 "POINT") (cons 10 pt))))

 (defun M-Text (pt val)
   (entmakex (list (cons 0 "MTEXT")
                   (cons 100 "AcDbEntity")
                   (cons 100 "AcDbMText")
                   (cons 10 pt)
                   (cons 1 val))))

 (while (setq pt (getpoint "\nPick Point: "))
   (M-Point (setq pt (trans pt 1 0)))
   (M-Text pt
     (apply 'strcat
       (mapcar 'strcat '("X = " "\nY = " "\nZ = ") (mapcar 'rtos pt)))))

 (princ))

Posted

hi lee mac

can u change the text height or rotation of the mtext in this code

because i made a new text style and new layer, i made the to the current, but it is not working with this text style..

 

 

-----------------------------------------------------------------

Quick one:

 

(defun c:mpt (/ M-Point M-Text pt)

 (defun M-Point (pt)
   (entmakex (list (cons 0 "POINT") (cons 10 pt))))

 (defun M-Text (pt val)
   (entmakex (list (cons 0 "MTEXT")
                   (cons 100 "AcDbEntity")
                   (cons 100 "AcDbMText")
                   (cons 10 pt)
                   (cons 1 val))))

 (while (setq pt (getpoint "\nPick Point: "))
   (M-Point (setq pt (trans pt 1 0)))
   (M-Text pt
     (apply 'strcat
       (mapcar 'strcat '("X = " "\nY = " "\nZ = ") (mapcar 'rtos pt)))))

 (princ))

Posted

The original code will take on the properties of the current textstyle, but this will give you manual control:

 

(defun c:mpt (/ M-Point M-Text pt height rotation)

 (setq height 2.5 rotation 0.0) [color=Blue][b];; Text Height and Rotation[/b][/color]

 (defun M-Point (pt)
   (entmakex (list (cons 0 "POINT") (cons 10 pt))))

 (defun M-Text (pt val hgt rot)
   (entmakex (list (cons 0 "MTEXT")
                   (cons 100 "AcDbEntity")
                   (cons 100 "AcDbMText")
                   (cons 10 pt)
                   (cons 1 val)
                   (cons 40 hgt)
                   (cons 50 rot))))

 (while (setq pt (getpoint "\nPick Point: "))
   (M-Point (setq pt (trans pt 1 0)))
   (M-Text pt
     (apply 'strcat
       (mapcar 'strcat '("X = " "\nY = " "\nZ = ") (mapcar 'rtos pt)))
           height rotation))

 (princ))

Posted
The original code will take on the properties of the current textstyle, but this will give you manual control:

 

(defun c:mpt (/ M-Point M-Text pt height rotation)

 (setq height 2.5 rotation 0.0) [color=blue][b];; Text Height and Rotation[/b][/color]

 (defun M-Point (pt)
   (entmakex (list (cons 0 "POINT") (cons 10 pt))))

 (defun M-Text (pt val hgt rot)
   (entmakex (list (cons 0 "MTEXT")
                   (cons 100 "AcDbEntity")
                   (cons 100 "AcDbMText")
                   (cons 10 pt)
                   (cons 1 val)
                   (cons 40 hgt)
                   (cons 50 rot))))

 (while (setq pt (getpoint "\nPick Point: "))
   (M-Point (setq pt (trans pt 1 0)))
   (M-Text pt
     (apply 'strcat
       (mapcar 'strcat '("X = " "\nY = " "\nZ = ") (mapcar 'rtos pt)))
           height rotation))

 (princ))

 

How to change output to Y, X, Z instead? :(

Posted
(defun c:mpt (/ M-Point M-Text pt height rotation)

 (setq height 2.5 rotation 0.0) ;; Text Height and Rotation

 (defun M-Point (pt)
   (entmakex (list (cons 0 "POINT") (cons 10 pt))))

 (defun M-Text (pt val hgt rot)
   (entmakex (list (cons 0 "MTEXT")
                   (cons 100 "AcDbEntity")
                   (cons 100 "AcDbMText")
                   (cons 10 pt)
                   (cons 1 val)
                   (cons 40 hgt)
                   (cons 50 rot))))

 (while (setq pt (getpoint "\nPick Point: "))
   (M-Point (setq pt (trans pt 1 0)))
   (M-Text pt
     (apply 'strcat
       (mapcar 'strcat '("Y = " "\nX = " "\nZ = ")
         (mapcar 'rtos (list (cadr pt) (car pt) (caddr pt)))))
           height rotation))

 (princ))

Posted
(defun c:mpt (/ M-Point M-Text pt height rotation)

 (setq height 2.5 rotation 0.0) ;; Text Height and Rotation

 (defun M-Point (pt)
   (entmakex (list (cons 0 "POINT") (cons 10 pt))))

 (defun M-Text (pt val hgt rot)
   (entmakex (list (cons 0 "MTEXT")
                   (cons 100 "AcDbEntity")
                   (cons 100 "AcDbMText")
                   (cons 10 pt)
                   (cons 1 val)
                   (cons 40 hgt)
                   (cons 50 rot))))

 (while (setq pt (getpoint "\nPick Point: "))
   (M-Point (setq pt (trans pt 1 0)))
   (M-Text pt
     (apply 'strcat
       (mapcar 'strcat '("Y = " "\nX = " "\nZ = ")
         (mapcar 'rtos (list (cadr pt) (car pt) (caddr pt)))))
           height rotation))

 (princ))

 

Lee, thanks for the lesson on the use of rtos ! now I can fix all my other resulting "xyz" programs to "yxz" (which for me is N,E,Elev) !!

Posted

very well ...............

beautiful lisp routines.........

awesome..........

tahnx very much friends.......

Posted
very well ...............

beautiful lisp routines.........

awesome..........

tahnx very much friends.......

 

You're welcome :)

Posted

when i choose break at point in auto cad and i repeat this command by pressing enter or space it change the command to break. how to remain it to do break at point? thank u

Posted

Here my function, which write geodetic coordinates on leader

(defun c:geo_koord_leader (/ pod_z koord y x z xyz) 
 (initget "Yes No") 
 (setq 
   pod_z (getkword "\nShow Z [Yes/No] <No>? : ") 
 ) 
 (while (and 
     (setq koord (getpoint "\nPoint <Exit>")) 
   ) 
   (setq 
     y   (strcat "X=" (rtos (nth 0 koord) 2 3)) 
     x   (strcat "Y=" (rtos (nth 1 koord) 2 3)) 
     z   (if 
    (= pod_z "Y") 
     (strcat "Z=" (rtos (nth 2 koord) 2 3)) 
     "" 
  ) 
   ) 
   (VL-cmdf "_leader" koord pause "" x y z "") 
 ) 
) 

(princ "Command name: geo_koord_leader")

  • 1 month later...
Posted

Hello!

 

Is there some possibility to change the numerological order? To be more specific: there is need in placing numbers beginning from north-west around the closed polyline (rectangle) instead of start point of polyline.

Will be very grateful for replies )

Posted

yes very nice lisp.....

but this lisp is giving the coordinates like (y,x)

it vl be more better if u make it (x,y) .......

waiting for your reply........

i want to say that it is giving y coordinates first and x coordinates next.......

can u make it to give it x coordinates and then y coordinates........

Posted
yes very nice lisp.....

but this lisp is giving the coordinates like (y,x)

it vl be more better if u make it (x,y) .......

waiting for your reply........

i want to say that it is giving y coordinates first and x coordinates next.......

can u make it to give it x coordinates and then y coordinates........

Well, simply I have got confused that X increases upwards (by the North) at us at geodesists, the same X to the right (on the East) in mathematical system of co-ordinates.

Therefore here two codes

1) For geodesists ↑x

(defun c:geo_koord_leader (/ pod_z koord y x z xyz) 
 (initget "Yes No") 
 (setq 
   pod_z (getkword "\nShow Z [Yes/No] <No>? : ") 
 ) 
 (while (and 
     (setq koord (getpoint "\nPoint <Exit>")) 
   ) 
   (setq 
     y   (strcat "Y=" (rtos (nth 0 koord) 2 3)) 
     x   (strcat "X=" (rtos (nth 1 koord) 2 3)) 
     z   (if 
    (= pod_z "Y") 
     (strcat "Z=" (rtos (nth 2 koord) 2 3)) 
     "" 
  ) 
   ) 
   (VL-cmdf "_leader" koord pause "" x y z "") 
 ) 
) 

(princ "Command name: geo_koord_leader")

2) For all other normal people →x :)

(defun c:math_koord_leader (/ pod_z koord y x z xyz) 
 (initget "Yes No") 
 (setq 
   pod_z (getkword "\nShow Z [Yes/No] <No>? : ") 
 ) 
 (while (and 
     (setq koord (getpoint "\nPoint <Exit>")) 
   ) 
   (setq 
     x   (strcat "X=" (rtos (nth 0 koord) 2 3)) 
     y   (strcat "Y=" (rtos (nth 1 koord) 2 3)) 
     z   (if 
    (= pod_z "Y") 
     (strcat "Z=" (rtos (nth 2 koord) 2 3)) 
     "" 
  ) 
   ) 
   (VL-cmdf "_leader" koord pause "" x y z "") 
 ) 
) 

(princ "Command name: math_koord_leader")

Posted
yes very nice lisp.....

but this lisp is giving the coordinates like (y,x)

it vl be more better if u make it (x,y) .......

waiting for your reply........

i want to say that it is giving y coordinates first and x coordinates next.......

can u make it to give it x coordinates and then y coordinates........

 

 

Are you referring to my program suggestion or GeoBuilder's LISP?

  • 3 weeks later...
Posted

Great codes guys..

Thanks a lot.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...