Jump to content

Skin Starts (Z-Seam) SimulationView Mod


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




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.








  • 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.


  • 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



    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.


    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.


    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


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



    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

      • S-Line Firmware 8.3.0 was released Nov. 20th on the "Latest" firmware branch.
        (Sorry, was out of office when this released)

        This update is for...
        All UltiMaker S series  
        New features
        Temperature status. During print preparation, the temperatures of the print cores and build plate will be shown on the display. This gives a better indication of the progress and remaining wait time. Save log files in paused state. It is now possible to save the printer's log files to USB if the currently active print job is paused. Previously, the Dump logs to USB option was only enabled if the printer was in idle state. Confirm print removal via Digital Factory. If the printer is connected to the Digital Factory, it is now possible to confirm the removal of a previous print job via the Digital Factory interface. This is useful in situations where the build plate is clear, but the operator forgot to select Confirm removal on the printer’s display. Visit this page for more information about this feature.
          • Like
        • 0 replies
      • Ultimaker Cura 5.6 stable released
        Cura now supports Method series printers!
        A year after the merger of Ultimaker and MakerBotQQ, we have unlocked the ability for users of our Method series printers to slice files using UltiMaker Cura. As of this release, users can find profiles for our Method and Method XL printers, as well as material profiles for ABS-R, ABS-CF, and RapidRinse. Meaning it’s now possible to use either Cura or the existing cloud-slicing software CloudPrint when printing with these printers or materials
        • 48 replies
    • Create New...