Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Lisp for Coordinate Dimensioning

Status
Not open for further replies.

11991

Mechanical
Dec 28, 2004
57
Does anyone know where I could get a LISP program that would give me point dimensions like (x,y) with leader to the point?
 
Replies continue below

Recommended for you

You have sparked my curiousity. What do you need this lisp for?
 
It is very useful when dimensioning a CNC path which is to be programmed into a machine. When you ordinate dimension you have longer leaders and separated dimensions.
 
I see. Would ordinate dimensions work for that application? Or are you looking for something a little more efficient?
 
With ordinate dimensions it is still necessary to track two(2) leaders for each point. I had a lisp at one time that did this but I did not remember to save before a computer meltdown!
 
A friend suggests the following:
-------

"for that work i would suggest that he simply export it do DXF and then pull it into a GERBER languaage converter of some sort...
and let the CNC machine read it direct
QuickTrans-CAD Translator
Easily convert formats DXF, Gerber, GDSII, OASIS and more. Free Tryout!
-------
 
Please clarify - do you want a LISP that will allow you to select a point and then draw a leader from that point to another point you select and include the X,Y,Z coordinates of the first point as the leader text? If so, that's easy. Let me know....
 
All I want to be able to do is go around the contour ot a tool and pick points that are ends of lines and/or arcs and/or centers of arcs and get the x,y values and be able to place them in a convenient position for clear reading. It would be nice to also have a leader from picked point to place dimension is placed.
 
Here is a "quickie"
Save it as a file with a lsp extension
In AutoCAD, on the command line go (load"file.lsp") where "file.lsp" is your filename. Then run the command by typing PPT. Pick the point to ID and then the place for the other end of the leader.

(DEFUN C:pTT (/ osm p1 x y z s p2) ; ID a point, place coordinates text
(graphscr)
(setq osm (getvar "osmode"))
(command "osmode" 53)
(setq p1 (getpoint "\nSNAP to point to be ID'd: ")
x (car p1)
y (cadr p1)
z (caddr p1)
s (strcat "(" (rtos x) "," (rtos y) "," (rtos z) "))
)
(command "osmode" 0)
(setq p2 (getpoint "\nPick point for end of Leader: "))
(COMMAND "DIM1" "LE" p1 p2 "" s)
(command "osmode" osm)
(princ)
)
 
I am unable to get this lisp to work. I had no trouble getting it loaded into AutoCad(2000) but it does not react when, I named it PPC, is typed in the Command Bar.
Also, I do not need but x,y since this is 2D work.
 
No luck. Tried PTT, PPT & PPC.
 
The fragment DEFUN C:pTT( names the command as "PTT".
To get the z-coordinate removed, just take away the "," (rtos z) . Does this work for anybody else?
 
It doesn't work because of an error on 1 line (missing a quote):

change:
s (strcat "(" (rtos x) "," (rtos y) "," (rtos z) "))

to

s (strcat "(" (rtos x) "," (rtos y) "," (rtos z) ")")

Another minor change allows a "drag line" for picking text location. Here's the entire code for ease of copy & pasting:
------------------------------------------
(DEFUN C:pTT (/ osm p1 x y z s p2) ; ID a point, place coordinates text
(graphscr)
(setq osm (getvar "osmode"))
(command "osmode" 53)
(setq p1 (getpoint "\nSNAP to point to be ID'd: ")
x (car p1)
y (cadr p1)
z (caddr p1)
s (strcat "(" (rtos x) "," (rtos y) "," (rtos z) ")")
)
(command "osmode" 0)
(setq p2 (getpoint p1 "\nPick point for end of Leader: "))
(COMMAND "DIM1" "LE" p1 p2 "" s)
(command "osmode" osm)
(princ)
)

 
This does exactly. Thanks to all for the help.
 
FOr only X and Y:

(DEFUN C:pTT (/ osm p1 x y s p2) ; ID a point, place coordinates text
(graphscr)
(setq osm (getvar "osmode"))
(command "osmode" 53)
(setq p1 (getpoint "\nSNAP to point to be ID'd: ")
x (car p1)
y (cadr p1)
s (strcat "(" (rtos x) "," (rtos y) ")")
)
(command "osmode" 0)
(setq p2 (getpoint p1 "\nPick point for end of Leader: "))
(COMMAND "DIM1" "LE" p1 p2 "" s)
(command "osmode" osm)
(princ)
)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor