AutoCAD Mechanical Forum
Welcome to Autodesk’s AutoCAD Mechanical Forums. Share your knowledge, ask questions, and explore popular AutoCAD Mechanical topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AutoLisp program for storing points in a text format

1 REPLY 1
Reply
Message 1 of 2
prny90
519 Views, 1 Reply

AutoLisp program for storing points in a text format

Hello,

        I am a mechanical engineer, using autocad for a parabolic profile. I have to take  coordinates OF about around hundred points on the profile, I want the system do it for me using autolisp program. I have got the code for getting the points coordinates using getpoint, but know to store that points in a text format has become a problem, so please help me in completing my codeSmiley Happy

1 REPLY 1
Message 2 of 2
mastertool
in reply to: prny90

Hope this helps.

 

(defun c:mypoints()
 (setq ents(ssget"x"(list(cons 8 "mylayer")))); looks for everything on layer mylayer
 (setq mfile(open "c:/pickpoints.txt" "w")); write a txt file in c:
 (setq cnt(sslength ents))
 (setq c 0)
  (repeat cnt
    (setq elist(entget(ssname ents c)))
   (setq a(cdr(assoc 10 elist))); starting point of a line not (assoc 11 elist) is ending point
  (setq x(car a))
  (setq y (cadr a))
  (setq ans(strcat "X" (rtos x 2 4)"Y" (rtos y 2 4))); 4 place decimal
  (print ans mfile)
  (setq c(+ c 1))
 )
 (close mfile)
)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost