Welcome to Our Community

Some features disabled for guests. Register Today.

(Semi) automatic tool changes with Fusion 360

Discussion in 'CAM' started by Alex Chambers, May 10, 2019.

  1. Alex Chambers

    Alex Chambers Master
    Moderator Builder

    Joined:
    Nov 1, 2018
    Messages:
    2,780
    Likes Received:
    1,361
    I'm not sure if this is the right place to post this - I am sure someone will advise me if there is somewhere more suitable. This is the start of a (steep) learning curve for me and comments from people who (unlike me) know what they are talking about will be welcome.

    The main reason for this little project was to force myself (a complete beginner) to learn some G-code, but a word of caution to experienced G-coders and GRBL users in general. These experiments have been done on the Workbee with Duet controller supplied by Ooznest. It uses it's own dialect of G-code - in particular;

    M291 is not ISO standard - it creates a message box

    The Ooznest firmware uses G54 for machine co-ordinates - unlike G53 this is modal. It uses G55 for the first workplace co-ordinates.

    This all started with someone running a homing macro after (inadvertently) running some G code in inches. @sharmstr and @David-the-swarfer suggested using g code to move to a safe place instead of a homing macro which got me thinking about (semi) automatic tool changes.

    Now, I am not about to build an automatic toolchanger to bolt onto my Workbee and, as I am using a chinese clone of the Makita router, I am not going to automate undoing the collet nut, inserting new tool and re-tightening it. But I would like the machine to move to a safe place after each toolpath, wait while the tool is changed, do a Z probe and then continue with the next toolpath.

    Ooznest had already done much of the macro work by writing a Z-probe macro - all I have done is add some extra code around their macro.

    toolchange.g macro is the result - I tried to upload it but it won't work so I'll try pasting the text here instead

    ;This Macro is to be used with an active low touch probe. It does NOT Require adjustment for different endmill sizes. It DOES require adjustments for different probe sizes. Please see comments below.

    G54 G0 Z90
    G55 G0 X0 Y0 ;Raise Z Absolute go to Workplace X0 Y0
    M291 P"Press OK when tool change complete. Job Complete? Press Cancel" R"Tool Change" S3 ;cancel only cancels macro - use at end of job only
    M291 P"Make sure the probe is connected and is in position." R"Warning" S3 Z1 ;allow Z jogging before acknowledgement
    G91
    G1 Z-0.5
    T1
    M585 Z50 E2 L0 F500 S1
    G10 P1 X0 Y0 Z0
    G10 P2 L20 Z1.6 ;Please adjust the Z value here to match z offset of your probe.
    G1 Z3
    G55
    M500
    T0
    G90
    M291 P"Probe complete. Please remove probe." R"Success" S3


    To prove the concept works I used a text editor to paste a macro call (M98 P/macros/toolchange.g - don't forget to include the path to the macro)between each of the toolpaths generated by the Fusion 360 post processor for the Ooznest Workbee and Duet.

    Until I learn more about post processing (at the moment I know nothing) either the tool paths have to be in the right order in Fusion or cut and pasted into the right order in a text editor.
    It's also important when creating the setup in Fusion to make sure there will always be somewhere to do a Z probe - if you machine away all the surface of your workpiece you will have difficulty resetting Z zero with a new tool.

    So that was the easy bit - now to try to learn something about javascript ... so that I can get the post processor to append the M98 line after each toolpath.

    Alex.
     
  2. sharmstr

    sharmstr OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 23, 2018
    Messages:
    2,059
    Likes Received:
    1,448
    " so that I can get the post processor to append the M98 line after each toolpath".

    Wouldnt you want it only when there's a tool change? In any case take a look at the onSectionEnd function.

    Your other option is to add a manual nc operation between each tool change. You can set it up one time and save it as operation template so its easier to add next time.
     
    Alex Chambers likes this.
  3. Alex Chambers

    Alex Chambers Master
    Moderator Builder

    Joined:
    Nov 1, 2018
    Messages:
    2,780
    Likes Received:
    1,361
    Thanks for the response @sharmstr - I understood the first bit and @GeoffH has just pointed out to me that it would be logical to put the tool change at the start of the toolpath - both very helpful comments that I shall go away and think about.
    I didn't understand the second bit at all - I started this journey (with Fusion and the Workbee) in February and most of this is still a foreign language!:eek:
    Thanks for the input.
    Alex.:D:D:D
     
  4. sharmstr

    sharmstr OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 23, 2018
    Messages:
    2,059
    Likes Received:
    1,448
    Oh sorry. Watch this. Also, there's an option to call a program which might work better for you. (again, if you cant modify the post to work the way you want)

     
    Alex Chambers likes this.
  5. sharmstr

    sharmstr OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 23, 2018
    Messages:
    2,059
    Likes Received:
    1,448
    Forgot to mention, if you want to add it to the post for the beginning of each tool path, look at the onSection function instead of onSectionEnd.
     
  6. Alex Chambers

    Alex Chambers Master
    Moderator Builder

    Joined:
    Nov 1, 2018
    Messages:
    2,780
    Likes Received:
    1,361
    Don't apologise @sharmstr - the whole point of posting my efforts was so that people like you would chip in with comments that would help me learn. I've found the onSection function and the onSectionEnd function in Ooznest's post processor so I'll have a play with the effects those have. Now that I've successfully written my first macro (well - modified Ooznest's Z probe one) the input from you and @GeoffH has opened up the possibility of doing something a bit more sophisticated.
    Many thanks!:thumbsup::thumbsup::thumbsup:
    Alex.
    PS - haven't played that vid all the way through but it looks very useful - thanks!
    PPS If someone had told me this morning that by the end of the day I would be modifying a post processor I would have been looking at the sky for the flying pigs! - the help I have got from fellow forum members is phenomenal.
     
    #6 Alex Chambers, May 10, 2019
    Last edited: May 10, 2019
    sharmstr likes this.
  7. Alex Chambers

    Alex Chambers Master
    Moderator Builder

    Joined:
    Nov 1, 2018
    Messages:
    2,780
    Likes Received:
    1,361
    Thanks to @GeoffH this project is nearly finished - he modified the Ooznest Fusion 360 post processor for the workbee with Duet controller so that I could insert macro calls before and after each toolpath. I've just about finished writing the macros (mostly by modifying macros provided by Ooznest) and I'll post details of the post processor changes and the macros I'm using later when I've tidied up the files) In the meantime I needed an XYZ probe for this to work.
    I haven't got around to milling aluminium yet (mainly because I haven't got any suitable aluminium) so I made mine with a piece of double-sided PCB and some square brass tube - pictures attached. I used my workbee to cut out the PCB so that I knew it was square and soldered the brass tube to the underside of the PCB. Then I connected the brass tube to the top surface of the PCB with a short wire link and soldered on the lead going to the Z limit switch (the Ooznest macro uses this to detect probe contact.)
    It's important that the brass tube is proud of the PCB so I soldered it flush with the edge of the PCB and then milled 0.5 mm off the edge of the PCB. Then a micrometer to check offsets so that I could adjust the macro and a crocodile clip on the other probe lead.
     

    Attached Files:

    sharmstr likes this.
  8. Alex Chambers

    Alex Chambers Master
    Moderator Builder

    Joined:
    Nov 1, 2018
    Messages:
    2,780
    Likes Received:
    1,361
    So, with many thanks to @sharmstr for pointing me in the right direction and enormous help from @GeoffH who showed me two ways of rewriting the post processor to do what I wanted I now have a version of Ooznest's Fusion 360 post processor for the Workbee with Duet controller that will insert calls to three macros in the *.nc output file.
    The first macro (called "start") is called when the post processor reaches the first section (toolpath). If it's not the first section then the post processor inserts a call to a macro called toolchange. When it reaches the end of a section it inserts a call to a macro called endoftoolpath. Note that the macro calls need to include the path to the macros - in my case the directory /macros on the SD card.

    I've attached the three macros I've written for my purposes, but these could be written to do whatever you want (that your dialect of G-code will support)
    Start uses an 1/8" probe to do an XYZ probe, pauses to allow a change to the first tool and then does a Z probe.
    Toolchange pauses to allow a tool change and then does a Z probe.
    Endoftoolpath is for future development and mine at the moment is just an empty macro (apart from a message box asking you to acknowledge the macro)

    For non-Duet users please remember that Ooznest's version of the rep-rap firmware is a bit non-standard - I am only familiar with the Duet but;
    M291 (message box) is rep-rap - the nearest I can find in generic grbl is M117, but the rep-rap version does a lot more - see my post on macro changes for the duet Workbee with Duet controller macro changes.
    G54 for the Ooznest Duet is machine co-ordinates - but is still modal
    G55 for the Ooznest Duet is Workplace (1) co-ordinates - I haven't yet experimented to see if the Ooznest version allows other workplace co-ordinates.
    There is not much point having a pause to allow tool changes unless you also include a Z probe to reset Z zero for different tool lengths so if you haven't machined yourself a nice, solid, aluminium one yet see Quick and Easy XYZ Probe

    The advantage of inserting macro calls in the g-code file from the post processor is that they can easily be modified to suit different ways of working and I have no doubt I will be changing mine after I have used them for a while - apart from anything else M291 offered the option of displaying jog controls alongside the message and I spent many hours trying to get these to work - they work fine if you run a macro from the Duet Web Control console, but calling them from within another file just freezes the system. (Apparently a firmware update due in about a week will fix this)

    Usual disclaimer - I have tested these on my machine and you are free to use them as you wish but there are no warranties, express or implied - I recommend an emergency stop switch!:D:D

    Alex (and @GeoffH) with help from @sharmstr.

    I have had to change the extensions of the files to upload them;
    toolchange.txt is the cps file
    toolchangemcr.txt, start.txt and endoftoolpath.txt are the macros. Macros do not need a file extension and toolchangemcr will need the mcr bit removing as well as the extension.
     

    Attached Files:

    #8 Alex Chambers, May 22, 2019
    Last edited: May 22, 2019
    sharmstr likes this.
  9. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    14,931
    Likes Received:
    4,292
    I dont think Grbl supports M117 gnea/grbl - also, doesnt have displays to display messages on. :)
     
    Alex Chambers likes this.
  10. Alex Chambers

    Alex Chambers Master
    Moderator Builder

    Joined:
    Nov 1, 2018
    Messages:
    2,780
    Likes Received:
    1,361
    Thanks for that Peter, like I said my only experience is with the Duet from Ooznest - until I get around to building another machine (thinking about it) and using the blackbox to control it I'll stick with the (slightly weird) version that Ooznest have provided.
    Alex.:D:D
    And I meant to say g code rather than grbl.
     
    #10 Alex Chambers, May 22, 2019
    Last edited: May 23, 2019
  11. GeoffH

    GeoffH Journeyman
    Builder

    Joined:
    Mar 11, 2017
    Messages:
    178
    Likes Received:
    107
    Hi Alex, it would be great to see a video of your tool-changing in action, when it's finished - Geoff
     
  12. Alex Chambers

    Alex Chambers Master
    Moderator Builder

    Joined:
    Nov 1, 2018
    Messages:
    2,780
    Likes Received:
    1,361
    I'd love to @GeoffH, but if I take a video on my phone it ends up too large to email. Will try to see if I can upload it here.
    Alex.
     
  13. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,441
    Likes Received:
    1,910
    there are many solutions to the large video file situation:
    ffmpeg
    this has an option for everything so can be complicated, but the good news is someone has already figured it out for what you want to do, ie take a phone video file and make it smaller. just google it (-:

    one of many free video editors:
    this would allow you to cut off the beginning and end (or other bits) before outputting the file in a chosen format and size.
    they range from simple to pro-capable, I use Davinci Resolve which is used to make real movies.

    youtube:
    create a channel, upload to there, and then everyone can see it and select the size they need when they view.

    cellphone settings.
    most phones have some settings you can change so just select a smaller video format.

    THE ONE BIG THING to remember when making video is NEVER EVER hold the phone in your hand. Use that fancy CNC to make a tripod (-: Shaky video is worse than no video.
     
    GeoffH likes this.
  14. GeoffH

    GeoffH Journeyman
    Builder

    Joined:
    Mar 11, 2017
    Messages:
    178
    Likes Received:
    107
    Alex can't believe you have a phone to do this and David I just knew that a youngster would know how to do it, so absolutely no use asking me. Geoff :thumbsup:
     
  15. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    14,931
    Likes Received:
    4,292
    Easier than ffmpeg: Handbrake: HandBrake: Open Source Video Transcoder
    Even has presets for "Web -> Email" for example.

    That said, downcoding, sending by email? :) What year is this! Lol!. Upload to Youtube let them take care of it :)
     
    GeoffH and David the swarfer like this.
  16. Alex Chambers

    Alex Chambers Master
    Moderator Builder

    Joined:
    Nov 1, 2018
    Messages:
    2,780
    Likes Received:
    1,361
    Perhaps us oldies should have a section of the forum all to ourselves @GeoffH - we could entertain ourselves with accounts of our rubber band driven cnc machines. :ROFL::ROFL::ROFL::ROFL::ROFL:
    Alex. :p:)
     
    Giarc and GeoffH like this.
  17. GeoffH

    GeoffH Journeyman
    Builder

    Joined:
    Mar 11, 2017
    Messages:
    178
    Likes Received:
    107
    I'm personally more familiar with NC machines Alex, not so much CNC - good idea :ROFL::ROFL: Geoff
     
  18. Alex Chambers

    Alex Chambers Master
    Moderator Builder

    Joined:
    Nov 1, 2018
    Messages:
    2,780
    Likes Received:
    1,361
    Hey, I can't believe you are that old @GeoffH! I was looking at cnc machines over 25 years ago! :rolleyes::rolleyes:
    Alex. :D:D:D
     
  19. GeoffH

    GeoffH Journeyman
    Builder

    Joined:
    Mar 11, 2017
    Messages:
    178
    Likes Received:
    107
    I'm afraid so Alex :(, CNC wasn't invented when I started about 50 years ago :(:(:(:( - up to my neck in paper-tape
    upload_2019-5-23_17-44-3.png
    :rolleyes: - ooh those were the days - Geoff
     
    Alex Chambers and sharmstr like this.
  20. Alex Chambers

    Alex Chambers Master
    Moderator Builder

    Joined:
    Nov 1, 2018
    Messages:
    2,780
    Likes Received:
    1,361
    Reminds me of when I was teaching technology (electronics/robotics/engineering) to 16-18 year olds. 6502 or 6800 microprocessors, separate eprom chips, machine code programming and really delicate engineering because we could only afford weak steppers (mAmps not Amps - could stop them with fingers). I'm pleased to say I have forgotten most of that!
    Alex. :D:eek:
    Oh, and because of the weak steppers we loved backlash - it meant that the steppers didn't stall.
     
    #20 Alex Chambers, May 24, 2019
    Last edited: May 24, 2019
    GeoffH likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice