Jump to content

Recommended Posts

Posted · Skin Starts (Z-Seam) SimulationView Mod

Hey. Recently I was printing some gears. I've found the location of the Z-seam* affecting the smoothness of the gears, which is important to me. So much so that I will manually edit the g-code to move it where I deem necessary, after trying my hardest to let Cura place them in inside corners.

 

The one thing I've found a bit annoying though is that it is cumbersome to check every layer, using the toolpath animation to check the start/seams. I noticed Slic3r has an option to show these, but I prefer Cura anyway.. So I thought maybe I could develop a plugin that does this, after not finding any option or plugins.. At this point I don't see how I could write a separate plugin for it, but what I found to work is to modify the original SimulationView "plugin". (The code that provides the Layer view in Cura's Preview tab).

 

Point of this topic:

Find others' thoughts in this feature, ideas / help developing it..

 

How to use:

In Cura's plugin directory: C:\Program Files\Ultimaker Cura 4.7\plugins on my installation, move the existing SimulationView folder elsewhere as backup, then place mine in there. Find mine at https://github.com/BasF0/Cura/tree/dev/plugins/SimulationView

 

 

DevTalk:

Not knowing Cura's code, or having ever written a plugin, or knowing a thing about shaders or glsl this was hard, but a few days in and here we are.

 

I walk through the LayerData and check where a new skin line occurs. (Confusingly, I've found that not to be "SkinType" but rather "Inset0Type"). The vertex that is the start of such a new line is added to a new LayerData object, created through a LayerDataBuilder. I've found that in this way, the Uranium backend will accept it 🙂 The day of writing this post, I've rewritten the code to do this inside a "Job" and it seems that SimulationView' _onSceneChanged is a good moment to recompute the starts. I have written a new shader that takes in points, and the geometry shader then emits a vertex_strip representing a 3d rectangle for each point. Perhaps a rectangle in the start is not the best shape one can think of, but a simple rectangle does the job for now. The vertex normals are probably wrong, by the way.. The size is also hardcoded in the shader because I was having some issues.

 

Debugging this was hard. I would simply reboot cura, open an stl, slice it, go to preview tab, to see my results. If I made an error in Python, the entire layer view would usually not load. If I made a syntax error inside the shader, the starts simply wouldn't be drawn, so I would manually have to check my changes. Is there an easier way for that ? I tried seeing if I could unload and reload the SimulationView plugin, but it seems not possible atm.

 

Bugs, todos and Ideas:

- currently hardcoded square height; should depend on line height I guess

- perhaps a configurable shape/size

- configurable color (or color per extruder, I dont know how cura handles that atm anyway)

- in the menu, the color indicator for the starts option does not display the correct color

- perhaps convert to a separate plugin that can be installed via the marketplace

- a way to separate the current top layer starts from the others.. perhaps simply a different color

- the "show starts" option is still visible when in compatibility mode (when the shader shouldn't be drawn)

- what would be even better is if I could drag the square to change the start! I have an idea how that might work, but am not sure of its implications:

I suppose the square should be draggable in the layer-plane (X, Z I believe?) and could then snap to each line start (visually). To adjust the polygon, we could copy the now skipped lines to the end of the current set of lines making up the skin, converting the 'skipped' lines into travel moves.

Of course, when we have many layers; perhaps some multi-layer start move should then be thought of as well.. anyway

 

 

*Not sure I like the name "Z-seam" because it has nothing to do with the Z-axis. Rather, it is the layer its skin/perimeter/wall seam.

 

 

 

 

 

starts_benchy.JPG

starts_benchy2.JPG

  • Like 1
Link to post
Share on other sites

Posted · Skin Starts (Z-Seam) SimulationView Mod

Okay, managed to fix the line width / layer height thing, as you can see in this Benchy's smoke stack the rectangles are now sized accordingly, as well as now drawn in the center of the layer.

smokestack.JPG

  • Link to post
    Share on other sites

    • 2 weeks later...
    Posted (edited) · Skin Starts (Z-Seam) SimulationView Mod

    Opening cura generated gcode now also shows the skin starts

    https://github.com/BasF0/Cura/commit/fa8b56d6adbaa06ef1f062563f7aa3faddf95919

     

    note 2 issues: (I'm on cura 4.7.0)

    1. When opening gcode it seems that the layer-widths of the bottom layer are incorrect ? Well, the print lines are drawn correctly, but the starts rectangles are really small, so perhaps its me.

    2. The height of the top layer is drawn wrong, see attached photo.

     

    However, the lack of tools in a gcode preview prevent me from opening a python console and doing further debugging, therefore I am also hesitant to open an issue on Cura's github.

    topissue.jpg

    Edited by BasF0
  • Link to post
    Share on other sites

    • 3 weeks later...
    Posted (edited) · Skin Starts (Z-Seam) SimulationView Mod

    After some digging, it looks like unretract operations are added into the layer_data object as lines when opening gcode. The line has type '1' (Inset0Type) and is therefore recognized as the layer start. However, the line-width is set to 0.1, leading to the small start box.

     

    So the first G1 command below is the source of this.

     

    ;LAYER:49
    ;TYPE:WALL-OUTER
    ;MESH:20mm-box.stl
    G1 F1500 E1187.63346
    G1 F2400 X119.8 Y100.2 E1188.28536
    G1 X119.8 Y119.8 E1188.93726
    G1 X100.2 Y119.8 E1189.58916
    G1 X100.2 Y100.2 E1190.24106
    G0 F7200 X100.6 Y100.6
    ;TYPE:WALL-INNER
    ...

     

    Not sure how to handle that, if at all. Maybe its something unintended in the gcode parser ? Image is for context.

     

    20mmbox.JPG

    Edited by BasF0
  • Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    • Our picks

      • UltiMaker Cura 5.9 stable released!
        Here comes Cura 5.9 and in this stable release we have lots of material and printer profiles for UltiMaker printers, including the newly released Sketch Sprint. Additionally, scarf seams have been introduced alongside even more print settings and improvements.  Check out the rest of this article to find out the details on all of that and more
          • Like
        • 5 replies
      • Introducing the UltiMaker Factor 4
        We are happy to announce the next evolution in the UltiMaker 3D printer lineup: the UltiMaker Factor 4 industrial-grade 3D printer, designed to take manufacturing to new levels of efficiency and reliability. Factor 4 is an end-to-end 3D printing solution for light industrial applications
          • Heart
          • Thanks
          • Like
        • 4 replies
    ×
    ×
    • Create New...