Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please help to get this done!

Status
Not open for further replies.

foresthills

Industrial
Oct 2, 2003
8
I am using AutoCAD 2002. My question is:

I would like to write a simple routine to realize this:

In the paper space, say, layout, if I pick a point in a viewport which is representing an elevation view of the 3D model, How can I retrieve the Z coordinate of that point in the model space and annotate its elevation at the same point in the paper space?

I would like to realize it by only clicking the mouse button.

Thank you very much!

Foresthills
 
Replies continue below

Recommended for you

This quick LISP might be a start for you.
You may want to change the "53" to your desired OSnap setting and possibly get rid of the X and Y coordinate portions.

(DEFUN C:pTT (/ osm p1 x y z s h p2) ; ID a point, place coordinates text
(setq osm (getvar "osmode"))
(command "osmode" 53)
(command "MSPACE")
(setq p1 (getpoint "\nPick the point to be ID'd: ")
x (car p1)
y (cadr p1)
z (caddr p1)
s (strcat "(" (rtos x) "," (rtos y) "," (rtos z) ")" )
h (getvar "textsize")
)
(command "osmode" 0)
(command "PSPACE")
(setq p2 (getpoint "\nPick point for middle of text: "))
(COMMAND "TEXT" "Ju" "M" p2 h "0" s)
(command "osmode" osm)
)
 
Thank you, IFRs,

Your lisp works greatly!

The only issue is:
In my drawing, anytime when I use lisp routine to write a piece of text, I cannot set textheight in the command line, otherwise it will always put the rotation angle in, i.e., I cannot say this:
(command "text" startpoint textheight angle text)
but only:
(command "text" startpoint angle text)

And, if I don't want to pick a point on the screen again for the position of the text, in another word, I just want to draw a lead line from the point I picked already in the model space to put the elevation text, the only difference is the line and text will be in the paper space, is that possible?

I appreciate your help!

Foresthills
 
I think you want to replace the lines

(setq p2 (getpoint "\nPick point for middle of text: "))
(COMMAND "TEXT" "Ju" "M" p2 h "0" s)

with

(COMMAND "LEADER" pause pause "" s "")

Let us know if that works like you want.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor