+ Reply to Thread
Results 1 to 10 of 10

Thread: ID display

  1. #1
    Full Member
    Using
    not specified
    Join Date
    May 2005
    Posts
    70

    Default ID display

    Registered forum members do not see this ad.

    Does anyone know or have a lisp, that when you use the id command will display the co-ordinates of that point as text next to it?

    It would be great if I could format the co-ordinate to 2 decimal places.

    I'm using AutoCAD 2007.

  2. #2
    Senior Member
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Bulgaria, Sofia
    Posts
    228

    Default

    This could be done in VBA too, do you really want to use .lsp?

  3. #3
    Full Member
    Using
    not specified
    Join Date
    May 2005
    Posts
    70

    Default

    VBA would be fine, although i'm not familiar with them, is it as easy as loading a lsp?

  4. #4
    Forum Deity
    Using
    not specified
    Join Date
    Jul 2004
    Location
    Anchorage, Alaska
    Posts
    2,074

    Default

    Here's a real simple one I did that may be all you need. Your text style height should be 0.0 or the "text" command will blow a gasket:

    Code:
    (princ "\nType LBLPT to start")
    (defun c:lblpt ()
       (setq precis 2);;set decimal places here
       (while
         (setq pt (getpoint "\nSelect point to label: "))
         (setq Xval (car pt) Yval (cadr pt))
         (setq Xtxt (rtos Xval 2 precis))
         (setq Ytxt (rtos Yval 2 precis))
         (command "text" pt "" "0" Xtxt)
         (command "text" "" ytxt)
       );while
    (princ)
    )

  5. #5
    Super Moderator fuccaro's Avatar
    Using
    AutoCAD 2006
    Join Date
    Nov 2002
    Location
    Romania, Marosvasarhely
    Posts
    3,540

    Default

    Daiharv
    You may wish to read THIS old answer to a similar question
    It's nice to be nice, but sometimes is nicer to be evil!.
    Tip: Please do not PM or email me with CAD questions - use the forums, you'll get an answer sooner.

  6. #6
    Luminous Being StykFacE's Avatar
    Computer Details
    StykFacE's Computer Details
    Operating System:
    Windows 7 Ultimate 64bit
    Computer:
    Dell Precision T3500
    Discipline
    Multi-disciplinary
    StykFacE's Discipline Details
    Occupation
    BIM Manager & Design Specialist
    Discipline
    Multi-disciplinary
    Details
    Facilities engineering, involving mechanical piping, mechanical HVAC and electrical engineering.
    Using
    Revit 2013
    Join Date
    Mar 2006
    Location
    Dallas, TX - USA
    Posts
    6,495

    Default

    Quote Originally Posted by CarlB
    Code:
    (princ "\nType LBLPT to start")
    (defun c:lblpt ()
       (setq precis 2);;set decimal places here
       (while
         (setq pt (getpoint "\nSelect point to label: "))
         (setq Xval (car pt) Yval (cadr pt))
         (setq Xtxt (rtos Xval 2 precis))
         (setq Ytxt (rtos Yval 2 precis))
         (command "text" pt "" "0" Xtxt)
         (command "text" "" ytxt)
       );while
    (princ)
    )
    what the HELL does that mean? seriously... if i gotta learn all that crap, then i have a LOOOOOOONG way to go in AutoCAD. and i thought i was half-ass decent. lol
    Tannar Frampton | Facilities Engineering | Revit 2013
    Personal Projects | Fender Squier Stratocaster | Custom Smoker | Concrete Patio

  7. #7
    Full Member
    Using
    not specified
    Join Date
    May 2005
    Posts
    70

    Default

    this seems to return a zero value for the X co-ord, any ideas?

    i loaded this as a lsp (is that correct?)

  8. #8
    Forum Deity
    Using
    not specified
    Join Date
    Jul 2004
    Location
    Anchorage, Alaska
    Posts
    2,074

    Default

    Yes, paste text to a ".lsp" file and load as a lisp file. Or you could paste the code into the command line for a one-time use.

    Probable reason for 0.0 as x coordinate, if not this I don't know.

    -your text height is set to a fixed value (I warned about this in my initial post) so the text command does not prompt for height, the "0" meant for rotation is getting entered as the x value.

    Try using a style with height=0.0

  9. #9
    Full Member
    Using
    not specified
    Join Date
    May 2005
    Posts
    70

    Default

    Thanks, this works brilliantly.

    Would it be possible format the co-ordinate so there is a bracket at the start and end and a "," to separate x & y.

    I've tried putting these into the lsp myself but with no joy, so i'd be really interested to see how this could be done. Can anyone recomend any UK based training for lsp or VBA?

    many thanks.

  10. #10
    Forum Deity
    Using
    not specified
    Join Date
    Jul 2004
    Location
    Anchorage, Alaska
    Posts
    2,074

    Default

    Registered forum members do not see this ad.

    daiharv,

    Here's your requested mods:

    Code:
    (princ "\nType LBLPT to start") 
    (defun c:lblpt () 
       (setq precis 2);;set decimal places here 
       (while 
         (setq pt (getpoint "\nSelect point to label: ")) 
         (setq Xval (car pt) Yval (cadr pt)) 
         (setq Xtxt (rtos Xval 2 precis)) 
         (setq Ytxt (rtos Yval 2 precis)) 
         (setq TxtString (strcat "[" Xtxt ", " Ytxt "]"))
         (command "text" pt "" "0" TxtStringXtxt) 
        );while 
    (princ) 
    )

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts