Preview gcode in OpenSCAD

New Home Forum Software / Firmware Development Preview gcode in OpenSCAD

This topic contains 9 replies, has 5 voices, and was last updated by  Guffy 4 days, 2 hours ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #103334

    Alexander Pruss
    Participant

    I made a little Python script that takes a gcode file from Estlcam (or maybe other sources — but currently not that many gcode features are supported, so YMMV) and generates an OpenSCAD file which simulates the cut with an adjustable bit shape (you can adjust the bit tip angle, the diameter and the length). The cut gets subtracted from a solid representing the workpiece (by default a 1000x1000x6mm “cube”, but can be adjusted).

    This should work better for some purposes than Repetier Host or Estlcam preview.

    To run:

    python gcode2scad.py filename.gcode > filename.scad

    OpenSCAD rendering is slow because of the subtraction, and Render may work better than Preview. (You can also not subtract by setting workWidth=0, which will increase speed.)

    mekleth

    Attachments:
    2 users thanked author for this post.
    #103346

    Jeffeb3
    Participant

    Very nice. I can’t wait to try it.

    #103362

    Ryan
    Keymaster

    WHat!!?!?! If this works That would be awesome!

    #103375

    kd2018
    Participant

    Very cool!

    #103440

    Guffy
    Participant

    You also may try to adapt your script to

    http://www.implicitcad.org/

    And

    https://icesl.loria.fr/

    Because openscad is really slow. Honestly, i didn’t try new openscad 2019.05, but I’m sceptical about it will be much faster.

    #103457

    Alexander Pruss
    Participant

    ImplicitCAD lacks the convex hull operation, so it won’t work. I also tried OpenJSCAD, but it only supports 2D convex hulls. I could write the code to generate a polyhedron representing a cutting bit path between two points directly rather than by just doing a convex hull of two cutting bit shapes, but I am not sure how well it’ll work.

    IceSL is worth trying, but it will be complicated.

    I agree that OpenSCAD is slow. But it’s still probably a bit faster than wasting a piece of wood on a cut that doesn’t do what one wants. The mekleth render in my screenshot takes just under 8 minutes (using Render mode; Preview mode doesn’t work well with giant subtractions). That’s because subtracting the cutting path from the solid is an enormously expensive operation.

    If one wants to see just the solid cutting path (by setting workWidth to 0), one can use Preview mode and it takes 4 seconds. Here’s the cutting path render.

     

    Attachments:
    #103460

    Alexander Pruss
    Participant

    I tried OpenJSCAD and ImplicitCAD again with a pre-rendered cutting path, just testing the subtraction speed, and it was way slower than OpenSCAD (in fact, I let them run for about 20 minutes and gave up).

    #103464

    Guffy
    Participant

    Icesl somehow tries to use opengl for accelerations, so may be it can be faster. Honestly, i guess it could even parse gcode file by itself, because it’s pure Lua.

    By the way, best solution  imho, if Cristian will implement it as a feature of estlcam.

    I’m use fusion 360 and cam simulation subsystem of it is great.

    Freecad cam also has internal feature to produce cutted shape.

    #103466

    Jeffeb3
    Participant

    Regardless of the speed, functionality comes first. Building this on such a freely available tool as openscad is a huge feature.

    #103540

    Guffy
    Participant

    IceSL renders pretty fast (in a second or two), but unfortunatelly only up to 900 segments. with more segments it crashes.

    icesl

    Attachments:
Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.