Archive

Tag Archives: 3D printing

It’s been a while since I started my project to 3D print glasses frames, and I’m really excited to share the results.

3D printed glasses frame

Here is my 3D printed glasses holding real prescription lenses!

In the first iteration of this project, I took an image and created a 3D printable glasses frame, using code and Blender.

A single click is all it took to procedurally generate the 3D model.

SVG to glasses

Since that first iteration, I learned a lot more about the actual design of glasses frames and improved my algorithms.

I decided to test my algorithm by copying a pair of frames I already own.

Using an image of the front view of my glasses frame, my Blender script created this 3D model:

generated glasses

I manually added lens grooves to fit my prescription lenses.

grooves

I popped the prescription lenses out of my frame and popped them into my 3D printed frame.

popped out lenses

They fit astonishingly well.

3D printed glasses frame

To make your own, check out the previous post for instructions.

To create lens grooves for your 3D model:

  1. In Edit mode, use the Knife tool on a nosepad to create a boundary between the nosepad and the frame

knife

  1. Use the Loop Cut and Slice tool to create three edge loops. They will be boundaries of the lens grooves.

Here’s the first loop:

Loop Cut and Slice

The next two loops will be on both sides of the middle loop.

  1. Select the middle edge loop and and scale up in the XZ direction. This will create the groove itself.

  2. Do this for both sides.

After creating the lens grooves, your glasses frame is ready for 3D printing.

3D printed glasses

Here’s a video of adding the lenses to the 3D printed glasses:

Since the lenses fit the 3D printed frame pretty well, I can say the algorithm/script creates an accurate enough glasses model for the frame portion. However, there’s more work to be done to make better bridges and nosepads, since the nosepads aren’t quite large enough. For now, the script creates nice prototypes.

Today I saw a post about Emendo, a program for mesh repair, and became a little miffed. It costs roughly $50, which I think is pretty steep for something you could do in a few lines of code in Python with the Blender API. Even if you’re not a programmer, there are $0 solutions like netfabb Basic and free software like MeshLab and Blender. I can’t attest to the quality of Emendo, but it has to be amazing to be worth that price.

So, let’s talk mesh repair: what is it, why it’s hard, and why I would or wouldn’t spend $50 on it.

Mesh repair is essentially fixing up a 3D model so it can satisfy 3D printing constraints. I became interested in mesh repair when I was modeling a small figurine. When designing, I cared more about aesthetics of the model than the printability of the model. I figured there would be tools to magically and automatically correct my model to be printable.

There is such a tool. It’s called netfabb.

Netfabb is a software that’s pretty good at fixing all sorts of problems. It’s also popular among 3D printing enthusiasts and is leveraged by businesses and 3D printer manufacturers (like Shapeways, Formlabs, and Figulo).

Unfortunately, my model turned out to be disastrously hard to repair. Netfabb failed, and I ended up concocting a solution out of both netfabb Basic and MeshLab after days of struggle.

Rakdos figurine

Turning a model of any shape into a printable model is a hard problem. For example, suppose you have holes in your model that makes it unprintable. The mesh repair software will try to patch those holes. These holes are big gaps of missing information and the software has to guess what should go in them based on the topology of each hole’s surroundings. While some solutions can be easily guessed, other guesses can create more problems and can even conflict with one another. Here are wonderful visualizations of capping a hole in three different and valid ways, illustrating the underconstrained nature of the hole problem. Holes are just one of the many problems a 3D model could have.

There are many algorithms for mesh repair, but none of them are perfect. Here is an excellent introduction to various algorithms and the tradeoffs between them. Here is a more recent and more in-depth look at different algorithms and their features.

I use my figurine model to test the “robustness” of different mesh repair software. It may not be a fair test, since my model may be a very hard edge case, but I’m testing mostly to satisfy my curiosity. Here are some results:

netfabb Basic 4.9: failed

Netfabb flags something as unprintable with a big red caution sign. Even after repairs, the caution sign remained. Netfabb Cloud also failed. I believe the most recent version of netfabb Basic will successfully repair the model. Since netfabb is such a staple tool, I determine the success or failure of other mesh repair programs by importing the fixed models into netfabb and recording whether netfabb determines if they are printable or not.

