Kcks Posted November 3, 2010 Share Posted November 3, 2010 Hey guys, I had a question about how to extract/export the coordinates from an AutoCAD drawing. I'm drawing an airfoil profile in autocad drawing and I want now to know the coordinates of the profile, so I can put in Xfoil and test some properties of the designed airfoil. (The airfoil consist out an Arc and couple of lines) I have already read some older thread but still I couldn't figure it out. I have made the PO2TXT file, but when using it I get an error: Select objects: bad argument type: numberp: nil What am I doing wrong? And if I enter this in the command line: (entget (car (entsel))) I get this: Select object: ((-1 . ) (0 . "LWPOLYLINE") (330 . ) (5 . "257") (100 . "AcDbEntity") (67 . 1) (410 . "Layout1") (8 . "0") (100 . "AcDbPolyline") (90 . 6) (70 . 0) (43 . 0.0) (38 . 0.0) (39 . 0.0) (10 65.9154 136.055) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 65.9154 136.055) (40 . 0.0) (41 . 0.0) (42 . -0.156819) (91 . 0) (10 226.935 112.905) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 157.819 104.82) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 113.846 97.504) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 77.0725 88.8182) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (210 0.0 0.0 1.0)) And I really don't have an idea what to do now, can someone help me.? Also is there another method to extract coordinates form an autocad drawing without use LISP? more information: I'm using AutoCAD 2011 (Trail version) and I can be seen as a Newbie. Regards, Kcks Quote Link to comment Share on other sites More sharing options...
ReMark Posted November 3, 2010 Share Posted November 3, 2010 You can elect to continue to develop your own routine (commendable) but why reinvent the wheel? Export Coordinates - Two routines available at the Cadalyst website. Tip #3192 by Douglas Lerner and Tip #ALSP1202 by Tony Hotchkiss. http://cadtips.cadalyst.com/node/tiplisting?keywords=export%20coordinates Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 3, 2010 Share Posted November 3, 2010 Here is a lisp would get your coordinates to a file named (D:coordinates.txt) on drive D:... Hope this what you look for ... (defun c:THpts (/ fNme pt pts coords) ; THARWAT Oct. 31.2010 (setq fNme (open "D:/coordinates.txt" "w")) (while (setq pt (getpoint "\n Specify point :")) (setq pts (trans pt 1 0)) (setq coords (write-line (strcat (rtos (car pts) 2) "," (rtos (cadr pts) 2) "," (rtos (caddr pts) 2)) fNme) ) ) (close fNme) (princ) ) Tharwat Quote Link to comment Share on other sites More sharing options...
Kcks Posted November 3, 2010 Author Share Posted November 3, 2010 Thanks for the quick reply guys. @ReMark: I have downloaded both file but the first files only extraxt some point of the object (like beginning and end). The second file gave me 5 coordinates of points and didn't see the arc as an object, thus I couldn't select it. @Tharwat: It did help me much. I realized that I have a line (beginning and end point) and what I wanted was the coordinates of the line including everything between the beginning and end point. So I need to make points on the line and then use the programs, right. Or is there some code which can give the coordinates of a line with segment of 1 (for example shop the line into 100 point and the give each coordinate) Regards, Kcks Quote Link to comment Share on other sites More sharing options...
ReMark Posted November 3, 2010 Share Posted November 3, 2010 This appears to be a case of "don't give me what I asked for, give me what I need". LOL Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 3, 2010 Share Posted November 3, 2010 Check this out ...... (defun c:THcoords (/ fNme ss e x y ) ; THARWAT Nov. 03.2010 (setvar 'pdmode 3) (setq fNme (open "D:/coordinates.txt" "w")) (while (setq ss (car (entsel "\n Select Line :"))) (entmakex (list (cons 0 "POINT") (cons 10 (cdr (assoc 10 (setq e (entget ss))))))) (entmakex (list (cons 0 "POINT") (cons 10 (cdr (assoc 11 e))))) (setq x (cdr (assoc 10 e))) (write-line (strcat (rtos (car x) 2) "," (rtos (cadr x) 2) "," (rtos (caddr x) 2)) fNme) (setq y (cdr (assoc 11 e))) (write-line (strcat (rtos (car y) 2) "," (rtos (cadr y) 2) "," (rtos (caddr y) 2)) fNme) ) (close fNme) (princ) ) Tharwat Quote Link to comment Share on other sites More sharing options...
Kcks Posted November 3, 2010 Author Share Posted November 3, 2010 Ohh no, it isn't like that, I just realized that what I was doing was wrong. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 3, 2010 Share Posted November 3, 2010 @Tharwat: It did help me much. I realized that I have a line (beginning and end point) and what I wanted was the coordinates of the line including everything between the beginning and end point. That was your request and I made it for you accordingly. Tharwat Quote Link to comment Share on other sites More sharing options...
eldon Posted November 3, 2010 Share Posted November 3, 2010 You could also export the coordinates without using Lisp, but using the commands within AutoCAD. First make a simple block (a cross or something similar). Then use Measure, using your block, at intervals of 100. Then use Attribute extraction which gives the Insertion coordinates of all the blocks. Quote Link to comment Share on other sites More sharing options...
Kcks Posted November 3, 2010 Author Share Posted November 3, 2010 Sorry my last reply was to ReMark. Your second code did exactlly what I trying to do by hand . Thanks for it Kcks Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 3, 2010 Share Posted November 3, 2010 Sorry my last reply was to ReMark.Your second code did exactlly what I trying to do by hand . Thanks for it Kcks Don't feel shy, if you need any modification , you're more than welcome. And I would modify them for you buddy. Just be stright to the point to let me give you the right thing. Best Regards, Tharwat Quote Link to comment Share on other sites More sharing options...
Kcks Posted November 3, 2010 Author Share Posted November 3, 2010 Hey guys I wanted to thank you all. Tharwat your second code worked perfectly, eldon the method you decribes also worked perfect. And the tips of ReMark did the extracting of the coordinates to a .txt which I can use for xfoil-testing. Thanks for the quick reply all. Greeting Kcks. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 3, 2010 Share Posted November 3, 2010 Tharwat your second code worked perfectly You're welcome Kcks. Tharwat Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 3, 2010 Share Posted November 3, 2010 This may also help, either search 'Point Manager' on the forums, or here is a link: http://lee-mac.com/ptmanager.html Quote Link to comment Share on other sites More sharing options...
VVA Posted November 4, 2010 Share Posted November 4, 2010 or look this thread too: Lisp: coordinates of points to excel sheet (+point number) Quote Link to comment Share on other sites More sharing options...
ReMark Posted November 4, 2010 Share Posted November 4, 2010 And they all lived happily ever after. The end. Stories with happy endings make my visual orbs leak fluid of some type on occasion. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.