Iterating On Fractals

In my recent post about print nozzle sizes I showed a print of a super-fine fractal pyramid.

Nozzle Size

Tiny Fractal Pyramid

And this seemed a fun area to explore. First task: generate the model myself, instead of using one made by someone else!

Recursion

I studied computer science—generating fractals should be easy! First we need a base case:

Triangles build(int recursions) {
  if (recursions == 0) {
    return Triangles()..cube(Vertex(-0.5, -0.5, -0.5), Vertex(0.5, 0.5, 0.5));
  }

Then the recursion: build an “n - 1” model, copy and move it as needed, return:

  final submodel = build(recursions - 1);
  final result = Triangles();
  result.addAll(submodel.scale(0.5).translate(Vertex(0, 0, 0.25)));
  result.addAll(submodel.scale(0.5).translate(Vertex(-0.25, -0.25, -0.25)));
  result.addAll(submodel.scale(0.5).translate(Vertex(-0.25, 0.25, -0.25)));
  result.addAll(submodel.scale(0.5).translate(Vertex(0.25, -0.25, -0.25)));
  result.addAll(submodel.scale(0.5).translate(Vertex(0.25, 0.25, -0.25)));

  return result;

Easy!

This works, sort of:

Cube Fractal

But the base shape being a cube does not work particularly well for printing.

So the next refinement I tried was to use a pyramid as the base shape:

Pyramid Fractal

—which is much closer, in appearance at least, to what I’m aiming for.

But, there’s a problem. When you “slice” this model—convert it to instructions for the printer—the slicer program doesn’t know that touching pyramids need to be physically joined. So, it separates them instead:

Sliced Pyramid Fractal

—and that just won’t print.

To make a printable model I tried various fudges, including generating pyramids that would overlap slightly and adding flat tops and bases to the pyramids. Nothing seemed to work.

Then I hit on a slicer option called “vase mode”. This forces each layer to be a single continuous connected thread. As the name suggests it can print vases: the outer edge of the vase is a continuous thread, and it ignores everything else. In the case of my fractals, however, the “edge” would be a very complicated—but connected—fractal shape. Great!

Via this method I was able to print my first homemade fractal pyramid:

First Fractal Pyramid

And then my first variation on the theme, with a partial inverted pyramid on top:

First Fractal Variation

But then I hit a different problem. Past a certain level of complexity, the Prusa slicer program seemed to simply give up on vase mode, and output junk:

Junk Slice

I found this to be a shame, since mathematically the vase mode idea—that each layer should be a single continuous line—was pleasing. So I researched a little, and found a post by someone else complaining about the Prusa vase mode giving up on complex models. They pointed out that there is another slicer, Simplify3D, that does a better job. Just one drawback: it costs two hundred dollars.

Fortunately! They have a “try and if not satisfied, your money back” policy—so I gave it a try.

And indeed, Simplify3D could handle the more complex models in its “vase model”.

Unfortunately, I hit a third problem, this time with the nozzle clogging causing prints to be aborted:

Broken Prints

I should be 100% clear that this isn’t a limitation of Simplify3D as such.

What had happened is this: the slicer program encodes, in addition to the physical rendering of the model, a lot of detailed settings such as nozzle temperature and many different aspects of print head speed and movement. To get a correct print, you need good settings. But I’m using a nonstandard nozzle size, so my settings are nonstandard; and I didn’t find the right settings for Simplify3D for my printer and setup. This led to the printer being given slightly incorrect instructions—and the filament jamming.

It would undoubtedly be possible to get correct prints out of my setup with Simplify3D; to go down that path I would start by comparing what it is that changes in the official Prusa settings between the standard nozzle size and the one in my setup, and making similar changes in Simplify3D’s settings. Or I could simplify ask their tech support!

But, I didn’t much like the idea of being away from the bulk of the Prusa user base and having to come up with such tweaks via trial and error, so I resolved to try something else: could I improve the model generation to produce something that working with the default (Prusa) slicer program?

Model Reboot

I resolved to make a model that would print as I wanted but without “vase model”: this would mean generating a 3D model that more closely resembles exactly what I want to print, with everything built up of horizontal line segments, and those segments joined where the printer needs to join them for the model to work.

So I added to my model a first stage in which the model is built as lines. Then, any lines that touch are joined, then they are converted to 3D by “painting” them with a cube “brush”.

This worked well, allowing me to design and print some satisfyingly complex shapes:

Satisfyingly Complex Fractal

And to finish up—for now at least—I experimented with whole-model transformations that added twist and other distortions:

Final Fractal

Final Fractal

Final Fractal

Wrapup

This was fun—the mathematical side, the design aspects and an unexpected benefit: the small nozzle prints, while slow, are relatively quiet.

I’m happy that I improved my model generation; I did get a refund for Simplify3D. I might try it again sometime if I hit some limitation of the Prusa slicer that I can’t work around.

I still plan to continue experimenting with the smaller nozzle: I’m curious as to whether I can produce any more interesting/intricate “desk toys” thanks to the higher resolution.

Feedback 📮

👍 Thanks!

👎 Not for me.

🤷 No opinion.

Comments.

So far today, 2024-11-25, feedback has been received 2 times. Of these, 0 were likely from bots, and 2 might have been from real people. Thank you, maybe-real people!

   ———
 /     \   i a
| C   a \ D   n |
   irc   \     /
           ———