The Tale of How One Programmer Coded His Chipboard Furniture in PHP

A programmer frustrated with existing furniture design software creates his own PHP library that generates OpenSCAD models for chipboard furniture, using an HTML/CSS-like approach to panel placement. The article showcases real projects including a desk-shelf combo, a Frankenstein workstation, and a kitchen table with built-in stools.

In a Galaxy Far, Far Away...

The author tells the story of his long journey toward creating his own furniture. Initially, he bought ready-made panels and shelves from stores, but later realized this limited his creative possibilities. He decided to look for furniture design software and settled on "Astra Furniture Constructor," but it didn't satisfy him.

The Path to OpenSCAD

In parallel with furniture work, the author was working with a 3D printer and started using OpenSCAD — a program for creating 3D models through code. He liked the approach where "everything is built on numbers" and parameters are easy to change. However, over time the code became complex and tangled.

"As long as you're immersed in it — everything's simple. But leave the project for a couple of months..."

OpenSCAD had limitations, especially with layers and element grouping.

OpenSCAD workflow 3D model example Furniture model

PHP.SCAD

The author decided to create his own library in PHP that generates OpenSCAD files. He chose PHP over Python because "indentation is just text formatting," not part of the syntax.

For convenience, he set up VSCode with the "F5 Anything" plugin so that pressing F5 would execute the script and OpenSCAD would automatically reload the results.

PHP.SCAD setup VSCode setup

PHP.MEBEL.SCAD

The author rethought the approach to furniture design. Instead of placing individual panels with coordinates and rotations, he applied an HTML/CSS layout principle:

  • Chipboard furniture in 99% of cases consists of rectangular prisms
  • Functions used: wall_top(), wall_bottom(), wall_left(), wall_right(), wall_front(), wall_back()
  • Panels "snap" to sides, automatically shrinking the interior space
  • Panel dimensions are calculated automatically
Panel layout concept Wall function diagram Automatic sizing

Basic example:

$box = box(500, 800, 600);
$box = wall_top($box, "Furniture: %W");
$box = wall_bottom($box, "Furniture: %W");
$box = wall_left($box, "Furniture: %W");
$box = wall_right($box, "Furniture: %W");
render_scad();

The library automatically:

  • Selects edge banding locations (marks missing ones in red)
  • Splits space into parts (split_vertical(), split_horizontal(), split_depth())
  • Adds padding via padding()
  • Exports a CSV parts list for cutting
Edge banding Split functions CSV export Parts list

Real Projects

Desk-Shelf Combo

A structure that uses the space above the desk for open shelves. Includes rounded edges on the tabletop.

Features:

  • Main tabletop with 100mm corner radius
  • Supporting side panels
  • Three-level shelf unit with alternating dividers
  • Requires wall mounting
Desk-shelf model Desk-shelf detail Shelf dimensions Rounded edges Assembly view Final model Built desk-shelf

The "Frankenstein" from the Desk-Shelf

A continuation of the project with a built-in computer space. A 10cm gap is left at the back for cables.

Features:

  • Built-in monitor niche (230mm)
  • Five-tier pull-out drawers with doors
  • Central section with storage dividers
  • Left and right flip-up lids
Frankenstein desk photo Frankenstein desk model

Kitchen Table with Stools

A compact solution with stools that tuck away under the table. Allows sitting from three sides without your legs bumping into anything.

Features:

  • 1200x800mm tabletop with rounded corners
  • Four built-in stools (two on each side)
  • Central divider for separating zones
  • All elements integrate into the main structure
Kitchen table model Stools detail Kitchen table built Stools tucked in Three-sided seating Final kitchen table

Summary and Tools

Required software:

  • OpenSCAD (nightly build recommended for speed)
  • PHP 7.2+ (tested on 8.4)
  • VSCode with PHP and F5 Anything plugins

Library: https://github.com/CodeName33/php.mebel.scad (MIT license)

This approach significantly simplifies chipboard furniture design, allowing you to quickly change parameters and see results in real time.

Final overview