Jump to content

LISP routine that shows XYZ coordinate of a selected point


tzframpton

Recommended Posts

Just wanting to know if anyone knows of a LISP routine that gives me a little info. I actually can do what I'm wanting but it takes a few steps. Here's the deal:

 

If I want to know the "elevation" of a 3D plan that I have XREF'ed into my drawing when I'm creating my 3D MEP ductwork, I put a POINT on a vertex or where ever, then use the LIST command to see the Z coordinate, which shows me the elevation. For instance, if I want to know the location of the bottom of structure when I route my duct.... etc. It would be nice if there's a program out there where I could just click the point and it shows me what I need to know. Thanks in advance!!

 

8)

Link to comment
Share on other sites

  • Replies 20
  • Created
  • Last Reply

Top Posters In This Topic

  • tzframpton

    9

  • Lee Mac

    5

  • alanjt

    4

  • DNK

    1

Top Posters In This Topic

Can't use Properties because (1) it's an XREF and (2) it's usually 3D solids so it doesn't give you an exact elevation of where ever I might need to reference from. I just want to pick a point and know the elevation (or XYZ coordinate, doesn't matter, same thing) of any point in space.

Link to comment
Share on other sites

I'm not sure how much info you want Styk, but this is probably as simple as they come:

 

(defun c:pt (/ p)
 (while (setq p (getpoint "\nPick Point: ")) (print p))
 (princ))

 

Slightly more refined:

 

(defun c:pt (/ p)
 
 (while (setq p (getpoint "\nPick Point: "))
   (princ (apply (function strcat)
                 (mapcar (function strcat)  '("\t" "," ",")
                         (mapcar (function rtos) p)))))
      
 (princ))

Link to comment
Share on other sites

Wow shows how little I know LISP if it getpoint could have done that. I haaaaaate asking this, but how hard is it to show in Architectural Feet & Inches instead of just decimal inches?? But that's exactly what I need.... just to "view" the coordinate so I can get the Z coordinate for elevation purposes. :D

Link to comment
Share on other sites

PERFECT!! Thank you sooooo much. It's really amazing how a simple program such as this becomes almost invaluable. Lee man I hate being "that guy"..... you know the ones..... the guys that asks for a custom program but man that really helps me out. Seriously..... much appreciated. 8)

Link to comment
Share on other sites

Hey no worries, I had fun :)

 

Here another little recursive treat:

 

(defun c:pt (/ lst->str p)

 (defun lst->str (lst del)
   (if (cdr lst)
     (strcat (car lst) del (lst->str (cdr lst) del))
     (car lst)))
 
 (while (setq p (getpoint "\nPick Point: "))
   (princ (strcat " (" (lst->str (mapcar (function rtos) p) ", ") ")")))
      
 (princ))

Link to comment
Share on other sites

What does this version do different than the other one?

 

Its just the way that the point is formatted - it uses a recursive sub-function to convert the list into a comma-delimited string. Basically me trying to show-off lol o:)

Link to comment
Share on other sites

Ohhhhh now I see.... yeah man I'm telling you that's absolutely perfect. All I need to do is see what elevation the point I pick is. Works fabulous. :thumbsup:

Link to comment
Share on other sites

Wow. Alan there's nothing you do not know. Did you make AutoCAD? It's okay you can tell us. We won't give your secret away. Between you and McSwain man I swear.... :lol:

Link to comment
Share on other sites

Since I deal in Northing/Easting and wanted to know the correct XYZ, even when my DWG is non-WCS (I also sometimes set my OSnapZ variable to replace the Z with 0.), I use this...

 

;;; ID Replacement
;;; Alan J. Thompson, 10.08.09
(defun c:PID (/ *error* #Osnapz #Point)
 (setq *error* (lambda (x) (and #Osnapz (setvar "osnapz" #Osnapz))))
 (and (setq #Osnapz (getvar "osnapz")) (setvar "osnapz" 0))
 (and (setq #Point (getpoint "\nSpecify point: "))
      (setq #Point (mapcar '(lambda (x) (rtos x 2 2)) (trans #Point 1 0)))
      (prompt (strcat "\nNorthing (Y): "
                      (cadr #Point)
                      "\nEasting (X): "
                      (car #Point)
                      "\nElevation: "
                      (last #Point)
              ) ;_ strcat
      ) ;_ prompt
 ) ;_ and
 (*error* nil)
 (princ)
) ;_ defun

Link to comment
Share on other sites

Wow. Alan there's nothing you do not know. Did you make AutoCAD? It's okay you can tell us. We won't give your secret away. Between you and McSwain man I swear.... :lol:

LoL

You got me. I love CAD so much, I just hang out in related forums all day. At least when I'm not counting my money or investing it in Bently.:shock:

 

We've just been using it for far too long. I've been using it since r14 (started in 2000 at the age of 18 ) and I know rk has several years on me.

Link to comment
Share on other sites

Yeah.... I want to learn the programming side of AutoCAD sooooo bad, including .NET for the vertical stuff but I don't think my woman would like that too much since I'm always so busy at work I would only have time at home to learn it. I reeeeeeally would love to learn it all. Maybe one day.

 

In fact, since I'm on the subject, I've found that I am the "guru" at my job. What I need to do is get into another company with one or more people FAR superior to my knowledge so I can milk their brains all day every day. 8) *getting resume ready*

Link to comment
Share on other sites

Yeah.... I want to learn the programming side of AutoCAD sooooo bad, including .NET for the vertical stuff but I don't think my woman would like that too much since I'm always so busy at work I would only have time at home to learn it. I reeeeeeally would love to learn it all. Maybe one day.

 

In fact, since I'm on the subject, I've found that I am the "guru" at my job. What I need to do is get into another company with one or more people FAR superior to my knowledge so I can milk their brains all day every day. 8) *getting resume ready*

I really need to learn .Net. I picked up a book a while back but I've just been too busy to get started on it and being too much of a Lisp fanboy.

My wife is the art instructor at out local comm. college, so I have time in the evenings (after my little girl goes to bed of course) to work on programming, etc. (if I so choose), since she gets pretty busy grading papers - at least on non-Lost nights.:wink:

 

I feel you on the job situation. I would love to work at a place where there's another guru. The last engineering firm I worked for, there was one guy I shared an office with that didn't know anything about programming, but knew cad inside and out (been at it since DOS days). You wouldn't believe the cad-boobs I work with now, but I'm not complaining. Work is so slow, I'm just happy to still have a job, and I probably only get to keep mine because I'm the only one that really knows how to use the majority of Civil 3D's components.

Link to comment
Share on other sites

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...