Author Topic: automatic co-ordinate  (Read 1760 times)

0 Members and 1 Guest are viewing this topic.

harshad

  • Guest
automatic co-ordinate
« on: March 13, 2008, 06:38:01 AM »
dear friends i m new on this site
i want a lisp for giving automatic co-ordinate to the object in the dwg
if i select a polyline the lisp give me the auto co-ordinat in the dwg at each end point of polyline.
thanks
harshad

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: automatic co-ordinate
« Reply #1 on: March 13, 2008, 08:56:59 AM »
Welcome to TheSwamp.


This will get you going on the code needed.


Code: [Select]
   ;;  CAB 08/25/06 - revised 07.25.07
   (defun getcoords (ent / endp idx pt result)
    (setq idx 0
          endp (vlax-curve-getEndParam ent))
    (while (< (setq idx (1+ idx)) endp)
      (setq pt (vlax-curve-getpointatparam ent idx))
      (setq result (cons pt result))
    )
    (reverse (cons (vlax-curve-getendpoint ent) result))
  )
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

harshad

  • Guest
Re: automatic co-ordinate
« Reply #2 on: March 14, 2008, 01:45:43 AM »
 cab thanks for replay me but i dont know how can i run u r coade
 pls replay

thanks harshad

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: automatic co-ordinate
« Reply #3 on: March 14, 2008, 09:51:29 AM »
I'm confused. if you can't program, what are you going to do with a list of points?

You may type LIST at the command line and view the data you seek.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CADaver

  • Guest
Re: automatic co-ordinate
« Reply #4 on: March 14, 2008, 10:02:15 AM »
DIM ORDINATE... maybe????

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: automatic co-ordinate
« Reply #5 on: March 14, 2008, 10:15:58 AM »
you can always just type "ID" and pick a point, that will display the northing & easting.

here, try this, it's not the prettiest, it originally did dtext but i modified it to place mtext and i just never cleaned up the code, it's not something i use on a regular basis, just eeeeeeeeeeevry once in a while.

Code: [Select]
;get id
;this routine gets the id of a point and places text (with or without a leader) at that pont
;alan thompson (6.4.07)
(DEFUN C:PID()
(princ "\nNorthing & Easting Text Labeler")
(setq answer (strcase (getstring "\nLeader/No leader <Leader>: ")))
(cond ((= answer "L") (setq kopy 1))
        ((= answer "leader") (setq kopy 1))
        ((= answer "") (setq kopy 1))
        ((= answer "N") (setq kopy 2))
        ((= answer "No") (setq kopy 2))
        (t nil)
) ; End of Cond
(if (= kopy 1)
(progn
(WHILE
  (setq pt (getpoint "\nSelect point to identify: "))
  (setq pt2 (getpoint pt "\nSelect point for text placement: "))
  (setq ptascii-x (car pt))
  (setq ptascii-x (rtos ptascii-x))
  (setq ptascii-y (cadr pt))
  (setq ptascii-y (rtos ptascii-y))
  (setq ptascii-z (caddr pt))
  (setq ptascii-z (rtos ptascii-z))
  (setq textstr1 (strcat  "NORTHING: "  ptascii-y ))
  (setq textstr2 (strcat "EASTING: " ptascii-x ))
  (setq textsize-flag (getvar "TEXTSIZE"))
  (if (/= textsize-flag nil)
    (progn
(command "leader" pt pt2 "" "" "" textstr1 textstr2 "")
    )
  )
  (if (= textsize-flag nil)
    (progn
(command "leader" pt pt2 "" "" "" textstr1 textstr2 "")
    )
  )
)
) ; End of Progn
) ; End of If
(if (= kopy 2)
(progn
(WHILE
  (setq pt (getpoint "\nSelect point to identify: "))
  (setq ptascii-x (car pt))
  (setq ptascii-x (rtos ptascii-x))
  (setq ptascii-y (cadr pt))
  (setq ptascii-y (rtos ptascii-y))
  (setq ptascii-z (caddr pt))
  (setq ptascii-z (rtos ptascii-z))
  (setq textstr1 (strcat  "NORTHING: "  ptascii-y ))
  (setq textstr2 (strcat "EASTING: " ptascii-x ))
  (setq textsize-flag (getvar "TEXTSIZE"))
  (if (/= textsize-flag nil)
    (progn
(command "-mtext" pt "w" "0" textstr1 textstr2 "")
    )
  )
  (if (= textsize-flag nil)
    (progn
(command "-mtext" pt "w" "0" textstr1 textstr2 "")
    )
  )
)

) ; End of Progn
) ; End of If
(princ))
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox