Results 1 to 14 of 14
  1. #1
    Join Date
    Apr 2025
    Location
    Near Indinanapolis IN
    Posts
    11

    Access to generate machine G-code

    Greetings,



    I have been using Access for years to "run" my historic window mfg. business - clear back when tech-support was free! I wore them out :-) However, I was never formally trained and never got very deep into actual code, so while I tried to implement conventions and was aware of normalization it's not the most pretty or professional DB out there. But, it has proven functional and I use it practically every day.

    As you would imagine, it is structured something like this tblClient>tblProject>tlWindow, with several other support tables thrown in the mix.

    Right or wrong, every field and expression I need to generate window part cut list reports is in qryWinCalcs.

    I have also created several parametric spreadsheet programs in Excel to generate G-code for my CNC machines. On one sheet (winData) I have cells in which I input general specifications about a window, another sheet (winCalcs) uses that as a source to do the required calculations and yet another sheet (winProg) uses winCalcs as a source and is designed, formatted and structured be acceptable to be copied and pasted into a text editor to be used for G-code. I plug that right into my machines and the machine does my bidding. It works perfectly. So, once setup, I or one of my shop techs can go to the winData sheet and merely input the height, width, winID and part type (four fields) data and the proper G-code pops out the other end.

    Here's the rub….All the data that we input into the spreadsheets comes directly from Access reports. So, we have to print Access reports then manually input the data into Excel. We must do this for every unique window size in a project and there may be several sizes involved. For example, a current project has 82 windows and 27 of them are a unique size. Furthermore, there are at least three or more machining operations (CNC programs) for every window. This means in the example above, I or someone else must accurately input at least 81records and 324 pieces of data into the spreadsheets – lot’s of room for error.

    A very simplistic chunk of G-code looks like this. The following will mill a straight line in a piece of wood 900 mm long….

    G54 (lookup start points (X0 table left most, Y0 bottom most Z0 top most))
    M6T1 (change to tool 1)
    G43H 1 (lookup tool 1 height and set the Z height appropriately)
    M3S 24000 (Start the spindle and run it at 24000 rpm)
    G0Z 25.4 (Move spindle at max speed to 1” above the work)
    G0X100.00Y100.00 (Move at max speed to 100mm from the left and 100 from the bottom)
    G1Z – 10.00 F 4000 (Move at 4000mm/min to 10mm below the work surface)
    G1Y1000.00 (Move at 4000mm/min 1000mm up the work (cutting)
    G0Z 25.4 (Raise the spindle at max speed to 1” above the work)
    M5 (Turn off the spindle)
    M30 (End the program)

    All of my machines will read *.txt files

    So, a) does this seem feasible, b) has anyone experience in doing this, c) any suggestions or advice in implementing a program like this d) does anyone wan to work with me on a project like this?


    Cheers!

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,570
    Well if you already have it in Access, then it is entirely feasible to output a text file with that data.
    I would expect you would at least need a field to identify the window, fields that are linked to that window that identify the steps and another for order?

    So if that code is standard in that is the steps you need to create Window A, then all you need is to concatenate the dimensions and output that data. All the steps for each type of window should be stored in a table.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    davegri's Avatar
    davegri is online now Excess Access
    Windows 11 Access 2021
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,742
    I plug that right into my machines and the machine does my bidding.
    Can you explain a bit more on that? What do you do to "plug" it into the machine? Machine has scanner? You type something in?

  4. #4
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,822
    Hi
    Are you able to upload a copy of the database with no confidential data, together with a copy of an Excel file?

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Access can export queries and reports to Excel workbook. What data is in Access that Excel uses?

    Access might be able to do those calcs.

    Access can export data to text file.

    Excel can also link to Access to pull data.

    If you want to provide files for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    Join Date
    Apr 2025
    Location
    Near Indinanapolis IN
    Posts
    11

    DB and SS attached

    Sure,

    I'm not concered about confidential data and it would be too difficult to figure how to do that. So, I'll send you the live version of each one. Caveat, the db is really ugly with a lot of stuff I once needed but have been too busy to clean up. I just started on the CNC programming portion so I only have the tool tables that I'm still playing with. See my last post. All the germane data regarding window specs can be found in qryWinCalcs and related tables. I'll also attach a excel g-code generator that too is incomplete.

    For some reason the manage attachement's is not working for my zipped Excel file. I've tried several times. I can select it from my computer but when I try to click on upload file it greys out and doesn't respond.
    Attached Files Attached Files

  7. #7
    Join Date
    Apr 2025
    Location
    Near Indinanapolis IN
    Posts
    11
    No, what I mean is the code on the program sheet is complete with the correct syntax and data to copy to text editor from there I copy and past to a flash drive and walk it to the machine, plug it in and select and copy the file to the machine memory (for now). Soon I'll have everything networked and will save it to a folder on my desktop that's accessable from the machines.

  8. #8
    Join Date
    Apr 2025
    Location
    Near Indinanapolis IN
    Posts
    11
    Yes, as it is I have....

    tblMainClient>tblProject>tblWindow and at the same level with project Id as linke tblConstants

    Once I create the project record, I input the project data (common data for all windows in the project like thickness and glass type) the input the unique window data for each window. They are assigned a primary ID and I input the height, width and some other specific info. In a single query I do all the calculations required for my cut lists and refer to that query when generating reports filtered by the project ID

  9. #9
    Join Date
    Apr 2025
    Location
    Near Indinanapolis IN
    Posts
    11
    Here's the first few lines of the program sheet... There will end up being at least 1000 lines, maybe 2000. Parens mean ignore this line. The machines skip over the lines.

    (TrimBottom)
    G56 M06 T 1
    G43 H 1
    M0 S 18000
    G0 Z 25.4
    (Kiss Stile 1)
    G56 G0 Y -11.1125 X 160.7666
    G1 Z -32.75
    G1 X 143.3041 F 4000
    G0 Z 25.4
    (Kiss Stile 2)
    G0 X 430.7666
    G1 Z -32.75
    G1 X 413.3041
    G0 Z 25.4
    (KissTR)
    G0 X 691.2416
    G1 Z -32.75
    G1 X 673.7791 F 4000
    G0 Z 25.4
    (Kiss BR)
    G0 X 977.3198
    G1 Z -32.75
    G1 X 959.8573
    G0 Z 25.4
    (Window 2 Kiss)
    (Kiss Stile 1)
    ( G57 G0 Y -11.1125 X 160.7666 )
    ( G1 Z -32.75 )
    ( G1 X 143.3041 F 4000 )
    ( G0 Z 25.4 )
    (Kiss Stile 2)
    ( G0 X 430.7666 )
    ( G1 Z -32.75 )
    ( G1 X 413.3041 )
    ( G0 Z 25.4 )
    (KissTR)
    ( G0 X 691.2416 )
    ( G1 Z -32.75 )
    ( G1 X 673.7791 F 4000 )
    ( G0 Z 25.4 )
    (Kiss BR)
    ( G0 X 977.3198 )
    ( G1 Z -32.75 )
    ( G1 X 959.8573 )
    ( G0 Z 25.4 )

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    So you imported the Excel sheets? This does not provide calcs and design that are done by Excel. No idea why you have difficulty attaching Excel file.

    Why does tblTool have ToolID and ToolNum fields? ToolID is autonumber but not assigned as primary key.

    If you change db to Overlapping Windows instead of Tabbed Documents, can view multiple objects side-by-side. Often nice when you want to view tables/queries simultaneously.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    Join Date
    Apr 2025
    Location
    Near Indinanapolis IN
    Posts
    11
    Thanks for the interest!

    I'm getting confused. The DB I sent is the container for all the data and calcs required to generate the report/G-code most of the calcs are in qryWinCalcs. I've just been playing around all day while I get my head around how to really design this so, ignore the tool tables. I like the suggestion of overlapping docs but have never done it so it will be clumbsy at first. I'll try the attachment again.

    Once again, I left my cursor here, clicked on the attach icon above, was able to select the ziped excel file but it did nothing when I clicked on the upload button. It greyed out when I hover over. Another member asked me to send to an email address and I did so.

  12. #12
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,822
    Here with the Excel file sent from William by PM
    Attached Files Attached Files

  13. #13
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,570
    Check the size, you are probably exceeding the site limit.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  14. #14
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Quote Originally Posted by HeirloomWindows View Post
    I'm getting confused. The DB I sent is the container for all the data and calcs required to generate the report/G-code most of the calcs are in qryWinCalcs.
    I am also confused. Your original post stated there are calculations taking place in Excel on sheets winData, winCalcs, winProg - none of which are in the posted workbook by those names (although there is a 3WinProg sheet). With information given, I cannot advise how to proceed with migration to Access.

    If not already aware, something to take note of. Round() function in Access behaves differently than in Excel. Access uses bankers (even/odd) rounding. In Access Round(4.45,1) returns 4.4, in Excel it returns 4.5.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 07-27-2019, 06:33 AM
  2. Replies: 1
    Last Post: 05-23-2018, 09:35 AM
  3. Replies: 3
    Last Post: 10-20-2014, 03:25 PM
  4. Replies: 2
    Last Post: 10-15-2014, 04:23 AM
  5. Replies: 1
    Last Post: 02-16-2012, 05:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums