Hi guys, I have just started programming with Visual Basics v6. I am trying to write a program that allows me to read data from five Gerber.txt files and import the data to an Excel workbook.
My first problem is reading the notepad file the Gerber makes. I can open them, but I can't read the data and organise the data types in any format, or infact close the files afterwards.
Heres the start for the code;Here is a sample of a simple file that I want to arrange;Code:Private Sub Control_Click() Dim FileName As String Dim DFileName As String Dim TFileName As String Dim BFileName As String BFileName = ("C:\Program Files\Labcenter Electronics\Proteus 7 Professional\SAMPLES\controller1 - CADCAM Bottom Copper") TFileName = ("C:\Program Files\Labcenter Electronics\Proteus 7 Professional\SAMPLES\controller1 - CADCAM Top Copper") DFileName = ("C:\Program Files\Labcenter Electronics\Proteus 7 Professional\SAMPLES\controller1 - CADCAM Drill") FileName = ("C:\Program Files\Labcenter Electronics\Proteus 7 Professional\SAMPLES\controller1 - CADCAM READ-ME") Shell "notepad.exe " & FileName, vbNormalFocus Shell "notepad.exe " & BFileName, vbNormalFocus Shell "notepad.exe " & TFileName, vbNormalFocus Shell "notepad.exe " & DFileName, vbNormalFocus End SubOne of my first objectives is to convert the data files to a format that my homemade PCB router will understand. I need to organise the data files so that my router will know were the cutting tool should be in relation to the code. At the moment the file formats are for a photoplotter pen.Code:G04 PROTEUS RS274X GERBER FILE* %FSLAX24Y24*% %MOIN*% %ADD10C,0.0120*% %ADD11R,0.0800X0.0250*% %ADD12R,0.0800X0.0800*% G54D10* X+0Y+0D02* X+0Y+936D01* X-116Y+1336D01* X+883Y+1336D02* X+867Y+936D01* X+867Y-986D01* X+1650Y-986D01* X+2050Y-1000D01* X+2050Y-1375D01* X+2050Y-1500D01* X+400Y-1500D01* X+0Y-1500D01* X+2050Y+0D02* X+1930Y+125D01* X+1930Y+936D01* X+1883Y+1336D01* X+2050Y-500D02* X+2914Y-500D01* X+2914Y+936D01* X+2883Y+1336D01* X-1534Y+1336D02* X-1534Y-474D01* X-400Y-474D01* X+0Y-500D01* G54D11* X+0Y+0D03* X+2050Y-1500D03* X+0Y-500D03* X+2050Y-1000D03* X+0Y-1000D03* X+2050Y-500D03* X+0Y-1500D03* X+2050Y+0D03* G54D12* X-116Y+1336D03* X+883Y+1336D03* X+1883Y+1336D03* X+2883Y+1336D03* X-1534Y+1336D03* X-2793Y-1655D03* X-2793Y-655D03* X-2793Y+344D03* X-2793Y+1344D03* M00*
To make this work properly I need to read a READ ME file first, so that the program will know what parts of the data files needs a conversion.
Here is the file that I'm using the setup the data conversions correctly;
I'd greatly apprecate the advise and some pointers about how I should proceed with some code.Code:LABCENTER PROTEUS TOOL INFORMATION FILE ======================================= In case of difficulty, please e-mail [email protected] Tool set up for Proteus layout 'controller.LYT'. CADCAM generated at 10:07:17 AM on Monday, March 24, 2008. File List --------- Top Copper : controller1 - CADCAM Top Copper.TXT Bottom Copper : controller1 - CADCAM Bottom Copper.TXT Drill : controller1 - CADCAM Drill.TXT Photoplotter Setup ------------------ Format: RS274X, ASCII, 2.4, imperial, absolute, eob=*, LZO Notes: D=Diameter, S=Side, W=Width, H=Height D10 CIRCLE D=12th DRAW D11 SMT W=80th H=25th FLASH D12 SQUARE S=80th FLASH NC Drill Setup -------------- Format: ASCII, 2.4, imperial, absolute, eob=<CR><LF>, no zero suppression. Notes: Tool sizes are diameters. Layer sets are in brackets - 0=TOP, 15=BOTTOM, 1-14=INNER. T01 40th (0-15) [END OF FILE]




Reply With Quote