DIY 3D Slicer Is A Dynamo

We all know that hacker that won’t use a regular compiler. If he’s not using assembly language, he uses a compiler he wrote. If you don’t know him, maybe it is you! If you really don’t know one, then meet these two. [Nathan Fuller] and [Andy Baldwin] want to encourage you to write your own 3D slicer.

Their post is very detailed and uses Autodesk Dynamo as a graphical programming language. However, the details aren’t really specific to Dynamo. It is like a compiler. You sort of know what it must be doing, but until you’ve seen one taken apart, there are a lot of subtleties you probably wouldn’t think of right away if you were building one from scratch.

Slicers have to determine what each slice of the 3D model looks like and create Gcode to represent those layers. The Gcode then drives the printer. Why build your own slicer? Well, we never really need a reason before we do things like this around here. But if you insist, think about how your own slicer could allow you to experiment with different types of support structure generation, infill patterning, and other details.

Granted, a lot of slicers are open source, so you could start there, too. However, those are usually mature products full of features and it can be difficult to figure out how to insert your own code into them (with the possible exception of writing a Cura plug in).

We’ve covered slicing tricks like variable height layers, before. We’ve also talked about using scripting languages to munge the Gcode output from a slicer. We even have our own tool for merging Gcode with different options (like layer height). What tricks do you like to use when it comes to slicing?

Thanks to [smerrett79] for pointing this one out.

15 thoughts on “DIY 3D Slicer Is A Dynamo

  1. Ive been meaning to get into the slicing algorithms for a while but been put off because of the complexity and finding where to start. This looks ideal for me to finally sit down and get started.

  2. Source is in plain site but as the author of the instructable above said. not easy to find where to start without some guidance.
    Starting with the article hes written you will get a good idea of how its supposed to work and then be able to wade into the cura engine with all of the extra patches, workarounds and exceptions that are in the mature full featured slicer.
    Only problem, I hate those graphic programming ide’s so may resort to python or similar anyway.

    1. You could go back to the first months of the CuraEngine code. It’s functional and should be easy to follow. Those core concepts still remain today, but greatly expanded.

      It all started out as a quick experiment to see if I could make something that resembled a slicing engine instead of using Skeinforge. I had my first print after 2 days of work, thanks to libclipper. But that didn’t have infill or tops/bottoms.
      Support material was pretty much the last major feature that was initially added. So if you look at the code before support material was added, you have a pretty solid simple base that should work reasonably.

      I used the “Ultimaker robot with support” as test model for a lot of initial tests. This model was key, because it covers a lot of edge cases where the initial slicing step can fail. (It’s extremely high poly, and has holes and self intersections where the support was hacked in) It was a key difference from Slic3r at that time, which flat out refused to slice any model that wasn’t perfectly manifold.

      After you have your model cut in layers with outlines, it is pretty much smooth sailing from there on. Perimeters? Just offset the outlines. Top and bottom? Substract one layers outline from the other, what’s left needs to be filled. Infill? The inverse of that.
      Going from lines to gcode should be trivial if you are a bit software minded.

      Combing, retraction, multiple extruders, support material are all features that come after that. And that’s when your code starts to become complex and harder to follow.

  3. I’d be really careful about the Autodesk Cloud shit. Once one gets addicted, they can do whatever they want in terms of pricing or rules. Live in the wrong country? Hit by sanctions? Gone is your work. Or how about charging 200 bucks a month? Only way out is to virtually lose all previous work. Mark my words.

    1. That’s already happened I think. The 123D series is mostly gone. Some aspects have been replaced, but I know of teachers who have built curriculum that depends on those tools and now are scrambling to retool.

      The unfortunate truth is that if you don’t purchase a product or download a FOSS product (either of which must run without calling home or needing reauthorization), you’re constantly at the mercy and whim of whoever runs the show.

      1. Same is true for the Cubify software package. Luckily this was downloadeable. But now 3DS stopped their support for it (maybe even sold it) and it’s just gone. If it weren’t on my harddisk, all my stuff would be gone.
        And I’m just waiting for the moment when all the Fusion360 users discover that they have been screwed over and are charged premium prices. It’s not gonna take for too long, I think. Unfortunately, I’m one of them.

    2. You can export anything you make. This isn’t an issue. It is free because they want you to buy the adult version when you finally have something worth selling. Sound plan to me.

      Also, don’t base your career around free shit. Who would do that?

  4. Way cool! I’m interested in this topic, as well as the subtractive version of this problem for CNC path planning (CAM). The visual tool might slow things down (for the 50% of us who are text-oriented), but it obviously does help with visualization of process flow. Nice article.

  5. The power of Dynamo is best used in addition to your regular development environment, It’s better at math than you so can generate a huge variety of parameters for extremely rapid iteration beyond our practice. Hopefully informing the design and improving outcome for all humanity.
    The key is to have the data free to move in any direction and in a standard format.
    Dynamo – Revit – Excel used together for really powerful and portable BIM.

  6. Sheesh… “We all know that hacker that won’t use a regular compiler. If he’s not using assembly language, he uses a compiler he wrote. If you don’t know him, maybe it is you! If you really don’t know one, then meet these two. [Nathan Fuller] and [Andy Baldwin] want to encourage you to write your own 3D slicer.”

    I think HaD needs a Grammar Slicer Algorithm to check posts before publishing.

    1. Nah, then what would you do with your day other than protect the Internet from the ungrammatical? Besides, I’m not sure that’s really a disagreement (or is that what you are alluding to?). If you don’t know one then here’s two really isn’t a number disagreement, because you can not know one and then meet two, right? (As opposed to, say, if you want one you can buy a dozen at….).

      On a side tangent… I had a horribly tough drafting instructor in high school. If he could detect an erase mark it was a letter grade off for each mark. And he made us use these green plates that pretty much had a chemical reaction with an eraser, so I did very poorly in that class. I was terrified to take drafting in college after that. But that instructor was an engineer, not a frustrated high school administrator that had to teach one class that he barely knew about. So his metric was “can I build what you drew without more information?” If you could, he might knock a point off or two for something, but you’d pass. Where he would mark off heavy is if you couldn’t build from the drawing. So an extra dimension was a point or two off. A missing one was probably a fail or at least a letter grade. A. W. Stewart. Fine professor.

      Over the years with a dozen magazines and a couple of dozen books under my belt, I’ve kind of adopted that same approach. The more you write and on a tighter schedule, the more things will creep in. Heck, even my “big books” from big publishers where 5 or 10 people have been involved in proofing and editing will have typos all over. Just the process of editing will create some problems even as it fixes it. The real crux is, did you know what I meant? And did that part of it even really matter?

      Then again, if you are a frustrated high school administrator, it is a letter grade off.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.