×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Lisp to define points for cnc path

Lisp to define points for cnc path

Lisp to define points for cnc path

(OP)
How do I change the following Lisp program so that the first number is the x-value and the second is y-value but shows as 2X the value(is diameter instead of radius)?

(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)
)


Thank You

RE: Lisp to define points for cnc path

So you want the y value to actually report as 2xy? (not sure how this works for labelling a radius though...)
Then this:

CODE

(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)
        2y (* 2 y);;added this line
        s (strcat "(" (rtos x) "," (rtos 2y) ")")
  )
 (command "osmode" 0)
 (setq p2 (getpoint p1 "\nPick point for end of Leader: "))
 (COMMAND "DIM1" "LE" p1 p2 "" s)
 (command "osmode" osm)
 (princ)
)


RE: Lisp to define points for cnc path

(OP)
I don't think I explained the problem well.
We want to define the contour of a formed Roll from a "zero" point. This "zero" point is on the centerline axis and on one face of the Roll. We need all tangent points of the contour so that we can write a CNC program from these points. Each point is a distance from the "zero face" and on a radius(but the program needs the Diameter-therefore 2 times y value).
I hope this clears up the question.
TIA
11991

RE: Lisp to define points for cnc path

Nope, not clear to me. I think I'll need a sketch.  Maybe because the CNC process is not clear  to me.  The main thing I'm not grasping is the reference to "y" as a radius.  The first routine merely labels the x & y coordinates of a picked point. My editited routine used 2*y in place of y.  If not a sketch maybe an example describing a point and coordinates, and how it should be labeled.

RE: Lisp to define points for cnc path

While diameter would be plus and minus y
I do not understand why 2y would define the
diameter from the zero axis.  If your input
is the diameter instead of the radius, then
you want to define y as the diameter divided
by 2 or diameter times 0.50 for the y value.

RE: Lisp to define points for cnc path

I had problems with the link, couldn't download.

And a question for you- did you try the lisp routine I posted?  It did incorporate the "y=2*y" you keep mentioning. :)

RE: Lisp to define points for cnc path

(OP)
I can not get it to load. It shows it loads but does not work. I look at the Load Applications function and it is not there, however it is in the Startup Suite and the Support File Search Path.
I also tried altering the PPP Lisp from above with your changes with no luck. I only get the (x,y) values.

RE: Lisp to define points for cnc path

I think the problem is in how you are saving the file or loading it.  If I copy and paste the above code into AutoCAD's command line (a shortcut way of loading code), then type PTT, it labels points with 2 times the y value. Try pasting the above code into notepad, save with a ".lsp" extension.  Remove other routine from startup suite. Load this new routine.  Should work.

RE: Lisp to define points for cnc path

Oh yeah, if you just want to edit yours with my changes, I didn't flag an important item you might have missed:

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

RE: Lisp to define points for cnc path

(OP)
Thank you, CarlB. It works as you said.
11991

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources