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.
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.
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:
I manually added lens grooves to fit my prescription lenses.
I popped the prescription lenses out of my frame and popped them into my 3D printed frame.
They fit astonishingly well.
To make your own, check out the previous post for instructions.
To create lens grooves for your 3D model:
- In Edit mode, use the Knife tool on a nosepad to create a boundary between the nosepad and the frame
- 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:
The next two loops will be on both sides of the middle loop.
- Select the middle edge loop and and scale up in the XZ direction. This will create the groove itself.
- Do this for both sides.
After creating the lens grooves, your glasses frame is ready for 3D printing.
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.
Pingback: 3D Print Your Own Glasses With This Handy Blender Algorithm | FILACART BLOG | 3D Printing MegaStore
Pingback: 3D-print nu je eigen brilmontuur
Cool project,I also want to copy my eyeglass frames.
This is a great guideline.
Good luck! You’ll might need to adjust the parameters to fit your glasses.
Pingback: 3D print your own glasses with this handy Blender algorithm
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.
I appreciate the interest, but I’m currently working for another eyewear company, so that would definitely be covered in my non-compete! =)
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?
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.
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!
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!
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.
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 🙂
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.
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! 🙂
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.
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.
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 🙂
Thanks a lot !!
I broke my glasses with your script and replaced them with a new one. I use them every day.
Here some photos: https://www.facebook.com/madeinleghorn
That’s amazing! Thanks for sharing this! I’m so glad it was useful to you!
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!
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.
Hi Jenny,
I ran your script, but it stuck at line 115. any help?
Are there any error messages?
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
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”).
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()
That’s not an actual error message. Can you tell me what the Console Window says? https://www.blender.org/manual/advanced/command_line/introduction.html
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…
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).
Thank you very much!
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.
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.
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!
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!
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.
Hi, I have the exact same problem. Did you ever find a solution?
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 🙂
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.
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…
Thanks for posting a detailed error message.
I haven’t tried script since Blender 2.78. Blender has changed a lot since then. It looks like as of Blender 2.8, some of the API has changed (see https://blender.stackexchange.com/questions/162256/bpy-prop-collection-object-has-no-attribute-link or https://wiki.blender.org/wiki/Reference/Release_Notes/2.80/Python_API/Scene_and_Object_API).
You’ll need to update the script with the newest API