Welcome to Our Community

Some features disabled for guests. Register Today.

SketchuCam to Marlin gcode postprocessor (no longer needed)

Discussion in 'Other Software' started by Bob K, Aug 20, 2016.

  1. Bob K

    Bob K New
    Builder

    Joined:
    Jun 2, 2016
    Messages:
    55
    Likes Received:
    20
    Bob K submitted a new resource:

    SketchuCam to Marlin gcode postprocessor 1.0 - converts SketchUcam gcode to a format that the Marlin firmware can use

    Read more about this resource...
     
    Joe Santarsiero likes this.
  2. 3DMON

    3DMON New
    Builder

    Joined:
    Nov 8, 2013
    Messages:
    51
    Likes Received:
    22
    I haven't needed to create gcode for Marlin but Sketchucam has a feature to make the Gcode compatible with Marlin already. Does this not work properly? If so we should let David (swarfer) know or maybe you could help him to implement your changes in Sketchucam.

    Capture.JPG

    Capture2.JPG
     
    Mark Carew and David the swarfer like this.
  3. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,238
    Likes Received:
    1,815
    seems to me Marlin needs fixing...
    and someone needs to RTFM because SketchUCam has a Marlin output mode, and can also turn comments off or change style between (comment) and ; comment (but no option to have them on separate lines, not needed by the G-code standard).

    Can you explain what is wrong with the feedrate settings that Marlin does not like?
    SketchUcam outputs an F word only when needed, and also on the first line of setup codes and none of the simulators nor LinuxCNC/Mach3/GRBL have a problem with this, only Marlin (fix Marlin!).

    Just turn comments off entirely, single button click if you activate the Quicktools toolbar as explained in the help.

    SketchUcam uses R format arcs because Sketchup makes a mess of some arc segments which makes using IJ format problematic (the code exists!). To see this in action create an arc then trim an end segment about halfway along the segment.
    Sketchup will report the new endpoint, but that is on the CHORD and not on the RADIUS of the original arc. This means that the center point reported by Sketchup is now not the center of that arc segment.
    If you use IJ format for this any decent controller will detect that the center does not match the points you have given and will stop with an error.
    Solvable by a) using more arc segments, try 96,,,, b) then explode the arc to lines, or c) redraw the entire arc. This results in pretty good cuts that Marlin can handle. Like I have said elsewhere, please ask the Marlin developers to fix it since it does not adhere to the G-code standards.

    Lets have a careful look at your fixes (ps congratulations on getting Excel to do this)
    • more than one command on a line
    SketchUcam never does more than one movement per line because it is not in the standard, unless you mean the header line of G90 G43 etc, which IS valid G-code, but easy enough to hack your SketchUcam if you need it separated.
    Change line 260 in PhatMill.rb
    Code:
    cncPrint("G90 #{unit_cmd} G49 G17#{stop_code}") 
    to add linefeeds between each code.
    Code:
    cncPrint("G90\n#{unit_cmd}\nG49\nG17\n#{stop_code}") 
    comments NOT at the beginning or the end of a line
    • G02 & G03 commands that use the R format
    as explained above, explode to line segments. OR you can hack in the existing IJ code, Phlatmill.rb line 2140 but make sure your arcs are never edited. (hmm, that code is a bit old and needs checking since arcmove() has been improved since I messed with the arcmoveij() method)
    • command lines without a command on them
    standard G-code since paper tape days => Marlin is broken, but is already an option in SketchUcam. RTFM please.
    • feed commands before the J portion (haven't verified that)
    where does that happen? probably easy to fix if it really does happen, but then, this is valid G-code.
    hmm, probably in hole boring or countersinks as that is where IJ is used, lemme look....
    as far as I can see in the code, F words are always output at the end of a line.
     
    MaryD likes this.
  4. Bob K

    Bob K New
    Builder

    Joined:
    Jun 2, 2016
    Messages:
    55
    Likes Received:
    20
    Bob K submitted a new resource:

    SketchuCam to Marlin gcode postprocessor 1.1 - converts SketchUcam gcode to a format that the Marlin firmware can use (with updated macro)

    Read more about this resource...
     
    RichGMD61 likes this.
  5. Bob K

    Bob K New
    Builder

    Joined:
    Jun 2, 2016
    Messages:
    55
    Likes Received:
    20
    David - yes, reading the manual is not something I like to do. I didn't run across the "Force all Gcodes on for Marlin" option until after I'd written my first version of the Excel macro.

    Yes, Marlin needs to be fixed.

    I think most of the "corrections" I put in were because of self inflicted pain. I don't see them now that a) the Excel macro is working properly and b) I've remembered the documented constraints of not having the design at the origin and not putting plunges over circles.

    The "poor job of specifying the feed rates" is worded badly. SketchUcam doesn't know about the non-milling travel rates and implements only the required feed rate changes. I wanted to be able to specify the travel rates and to use them whenever it would speed up the overall job.

    The R format change is the main reason to share this macro. I'm not going to pretend that I know a lot about the various options and their nuances. So far the radius used to generate the I J values is within 1E-4 of the radius in the gcode command. I'm hoping that's good enough.

    I've re-written my comments. Let me know if further changes would be helpfull.

    Bob
     
  6. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,238
    Likes Received:
    1,815
    well, I found this
    http://mathforum.org/library/drmath/view/53027.html
    which gives me a way to calculate the proper center for arcs that get messed up by the offset process when creating inside and outside cut lines.

    so, I am making progress toward making IJ format the normal output....
     
    Kyo and Mark Carew like this.
  7. Bob K

    Bob K New
    Builder

    Joined:
    Jun 2, 2016
    Messages:
    55
    Likes Received:
    20
    The Marlin folks are looking at implementing the R method on G2/G3 commands. No idea of when it'll actually make it into released code.

    Attached is code I have running within Marlin to convert the R method to I & J. I've been using it for a couple of weeks with no problems Maybe it'll save you some work.
     

    Attached Files:

  8. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,238
    Likes Received:
    1,815
    that is more or less what I have done in SketchUcam, see personal message with beta version I sent to you on Friday.
     
  9. Bob K

    Bob K New
    Builder

    Joined:
    Jun 2, 2016
    Messages:
    55
    Likes Received:
    20
    The new version is looking good. A simulator didn't show any problems. I did a test cut in MDF and I can't see any differences between it and one I did last week.

    There are a few strange items that appear to be comment issues. Attached is a ZIP with the issues highlighted in yellow and the SKP that generated it.
     

    Attached Files:

  10. David the swarfer

    David the swarfer OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Aug 6, 2013
    Messages:
    3,238
    Likes Received:
    1,815
    Thanks Bob
    There were a couple of lines missing the counterbore code that should have forced a G00 output for that retract.
    I will send you a new beta just now.

    I noticed in your drawing that the top 2 counterbored holes are in fact 2 holes on top of one another, a 5.8mm bore followed by a counterbore.
    You can do that in one operation with the counterbore tool, just set the 'holediameter' as below to get a 5.8mm hole with a 10.5mm counterbore, 2mm deep, all in one click. it will drill the hole then do the counterbore.
    upload_2016-9-20_10-23-15.png

    I know you said you don't like reading manuals, but you really need to do that, it will save you time and make you better at using this tool.
     
  11. Bob K

    Bob K New
    Builder

    Joined:
    Jun 2, 2016
    Messages:
    55
    Likes Received:
    20
    This resource is no longer needed.
    • "Force all Gcodes on for Marlin" option set to TRUE takes care of most of the issues.
    • Marlin as of RC8 now supports G02 & G03 commands that use the R format.
     
    David the swarfer 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