chipikiri Posted March 2, 2007 Posted March 2, 2007 I need help on how to extract pile coordinates to excel or spreadsheets, or anything that works and is quicker than just individual pile coordinates. Plse, help!! i have about 446 piles. Quote
lpseifert Posted March 2, 2007 Posted March 2, 2007 How are your piles represented on the dwg? If the are blocks you can use EATTEXT (Extended ATTribute EXtract). Quote
chipikiri Posted March 2, 2007 Author Posted March 2, 2007 they are normal circles, cad 2007. thanks in advance Quote
CarlB Posted March 2, 2007 Posted March 2, 2007 Here's a real simple lisp routine, writes to a text file in "x,y" format. You could give the file name an ".csv" extension then open with Excel (princ "\nType PTF to start") (defun c:ptf () (setq FileName (getstring "\nEnter file name for coordinate output: ")) (setq f1 (open FileName "w")) (princ "\nSelect circles to write to file: ") (setq PointSet (ssget '((0 . "CIRCLE")))) (setq EntNum 0) (repeat (sslength PointSet) (setq ename (ssname PointSet EntNum)) (setq PtCoord (cdr (assoc 10 (entget ename)))) (setq xval (rtos (car PtCoord) 2 4) yval (rtos (cadr PtCoord) 2 4) zval (rtos (caddr PtCoord) 2 4) PtString (strcat xval "," yval "," zval) ) (write-line PtString f1) (setq EntNum (1+ EntNum)) ) (close f1) (princ) ) Quote
chipikiri Posted March 2, 2007 Author Posted March 2, 2007 where is my .csv file saved, can not find it? Here's a real simple lisp routine, writes to a text file in "x,y" format. You could give the file name an ".csv" extension then open with Excel (princ "\nType PTF to start") (defun c:ptf () (setq FileName (getstring "\nEnter file name for coordinate output: ")) (setq f1 (open FileName "w")) (princ "\nSelect circles to write to file: ") (setq PointSet (ssget '((0 . "CIRCLE")))) (setq EntNum 0) (repeat (sslength PointSet) (setq ename (ssname PointSet EntNum)) (setq PtCoord (cdr (assoc 10 (entget ename)))) (setq xval (rtos (car PtCoord) 2 4) yval (rtos (cadr PtCoord) 2 4) zval (rtos (caddr PtCoord) 2 4) PtString (strcat xval "," yval "," zval) ) (write-line PtString f1) (setq EntNum (1+ EntNum)) ) (close f1) (princ) ) Quote
Starkey Posted March 2, 2007 Posted March 2, 2007 a .csv file is just another text format that is easily opened in a variety of applications, for this matter it will open up in Excel no problem once the data retrieved from AutoCAD is placed into the .csv file. Quote
chipikiri Posted March 2, 2007 Author Posted March 2, 2007 Starkey, i have done the .lsp fine and loaded successfully, opened excel, tried searching from all folders still can not find the saved file, ie the extracted file. Quote
Starkey Posted March 2, 2007 Posted March 2, 2007 Starkey, i have done the .lsp fine and loaded successfully, opened excel, tried searching from all folders still can not find the saved file, ie the extracted file. Gotcha, I thought you were going somewhere else with that. My fault...I guess CarlB would be the one to answer this but you might check your support folder in your AutoCAD folder. Quote
CarlB Posted March 2, 2007 Posted March 2, 2007 Oops, it's not easy to find, but use this typed at the command line, including parentheses (findfile "filename") Quote
fuccaro Posted March 2, 2007 Posted March 2, 2007 Try to replace the third line in the program (setq FileName...) with this one: (setq FileName (getfiled "" "" "csv" 5)) Quote
Starkey Posted March 2, 2007 Posted March 2, 2007 Try to replace the third line in the program (setq FileName...) with this one: (setq FileName (getfiled "" "" "csv" 5)) what does this do, fuccaro? Quote
CarlB Posted March 2, 2007 Posted March 2, 2007 It opens a dialogue box for creating the file, then you can also select the folder for the file, and (I believe) it defaults to the current drawing folder, and gives it "csv" extension as a default. Quote
chipikiri Posted March 3, 2007 Author Posted March 3, 2007 I am still struggling, I can not find the file output. Below is what I have tried:glare: ; Command: ptf Enter file name for coordinate output: fk44.cvs Select circles to write to file: Select objects: 1 found Select objects: 1 found, 2 total Select objects: 1 found, 3 total Select objects: 1 found, 4 total Select objects: Command: Command: (findfile ''fk44.cvs'') ; error: extra right paren on input Command: (findfile fk44.cvs) ; error: bad argument type: stringp nil Command: (findfile ; error: bad argument type: stringp nil Command: (findfile ; error: extra right paren on input Command: ptf Enter file name for coordinate output: fk.xls Select circles to write to file: Select objects: 1 found Select objects: 1 found, 2 total Select objects: 1 found, 3 total Select objects: 1 found, 4 total Select objects: Command: Command: (findfile fk.xls) ; error: bad argument type: stringp nil Command: (findfile ''fk.xls) ; error: bad argument type: stringp (QUOTE FK) Oops, it's not easy to find, but use this typed at the command line, including parentheses (findfile "filename") Quote
eldon Posted March 3, 2007 Posted March 3, 2007 I have been observing all these threads about extracting x, y coordinates, and whereas all the answers are technically brilliant, they never go quite far enough for practical on-site usage. Perhaps the problem is that the right question is not asked. Imagine a construction site where piles are being constructed. A bulldozer has just cleaned up and taken all the setting out pegs with it. A large gentleman is jumping up and down, saying that if Pile 127 is not set out in the next few minutes, he is going to put all the crew on stand-by at £12,000 per hour. Quite a lot of pressure! So instead of scanning reams of figures, you want the information of P127 now. That is why it is so important to have an unique reference to the x,y coordinates. If you need this unique reference, you cannot have an automatic routine to extract all coordinates, you have to do it individually, point by point. If the designer has created points that have a block with the centre coordinates and the reference as attributes, then to create the total station data file, all you have to do is extract the attributes. Otherwise you have to do it yourself, and all of the proposed solutions of extracting x,y coordinates involve some manual input to each point to sucessfully create a data file. With the increased use of total stations, it cuts down on errors to be able to go from Electronic drawing to site without manually entering data. Incidentally, when you have a batch of points (say 300 or more), and you use Excel to sort the numbers, P2 comes after P199 and P3 comes after P299, all very logical but not very useful for data files. Quote
dbroada Posted March 3, 2007 Posted March 3, 2007 I'll leave aside eldon's comments as I have no idea how piles are used so I'll just look at the code.... Firstly chipikin, can you post YOUR code. You may have slipped in a quote mark or parenthesis somewhere. Command: (findfile ''fk44.cvs''); error: extra right paren on input Command: (findfile ; error: extra right paren on input I sometimes get this if LISP exits before it ends, either through an escape or a bad instruction. Lisp is still trying to evaluate an expression but its out of step. Press escape a few more times and try again. Command: (findfile fk.xls); error: bad argument type: stringp nil Command: (findfile fk44.cvs) ; error: bad argument type: stringp nil LISP is trying to evaluate the value of a variable so you have the correct result Command: (findfile ''fk.xls); error: bad argument type: stringp you need the quote marks after .xls to close the string when I write to files I usually start with (setq filename ("c:\\test.csv")) to make sure I know where to look. Also note the use of \\ (or /) for path references. LISP takes a single \ as a command. Quote
fuccaro Posted March 4, 2007 Posted March 4, 2007 Use the dialog box to specify the file path and place it on the desktop. Quote
gigi7@iol.it Posted March 6, 2007 Posted March 6, 2007 Hi all, if you put on the third row (setq filename (getfiled "Center Export File" "" "txt" 1)) all works. Quote
Prime Posted January 16, 2008 Posted January 16, 2008 It would seem that if the 'piles' are circles or unique blocks the DATAEXTRACTION command will launch a wizard that will export those coordinates for you. And a host of other information. Quote
CR500R Posted July 18, 2013 Posted July 18, 2013 How would this lisp be changed so it gives coordinates in UCS? (looks to be WCS) thanks Quote
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.