Designing furniture using the CSS grid (2023) (alnvdl.github.io)
At one point during the construction of my house, we needed designs for the kitchen and bathroom cabinets and a bedroom wardrobe.
I wanted full control of the design process. Doing it in vector illustration software was too painful and it was taking too long. But I didn't have the time to learn any complex CAD tool either.
So I developed a small HTML/JS/CSS tool for designing MDF furniture by writing my own little language that transpiles into a CSS grid layout.
Take a look at the blog post for details: https://alnvdl.github.io/2023/01/07/designing-furniture-usin...
Or go directly to the tool (works best on desktop or tablet): https://alnvdl.github.io/squareplanner/
32 comments
[ 2.9 ms ] story [ 72.2 ms ] threadI also recommend using this cheat sheet to simplify the process of creating responsive layouts: https://flexboxcss.com
https://hn.algolia.com/?dateRange=all&page=0&prefix=true&que...
https://hn.algolia.com/?dateRange=all&page=0&prefix=true&que...
https://hn.algolia.com/?dateRange=all&page=0&prefix=true&que...
That's excessive and starts to run afoul of this site guideline: "Please don't use HN primarily for promotion. It's ok to post your own stuff part of the time, but the primary use of the site should be for curiosity." So if you'd please stop doing this, we'd appreciate it.
HN users, btw, are a lot fiercer than the mods about this and will use unkind words like 'astroturf' and 'spam' when they notice such repeating patterns. It's not in your interest.
Solid work on this, and I love that it takes advantage of the browser to rejigger things without having to redraw everything manually every time.
The scale is there just to make things look nice in the browser and/or in print format, and it can slightly corrupt the numbers as you noticed, especially when it's a small or odd scale (try setting it to 1 and watch it break horribly). I guess a few ways to get rid of the scale would be to introduce variable font sizes, make text not be counted for sizing the boxes, or automatically finding the "right" scale number with code. But like I said in the post:
> I guess making it more “serious” would have been possible, but in this case I just wanted to get my furniture designed fast, and keeping the code simple and small helped in that.
See: https://github.com/alnvdl/squareplanner/blob/01bdcb050ce58a4...
I also got these designs printed to follow during the construction, so I just picked scale numbers arbitrarily in a way that made them look good in the browser and fit in the paper size. So "portability" and pleasing visuals were more important than accuracy.
And of course, I could cheat like that because in my particular case any imprecisions got flagged by the real 3D CAD used by the furniture company to formalize the project :)
I'd also submit that it's of limited value if you aren't using the same package as your shop. The browser-based method is at least all but guaranteed to be available to the people building the cabinets.
Since they'll have to do shop drawings anyways, you aren't gaining much even if you can interchange drawings with their CAD software.
Proper constraint-based drafting is indeed quite hard! But I think the whole "lay out this 2D grid-like structure with a few rectangles" problem is probably one of the first things anyone would learn to do with it, and I'd submit that it is indeed probably about a couple of hours' work, for someone already reasonably technical. The moment there's more than a single sketch involved, or complex geometry in that single sketch, I agree with you that it's asking too much.
The real benefit is that you are starting to learn something new. CSS is not going to help you (insane contortions aside? I really don't want to find out) when things like circles appear. And yet, if you know how to do 2D sketches, you can find yourself using them to solve other problems, just because you already know how to do it. And that's pretty cool! (For example, I've had living rooms that were just awful to lay out. It was a real nightmare to figure out how to get a TV into that place. So I sketched it up and messed around until I got something viable. My original plan was just to print out some pieces of paper to scale, then mess around with those, but it was soon clear I could do it all onscreen, so I did.)
It can export to SVG, DXF, PDF, GCODE, and more
But as another commenter highlighted: that meant a learning curve not only for me, but for my wife as well. And then there was the challenge of sharing it with everyone else via email, IM, etc. Having it open in the browser means it's easy to share, and fast and easy to load and show to people anywhere (which is handy during construction).
I get a 3D rendering, a cutting list exported as CSV that I can pass on to a shop, and it's trivial to adjust and play with dimensions.
> I wanted full control of the design process. Doing it in vector illustration software was too painful and it was taking too long.
Aaaand then 5 evenings later… classic :)
But yes, the real designers using the CAD needed to take board thickness into account when designing the internal structure. In other words, this tool is generating a list of my requirements (what I want it to look from the outside + the labels describing what I want each part to be), and then there's the separate work of designing the actual, reality-constrained furniture.
Super cool!
And it would look very weird, but I suspect it may be possible to assemble the cabinets with these odd shaped doors or drawers...
I find this an odd exercise in using something ill suited for a purpose in an extra complicated way, just to solve an already solved problem.
Do you want to quickly throw together a kitchen design idea? IKEA has a full-featured tool just for that. Want something lower-level? Start with Tinkercad, Sketchup, all the way to Inventor or Solid Works.