Autodesk Meshmixer version 10.3.44: failed

Autodesk 3D Print Utility 1.1.1: succeeded

The 3D print utility actually succeeded in the mesh repair. However, it took about 3 hours for the repair to complete on my laptop, and the resulting mesh had a tremendous loss of resolution.

Photoshop CC: failed

I don’t know what version of Photoshop CC I used, but it was a 30-day trial from this past January. The repaired model still had issues, but could subsequently be repaired by netfabb. Photoshop actually emailed me asking for the figurine model, so I suspect they might’ve upgraded their algorithm.

GitHub: failed

 

Custom Blender Script: succeeded

Over the summer, when I was working on 3D printing glasses from 2D designs, I realized I need to repair the glasses models. I started to write a mesh repair script and decided to design it to repair the figurine. My script does indeed fix the model, but it takes about five minutes to run on the figurine model. The script produces better resolution in less time than Autodesk’s 3D Print Utility, but it’s not the fastest since I’m looping multiple times. I’ve decided to release it as a Blender Add-On, in the 3D Print Toolbox, available now in Blender 2.72b. Hope it’s helpful!

3D Print Add-On

The script’s algorithm works better on simple models or models with dense polygons. If patching holes result in non-manifold geometry, the script will try to delete vertices around the holes and then patch them again. If the polygons are dense, removing a few shouldn’t affect the overall aesthetics.

It probably won’t work for all models, though.

$50 for a mesh repair software that repairs all models is absolutely worth it, for all the time invested spent in manual repairs. However, given the diversity of models and the diversity of problems (some of which could be caused by printer-dependent constraints), I doubt there’s such a silver bullet right now.

Between the Blender Add-On and netfabb, you have a pretty good chance that your model will get repaired. However, should you need to, I advocate using Blender’s Python API to build your own repair tool. It will allow you to create something catered to your specific modeling needs. It might not be as fast as pressing a button, but you’ll have unparalleled customization ability. I hear the paid upgraded versions of netfabb give you a lot of customization choices in mesh repair, but I doubt it would be as thorough as interacting with the models directly. The Blender API already provides some nice helper functions like bpy.ops.mesh.fill to fill in faces and bpy.ops.mesh.select_non_manifold to select non-manifold vertices. You could even update the Add-On and release it back to the Blender community.

This is the update of my project to create stereographic lampshade using the Blender API.

projection!

Above is the 3D printed lampshade projecting the snowflake pattern I made.

It measures approximately 4 inches across and 1.7 inches high.

I’ve updated my code to reflect what I’ve learned from this project.

Previously, I generated dome-like lampshades, based on the original formula for height:

z_{new} = a \cos \alpha

where:

  • z_{new} is the height of the vertex on the lampshade, computed from the point on the pattern,
  • a is the radius of the spherical lampshade, and
  • \alpha is twice the angle from the light source (top of the sphere).

dome

However, to more accurately reflect the interplay of the lampshade and the light source, I’ve changed the formula for height:

z_{new} = h - a \cos \alpha

where h is the distance from the plane of the projection of the pattern to the center of the spherical lampshade.

This new formula produces bowl-like lampshades. This makes sense, since the lampshade sits between the projection of the pattern and the light source, curving towards the light.

bowl

distance to center of lampshade = 5; radius of lampshade = 5

Decreasing the distance between the center of the sphere and the plane of projection results in a more spherical lampshade. This distance could even be negative.

fish bowl

distance to center of lampshade = 0; radius of lampshade = 5;

Conversely, the greater the distance to the center of the lampshade, the flatter the lampshade will be.

almost flat

distance to center of lampshade = 10; radius of lampshade = 5

The physical light source can also distort the pattern. Ideally you’d want a single point source. More diffuse light sources result in fuzzier projections.

light source

Finally, you can adjust the lampshade for different magnifications and resolutions.

It’s all pretty fun.

Make your own with my code on Github!

