Show HN: OpenSCAD configurable calendar 3D model
7 days ago (chrastecky.dev)
I created a highly configurable calendar 3D model using OpenSCAD. This project uses Zeller’s Congruence to automatically adjust the calendar layout for any year. Just change the year in the configurator, and the model updates accordingly.
The link contains a little more of the backstory and the downloadable model from a 3rd-party site, additionally the full source code is included in the post.
Some highlights:
- Implemented date calculations entirely in OpenSCAD (with no built-in date support, which was challenging but fun). - Customizable layout, multi-material printing support, and translation for all text elements. - Configurable holes for magnets/screws to mount on a fridge or wall. - Utilizes JustinSDK/dotSCAD and davidson16807/relativity.scad for string manipulation. - Correctly takes into account leap years.
Would love to hear your feedback. Thanks for checking it out!
Another one for the openscad awesome list: https://github.com/elasticdotventures/awesome-openscad
Personally I've stopped using openscad recently (*in the last few years). I found it's lack of ability to create attachment/mate connectors significantly inhibited it's ability to compose complex objects. I looked into the amount of effort required to support attachments and ultimately decided that it was the wrong approach and have since migrated to Python & cadquery.
I need to take another run at CADQuery and Build123. I’m frustrated with OpenSCAD’s unstable kernel, but it’s still the easiest way to get a basic parametric design going from code.
I’m also keeping an eye on zoo (fka KittyCAD). It too has performance problems, but if/when it stabilizes it’s exactly what I want.
Plugging my system here: https://github.com/timschmidt/csgrs
I think I've reached feature parity with OpenSCAD, and a similar level of ease of use, but with multithreading and all of Rust available, including the https://www.dimforge.com/ libraries and high quality 2D offsetting with https://github.com/jbuckmccready/cavalier_contours
Nice!
I'm really happy to see OpenSCAD so often here in HN!
Let me also show something that I did: a Braille generator: https://github.com/lucasoshiro/openscad-braille
It's also available in Thingiverse, so it can generate STL files without having to use OpenSCAD natively: https://www.thingiverse.com/thing:6463849/remixes
Wow, nice!
I'm always trying to figure out why OpenSCAD has such a following when, at least to my manufacturer-brain says "whoa it's inconvenient to use to make real stuff" and "there are more expressive 3D modeling DSLs".
Is this like hobby only like writing an app in brainfuck? Or am I missing something?
I think it’s the super low barrier to entry. When I first started 3D printing, I wanted to make basic shapes with decent dimensional accuracy. OpenSCAD lets you install a single app and start doing that immediately. It was easier for me to quickly learn the OpenSCAD syntax than it was to spin up on FreeCAD or Onshape.
I started with Tinkercad, which is online and WYSIWYG. Nice for newcomers, but as a programmer I felt that I needed something that could be more automated.
If I was dealing with diagonals, I needed to calculate sines and cosines outside and then place the values. If needed several objects with the same shape I needed copy and paste them, and if the base shape was wrong, I needed to delete them all, fix, and then copy and paste again. And if a value of dimension, position or angle depended on another it was more and more calculations. Soon it became unsustainable for me.
OpenSCAD saved me. Being able to create modules, using parametric values, declaring functions and so on made my life really easier. At the first it looked like it would be boring to do everything by code, but once you get used to it is actually faster than using a WYSIWYG tool.
There’s not many free as in open source alternatives out there. There’s traditional CAD such as Fusion 360 which gives you a limited amount of designs and is “free” for non-commercial use.
So then under the open source, own your designs umbrella you have stuff like FreeCAD which is similar to traditional CAD which means you have a learning curve.
OpenSCAD is programmatic which suits someone with a software engineering background. Plus being free in the sense of owning your designs.
> OpenSCAD is programmatic which suits someone with a software engineering background
Perfect. I already knew how to code, so it was just a question of minutes to learn the basic stuff of the language and then I could just do what I wanted.
Fusion360, AutoCAD and organic modeling tools like Blender you need to learn several concepts, keybindings, navigating through menus, panels, tabs, workspaces, etc, etc. So many things _before_ doing something. In OpenSCAD you can even code in the text editor you're already familiar and then use it only to render the object (which can also be done through CLI!)
Well, I personally just can't do 3D modelling any other way, if I had to use graphical tools to create it, it would be pain. On the other hand, writing code is a second nature for me, so even if it's a little inconvenient, it's still much better than anything else (for me).
I only used it once for modeling some procedural decorations in the shape of flowers. I did it on a long train ride and managed to both learn the language and do the models, so there's something to be said about the simplicity. If I had to do anything more complex or less artistic I would use other tools. Something python-based would be ideal.
> Something python-based would be ideal
SolidPython is a Python lib that generates OpenSCAD code, so you can use whatever Python code you want to give more power to OpenSCAD.
Here's a QR code generator that I made in 30 lines, using a QR code library + NumPy + SolidPython: https://github.com/lucasoshiro/solidpython-qrcode/blob/main/...
OpenSCAD is not a programming language with flow of execution, but static statement of properties of the desired object. Only language better for this might be Prolog.
Once you totally comprehend this, all the "functional" shit of OpenSCAD makes total sense.
Python does not have that kind static description properties, and those OpenSCAD-Python translators suck very much, imho.
> there are more expressive 3D modeling DSLs
Can you name them? I'm not being sarcastic, I just want more options :-) (if they are free and open source, just like OpenSCAD)
Me too I've struggled to find anything good
Nice job. I will have a play.
In case anyone fails to notice the link to dotSCAD - do investigate it. That bloke (sadly now deceased was a OpenSCAD legend!)
Easter calculator. The algorithm is roughly:
Sunday after the first full moon on or after Mar 21. If the full moon is a Sunday, then the following Sunday. The date of the full moon is not an astronomical one and its date is left as an exercise for the reader.
There are two Easters too - the Orthodox one involves the Julian calendar, the Roman (etc) involves the Gregorian calendar.
You could chicken out with a lookup table!
Easter is when you village elder decides it is full moon by looking at it, not your fancy math. Though the math is good enough and really better for a connected world.
This is really cool! I only have a single-spool printer, but I wonder if I could brush or stamp paint over the top to give the surface a different color from inset lettering. I should probably also reinforce my Z axis before trying to print day numbers that small.
Kind of funny to see string manipulation functions implemented in Openscad code.
You can always insert a pause and swap to a different filament at a certain z-height.
As others have said, you can use M600 or a pause (depending on your printer) and swap filaments. The design specifically supports both use-cases, it can easily switch from all colors on a single height level to all colors having their own height levels.
You can use M600 to stop and load a new filament to use multi colour.
I've never seen the SCAD language before - looks surprisingly similar to JavaScript.
Actually, not much except the curly braces + semicolons, which makes it look like C, C++, Java and many others.
OpenSCAD is functional/declarative, so you can't change the state of a variable, functions don't have colateral effects, lists are immutable, and so on.
We also don't have for, while or if-else in the way we have in other languages. A for loop in OpenSCAD is only a way to repeat objects (= 3D objects, not POO objects), if-else are like a ternary operator for objects, the objects aren't values, and so on.
OpenSCAD has also some built-in less common features. One highlight for me are native vector and matrix multiplication, and other is the list index based on the name of the axis (list.x means list[0], list.y means list[1] and list.z means list[2]). But it lacks string and list operations, which would demand some FP-fu to write your own functions to manipulate them, just like the author did.
If you speak Portuguese, I gave a course last year about OpenSCAD. The slides are available here: https://lucasoshiro.github.io/posts-en/2024-03-24-openscad/
Is this a 2D colour thing on a 3D printer?
If so am loathed to print those because you need an automatic material system and it creates a lot of poop (cut-offs when switching colour)
It think it might be OK to have say 5 white layers then a couple of ink layers.
Also how do you get on with the slicer with fonts.
I found this difficult when printing a dog tag. I sort of got the impression it may be better to have a "gcode font" rather than go TTF->Triangles (STL)->Gcode
However overall: great effort and I love openscad. I love the idea of it I only used it once as I have been busy!
It supports both with a single toggle, either you use MMU/AMS in which case it's all on the same level, or you don't use it and all colors have a different height level making it easy to just M600/pause your print and change the color.
Designs of this kind don't leave that much poop, there's not much waste when it's only a few layers.
> Also how do you get on with the slicer with fonts.
Haven't had many problems with them, I usually enlarge the text until I'm happy. I also usually do $fn = 360 for OpenSCAD which uses so many triangles that you can't really see it not being round with your naked eye.