PDA

View Full Version : AutoLISP programs for ASCII files


houstonvett
2007-07-10, 02:08 PM
I need to take out AscII file information of of SMT Geophysical software and input the data into Auto Cad. Does anyone know of a good program to do this with so I can bring the information in globally into my project? Thanks to the forum in advance for the help, houstonvett

Mike.Perry
2007-07-11, 06:16 AM
Hi "houstonvett"

Please note I have *moved* this thread from the CAD Management - General (http://forums.augi.com/forumdisplay.php?f=119) forum to this one, as I believe it will be better served here.

+

In future please do not post the same question to more than one forum. I have removed your duplicate post from the AutoCAD General (http://forums.augi.com/forumdisplay.php?f=120) forum.

Thanks, Mike

Forum Manager

rkmcswain
2007-07-11, 01:01 PM
I need to take out AscII file information of of SMT Geophysical software and input the data into Auto Cad. Does anyone know of a good program to do this with so I can bring the information in globally into my project? Thanks to the forum in advance for the help, houstonvett

What kind of data is this, and what format is it in?

For example, is this point data? If so, is it organized something like "X,Y,Z" in the ASCII file?

houstonvett
2007-07-11, 09:29 PM
Thanks Mike Perry for putting the question in the right spot. To RK it is text information such as well name, APi number, operator name etc. Sure do appreciate the help here, houstonvett

tedg
2007-07-11, 09:58 PM
Thanks Mike Perry for putting the question in the right spot. To RK it is text information such as well name, APi number, operator name etc. Sure do appreciate the help here, houstonvettIf you just need to bring it in as text, you can import text (.txt) while in MTEXT dialog.

houstonvett
2007-07-12, 03:38 PM
TedG the text also includes X and Y projections that need to be carried across from SMT to Auto Cad. I have seen some programs that use a Excel spread sheet to load the SMT data in and then assign those attributes to different blocks in Cad. Unfortunately the program I seen is no longer available from the original vendor and was wondering if anyone on the forum as seen another Auto Lisp routine like the one I am describing. Thanks again, houstonvett

jwanstaett
2007-07-13, 12:39 AM
can your post a sample of the text file.

houstonvett
2007-07-27, 08:43 PM
Here is a copy of the ASCII files that would come out of SMT. There will be attributes tied to different partitions of the text such as Operator name, fee name, well symbol and total depth API number and X and Ys. The first numbers such as the 223 guys would be the API number. The text right after that would be operator name. Text right after that would be the fee name next line is the well number, next tied together is the date followed by total depth and what the well did. D&A is drilled and abonded. Next would be the X cooridinate 6 numbers. the next 6 would be the Y cooridinate. The next numbers would be lat and long numbers and the last 3 numbers would be the kelly bushing height. I am in the proscess of double checking to make sure the information I provided here is correct. TIA



2231290014600AJett Winstead 1 60032211318D&A 281244 8952563212614 8953994 421
2231290017600APan Am Filtrol 1 61020611355D&A 284812 8979193213352 8952847 469
2231292017100ANorcen Barnes 1 88102811844D&A 283580 8970883213122 8953243 458
3231292023200ANorcen Burns 1 90073011114OIL 281854 8970503213108 8953800 466 281840 8971703213141 8953805
3231292024100ANorcen Henderson 1 91041514618OIL 281347 8984543213493 8953967 474 281336 8985223213512 8953970
3231292024500ANorcen Kearney 1 91082011000OIL 280468 8991703213688 8954252 422 280418 8991853213692 8954268
3231292024900ANorcen Gladstone-Winstead 1 99062615123OIL 282518 8984353213490 8953589 476 282452 8983323213461 8953609
3231292025200ANorcen Bounds 1 92091311622D&A 285973 8963223212915 8952468 533 285999 8964083212939 8952459

I can send anyone a copy of the txt file though Email if you need an electronic copy of it. Thanks for any help the forum can provide, houstonvett

rkmcswain
2007-07-27, 09:22 PM
So you just want a program to read and parse this text file and populate attributes with this data? Sort of a reverse "attribute extraction"...?

If so, how will the program know what data goes into what block? Based on the XY data and the location of the block? If so, what is considered a match, within 0.0001?

Yes, it can be done.

houstonvett
2007-07-27, 09:56 PM
You are correct RK. The program would need to populate the data from the ASCII file and tie it to a block. The only difference in the blocks would be the well definition character of the block. Such as dry hole is 1 symbol, oil well another symbol, gas well different symbol and so on. The rest of the blocks would all be the same. As far as accuracy the X and Y coordinates should put it right where it needs to go in the drawing. Thanks again for the help, houstonvett

jwanstaett
2007-07-30, 06:35 PM
Here is a copy of the ASCII files that would come out of SMT. There will be attributes tied to different partitions of the text such as Operator name, fee name, well symbol and total depth API number and X and Ys. The first numbers such as the 223 guys would be the API number. The text right after that would be operator name. Text right after that would be the fee name next line is the well number, next tied together is the date followed by total depth and what the well did. D&A is drilled and abonded. Next would be the X cooridinate 6 numbers. the next 6 would be the Y cooridinate. The next numbers would be lat and long numbers and the last 3 numbers would be the kelly bushing height. I am in the proscess of double checking to make sure the information I provided here is correct. TIA



2231290014600AJett Winstead 1 60032211318D&A 281244 8952563212614 8953994 421
2231290017600APan Am Filtrol 1 61020611355D&A 284812 8979193213352 8952847 469
2231292017100ANorcen Barnes 1 88102811844D&A 283580 8970883213122 8953243 458
3231292023200ANorcen Burns 1 90073011114OIL 281854 8970503213108 8953800 466 281840 8971703213141 8953805
3231292024100ANorcen Henderson 1 91041514618OIL 281347 8984543213493 8953967 474 281336 8985223213512 8953970
3231292024500ANorcen Kearney 1 91082011000OIL 280468 8991703213688 8954252 422 280418 8991853213692 8954268
3231292024900ANorcen Gladstone-Winstead 1 99062615123OIL 282518 8984353213490 8953589 476 282452 8983323213461 8953609
3231292025200ANorcen Bounds 1 92091311622D&A 285973 8963223212915 8952468 533 285999 8964083212939 8952459

I can send anyone a copy of the txt file though Email if you need an electronic copy of it. Thanks for any help the forum can provide, houstonvett

dose the file have tabs in it
send me a copy of the text files

houstonvett
2007-07-30, 06:49 PM
Thanks jwanstaett PM sent

houstonvett
2007-08-07, 10:06 PM
Any Autolisp gurus can do this program Please contact me ASAP, TIA

Lions60
2007-08-08, 04:12 PM
If you could either post or send me a copy of the text file and a copy of an example drawing with what the block looks like and the block name and all that i might be able to get a program to you but i am not for certain as i have never dealt with attributes in programs. I know i should be able to read the text file and store the data.

houstonvett
2007-08-10, 04:50 PM
Email sent Thanks for the help, houstonvett

peter
2007-08-11, 08:19 PM
I have a tool that will do this, it is not that complicated. It appears that the text seems to be space delimited or is it formatted?

Try this routine for starts. Create the datafile as a csv file type like "houstonvet.csv"

Load and run this lisp routine and select the csv file and it should import it into a list of sublists that can be utlilized to populate blocks etc...

Can you be a little more about what you want the data to do when it gets in there?

Populate attributes in blocks?

Create a table?

Draw geometry?

Peter

alaspher
2007-08-13, 05:19 AM
I have a tool that will do ...

Hi!
Function IsNumber isn't correct!

Examle:
_$ (IsNumber "00.12.10")
0.12

Try this variant:
(defun IsNumber (strItem / chkDigit strTrans)
(setq strTrans (vl-string-translate "," "." strItem)
chkDigit (vl-string-trim "0123456789" strTrans)
)
(cond ((= chkDigit ".") (atof strTrans))
((= chkDigit "") (atoi strTrans))
(strItem)
)
)

I save return unchanged string when strItem isn't digit, but may be better return - nil?

Best Regards!