3D Printed Glasses

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.

41 comments
  1. Cool project,I also want to copy my eyeglass frames.
    This is a great guideline.

    • Jenny said:

      Good luck! You’ll might need to adjust the parameters to fit your glasses.

  2. Rich said:

    Very cool project. Have you spoken with the team at Protos Eyewear? They would love to talk with you as they make consumer grade custom fitting glasses via different customizable software.

    • Jenny said:

      I appreciate the interest, but I’m currently working for another eyewear company, so that would definitely be covered in my non-compete! =)

  3. Hi Jenny, I tried to run the script and i received a syntax error in line 35: ” path.extrude = extrude_amount_in_mm”

    can you give me a little help with this please?

    • Jenny said:

      Hey César, can you give me a bit more information (like link me to your SVG)? I just cloned the repo and tried the script, and it ran ok. Did you select your imported SVG? The script expects you to select your SVG.

  4. Nico said:

    Hi Jenny,

    I’m from a German company for 3D-printed eyewear. I discovered your project a few days ago and I love it!
    Would like to get in touch with you and discuss your project, but I can’t find any e-mail-address. Maybe I’m just blind and need glasses myself 😉

    Could you provide an e-mail address so I can contact you?

    Keep up the great work, best regards from Berlin!

    • Jenny said:

      I guess I don’t have my email posted. Whoops. I’ll work on that. The source code is on GitHub if you want to take a look / contribute to. Meanwhile, feel free to leave a comment here if you have any questions. One note, I work for an eyewear company and have an non-compete agreement. Best, NYC!

  5. Nico said:

    Hi Jenny, thanks for your quick reply.
    I’ll definitely take a look at it (I already did), that’s the reason why I contacted you.
    It’s a pity (for us) that you have such an agreement as we would’ve loved to make you an offer for working with us 😉

    I wish you all the best and I’ll follow your work.

  6. Justas said:

    Hi,
    Been trying to run your script on Blender 2,74 (newest version), used your recommended SVG but doesnt receive any results. Just error code about Invalid Syntax in line 4. Tried to delete empty lines, but no effect. Since I a newbie at Blender, maybe there are other things to do in order to rjn tjis script?
    Thanks a million 🙂

    • Jenny said:

      Hi. Do you have a .blend file you could send me? Line 4 is a comment, so I’m not sure why it’s having syntax issues. It works fine on my machine.

      • Justas said:

        Hi. yeah, i have blender file, but apparently Im unable to find your email to send to or to find an attach function in wordpress 🙂
        If that helps – you can ping me in facebook ( justeelis ) or email ( sidlauskas dot justas eta gmail.com) I can send you blender file.
        Also – if line 4 is a comment, maybe it can just be deleted?
        Another question – on what 3d printer and in what plastic you printed your white glasses?
        Thanks! 🙂

      • Jenny said:

        The code is in Python, and comments shouldn’t be evaluated. If the Blender interpreter is complaining about syntax errors, then I think something else is wrong with your setup.

      • Jenny said:

        Hi Justas, in your .blend file, it looks like you copied the entire HTML of the GitHub page, and not the Python script itself. You need this file: https://github.com/caretdashcaret/pince-nez/blob/master/script/run.py, not the html page of it. That’s why Blender was complaining about syntax. It’s expecting Python, and it’s being given html.

      • Justas said:

        Hi Jenny,
        Thanks a lot for your patience and help. Yes, it actually works really nice. Amazing 🙂
        Will try to make lens insertion spaces as in your instructions.

        Again – thanks a million 🙂

    • Jenny said:

      That’s amazing! Thanks for sharing this! I’m so glad it was useful to you!

  7. Adriel said:

    So, Jenny, are you saying you can draw any shape and load it? If so, how?
    So what are y’all doing for ear pieces?
    Really having trouble finding a pair of glasses that fits and the right shape, so really exited if there is a solution.
    Thank you so very much in advance!

    • Jenny said:

      You can load it like you load any SVG file into Blender. You can also model your own ear pieces using Blender, or any other CAD software.

  8. derek said:

    Hi Jenny,

    I ran your script, but it stuck at line 115. any help?

    • Jenny said:

      Are there any error messages?

      • derek said:

        Python script fail, look in the console for now..

        In the console:

        PYTHON INTERACTIVE CONSOLE 3.5.1 (default, Feb 17 2016, 17:09:19) [MSC v.1800 64 bit (AMD64)]

        Command History: Up/Down Arrow
        Cursor: Left/Right Home/End
        Remove: Backspace/Delete
        Execute: Enter
        Autocomplete: Ctrl-Space
        Zoom: Ctrl +/-, Ctrl-Wheel
        Builtin Modules: bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bpy.utils, bgl, blf, mathutils
        Convenience Imports: from mathutils import *; from math import *
        Convenience Variables: C = bpy.context, D = bpy.data

      • Jenny said:

        The Interactive Console won’t actually log the errors. You need the Console Window. If your script is failing around 114, it’s probably because you need to select the SVG object first. On the default view, go to the Outliner in the upper right, and select the SVG object, (by default it should be named “Curve”).

  9. derek said:

    Ok, got that part working, now this error

    bpy.ops.text.run_script()
    bpy.ops.object.origin_set(type=’GEOMETRY_ORIGIN’)
    bpy.ops.transform.resize(value=(1, 1, 1), constraint_axis=(False, False, False), constraint_orientation=’GLOBAL’, mirror=False, proportional=’DISABLED’, proportional_edit_falloff=’SMOOTH’, proportional_size=1)
    bpy.ops.text.run_script()

  10. derek said:

    convertViewVec: called in an invalid context
    convertViewVec: called in an invalid context
    convertViewVec: called in an invalid context
    convertViewVec: called in an invalid context
    convertViewVec: called in an invalid context
    convertViewVec: called in an invalid context
    convertViewVec: called in an invalid context
    convertViewVec: called in an invalid context
    convertViewVec: called in an invalid context
    convertViewVec: called in an invalid context
    Traceback (most recent call last):
    File “\run.py”, line 703, in
    File “\run.py”, line 691, in create_eyeglasses_from_svg
    File “\run.py”, line 105, in create_mesh_from_svg
    File “\run.py”, line 35, in extrude_curve
    AttributeError: ‘Mesh’ object has no attribute ‘extrude’
    Error: Python script fail, look in the console for now…

    Traceback (most recent call last):
    File “\run.py”, line 703, in
    File “\run.py”, line 691, in create_eyeglasses_from_svg
    File “\run.py”, line 105, in create_mesh_from_svg
    File “\run.py”, line 35, in extrude_curve
    AttributeError: ‘Mesh’ object has no attribute ‘extrude’
    Error: Python script fail, look in the console for now…

    • Jenny said:

      You probably ran the script, it failed, and you tried running the script on the same SVG model again. You need to delete the model and re-import it, if you want to re-run the script. The script doesn’t roll back changes when it fails, so the state of the model has already changed (I think it’s already converted to a Mesh object).

      • derek said:

        Thank you very much!

  11. Siddharth Wadehra said:

    Hi Jenny,

    Could you please be of help to me? I am from a Non-technical background and trying to implement this for fun.
    However, even after importing the sample image and running the script; I am getting the following error:

    ‘Python script failed. Look in console now..’
    path.extrude = extrude_amount_in_mm

    I tried going through the other comments in the blog; however unable to proceed forward. Not sure how could I proceed further.

    Would appreciate your help, Jenny!

    Best Wishes,
    Sid.

    • Jenny said:

      I just ran everything on Blender 2.78 and it worked fine. Is there another error message that you’re getting? The error message you posted just says where in the script failed, but not what happened.

  12. Alex said:

    Hello! This was amazing and very fun to read, I have a question tho. I have a pair of glasses that are broken, and I can use the lenses to try and do this project, but I’m not really sure on how to make my crystals (the lenses) fit into the models that I will load on blender and then print. Should I measure them with a caliper?

    I’m not really sure on how should I start.

    Thanks!

  13. Andrew M Smith said:

    Hi Jenny! I am also interested in making my own eyeglasses. I am struggling to find the technical specifications for prescription lens mounting. Did you happen to come across them when you were developing this project? Would much appreciate it if you could point me in the right direction!

  14. Rahmi Karajeh said:

    Thank you for your great tutorial.

    I attempted to run the script and received an error on line 689: selected_object = bpy.context.scene.objects.active

    I attempted to download the exact svg file you had originally used but it seems to no longer be available online.

    Any help would be greatly appreciated.

    • Bill Bailey said:

      Hi, I have the exact same problem. Did you ever find a solution?

  15. Rahmi Karajeh said:

    I figured it out. I was attempting to run this on the newest version of blender and it didn’t work.

    I downloaded blender v2.78 and it worked fine 🙂

  16. Tyson L Lundy said:

    Hi Jenny, I’m getting Python script failed, check the message in the system console.
    line 689 (select object = bpy.context.scene.objects.active). What am I missing??? Please Help!! Trying to make frames for my son…Thank you in advance.

  17. Tyson L Lundy said:

    Read prefs: C:\Users\OWNER\AppData\Roaming\Blender Foundation\Blender\2.90\config\userpref.blend
    found bundled python: C:\Program Files\Blender Foundation\Blender 2.90\2.90\python
    Info: Deleted 1 object(s)

    Traceback (most recent call last):
    File “\run.py”, line 703, in
    File “\run.py”, line 689, in create_eyeglasses_from_svg
    AttributeError: ‘bpy_prop_collection’ object has no attribute ‘active’
    Error: Python script failed, check the message in the system console

    That’s what I’m getting…

Leave a comment