Explanation of the code here.

 

Recently I read an inspirational post on how to create stereographic lampshades. I noticed the author created the model in MATLAB and then rendered the lampshades in Blender. I feel like Blender on its own provides all the features necessary to create stereographic lampshades, so I set out to write a script to do just that.

rendered lampshade

My script is [here] on Github.

Check it out!

I created a SVG pattern modified from a public domain snowflake on Pixabay.

snow pattern

Let it snow!

Then I imported the SVG into Blender and ran my script. My script converted the SVG into a mesh and transformed each vertex according to the post’s instructions.

I admit I cheated a little. In the original post, the input to the lampshade creation was a raster image. I instead jumped straight into vector images with SVGs. Since Blender can manipulate SVGs easily and there’re good tools on converting raster images to SVGs, I felt no need to reinvent the wheel.

There are two things that were non-obvious to me initially for computing the new vertices’ coordinates. First, all angles were supposed to be in radians. Luckily the default math functions like sin() and cos()  operate in radians, so that wasn’t a big trip-up. Second was that the default arctangent function atan() only returned a compressed range which resulted in a super collapsed/deformed hemispherical blob. I needed to use atan2() to get the full range. A fuller explanation can be found on Wikipedia.

After transforming each vertex the resulting mesh is a non-manifold surface. It’s basically a sheet with infinite thinness, which isn’t 3D printable.

My first instinct was to use Blender’s solidify modifier to turn the surface into a solid, but it didn’t behave like I expected. I ended up choosing extrude and scaling the extruded faces. Since I scaled proportionally to the thickness of the extrusion, I hope that the image projected by my lampshade won’t be distorted.

Since I don’t own a 3D printer, I sent my model to a service for printing. I’ll update with my results (hopefully it comes before holiday time!)

To print your own, you need an SVG (you can convert raster images to SVGs using Inkscape). I’ve provided the snowflake pattern as well as the final STL I used in the Github repository.

imported SVG

After you import the SVG into Blender, open up my script in the the Blender Text Editor.

hit Run Script!

Select the SVG and hit Run Script.

final object

You might need to rescale to the desired print size.

Have fun! Feedback welcome!

Click for Update

Success!

It’s been a while since I’ve been this excited about 3D printing news!

Formlabs just posted a blog post yesterday about how they 3D printed a lens for a monocle.

Formlabs Monocle

Monocle frame and lens printed on Form 1+ 3D Printer. Photo by Formlabs.

I’m really curious about its optical resolution. We might be really close to being able to print lenses for glasses!

Time to get back on my 3D Print Your Own Glasses project.

So Shapeways recently introduced Full Colored Plastic as a new printable material. I was super excited to try it out.

Compared to Full Color Sandstone, Full Color Plastic is stronger. The colors don’t fade with exposure to water.

We have tested this by submerging the FCP models in water for 2 months and the colors stayed the same. No color bleeding. ~Shapeways Customer Support

However, it also cost about twice as much per cubic cm, which comes out to a lot.

I printed a smaller version of my ArcheAge figurine. Here’s the result!full color plastic

Overall I’m a little disappointed. The resolution wasn’t super great and a lot of the colors didn’t come out.

You can really see the stripes and spots on the arms and legs. There was also a white graininess to the whole figurine.

full color plastic

Full Color Plastic

Full Color Sandstone

Full Color Sandstone

To be fair, my Full Color Sandstone version is about 4 times bigger than Full Color Plastic version. My hunch is that even if I scale the plastic version up, the white graininess won’t go away, and the colors will still be a lot lighter.

Due to the price, the sandstone version still cost less than the plastic version, despite the size increase.

Summary:

Pros:

  • Can print smaller / thinner models than Full Color Sandstone
  • Colors won’t fade with exposure to water
  • Stronger; thin parts are flexible

Cons:

  • More expensive than Full Color Sandstone
  • Have a white grainiess
  • Colors are a lot lighter / less saturated
  • May not have as great resolution

For future prints, I’d probably limit gradients and shading, and stick to sharp contrasting colors.