Skip to main content

Fixing BRIO Switches, Or Why Do Trains Derail On Them?

BRIO track is made from beech wood. A very hard woord that lets them mill very sharp edges that won't chip. This makes their switches look good, as the bits in which the track diverges from the main will look very meticulously cut out from the wood. Nice and sharp.

Unfortunately we're not talking about real trains that have to take the switch, we're talking about children's toys. There is also no actual "switch" happening, there are no switch rails and no switch rods moving them into position. That means the cars just follow the path of least resistance.

The problem with BRIO's switches is that their closure rails start too soon. It looks hella good and it's some fine factory-milled wood... but cars, following the path of least resistance... are very often still going straight and haven't been pulled yet into the direction of the switch. And thus they get stuck behind the other side of the closure rail.

BRIO Train Car Stuck Behind "Closure Rail".

The picture here shows a train that will derail, its two cars' wheels are both on different sides of the closure rail. There is no way the car will be pulled "over" the rail and fall into the right groove of the track.

The solution is to have the closure rail start later. This gives the car that's being pulled to the side a bit more time for its wheels to start going into the direction of the switch before the closure rail starts.

Now I regret not buying that dremel when the shops were still open. I'm writing this during the 2020 coronavirus lockdown and all stores are closed. Luckily I had some sandpaper in the basement, for removal and finishing. I only ended up using the removal one. I took a new pack of Curved Switching Tracks that BRIO had sent me for free, but that's another story, and started filing away.

Curved Switching Track & Sandpaper.

After some time I ended up with a switch on which trains would derail far less often. It was a very noticeable improvement. When I have a dremel I'll cut away some more maybe. Here's the final photo comparing the sanded switch to an untouched one.

Comparing Sanded Switch to an Untouched One.

Granted, it looks less "sharp", but it does work a lot better. BRIO surely knows this too so I don't understand why they haven't made their switches better yet.

In any case, if you want to help out your kids and see less frustration when their trains need to go through switches... sand away the start of the closure rails.

Got a Custom Drupal Module and Theme? Do Not Give Them the Same Name.

Turns out naming things in Computer Science really _is_ hard.

When you are developing a Drupal website, do not name the theme for your website the same as a custom module. Because things will not work and nothing anywhere will report that something is amiss.

Twice in my career as a Drupal developer I have spent hours on figuring out why "things did not work". Last week I spent the whole afternoon and most of the evening pulling my hair on why my custom Drupal 8 theme would not load its CSS. Squinting at my_theme.libraries.yml and peering over, parsing it char by char 20 times... checking the theme functions to see if I mistyped anywhere... But I couldn't find anything.

Until I realised that the theme had the same folder name as my custom module. And I can't imagine this does not happen to more people? So often when you create a small website, the website has a name, right? And automatically I name the module that will hold the custom logic after the website. Just as I do the theme, because the theme is... the theme for _that_ website. Well, that does not work.

Again, a module and a theme, within the same Drupal website, can not have the same folder name.

TrackBuilder 0.9.5

This release must be the near-final one before the 1.0 Minimal Viable Product is there. The only thing that seems to be missing is loading and saving tracks. That won't be too hard to add. Could be really simple saving just the text-strings in a file... but that's nog flexible enough. It will be JSON, opening up the possibility of a web-service, who knows. I'm having fun.

New in this release are "nudgeable" Double Curved Tracks, but the biggest thing is that the curved switches can now be nudged as well, when rotated. This way you can add a curved switch... rotate it so that the switch track is at the front, and it can be nudged so that the curved switch track connects to the railroad instead of the straight track of the curved switch.

Download TrackBuilder 0.9.5

TrackBuilder 0.9

And again another release with some improvements. Version 0.9 meaning it's pretty much "feature" complete for the MVP that I envisioned at first.

I've tidied up the code and it should be a bit less fickle now. You should be able to paste in whole strings of tracks and they should render.

The tracks that got added in this release are:

  • Cross Track
  • Criss Cross Track
  • Turntable
  • Stop&Go Crossing
  • Double Straight Track

I also made some macOS specific code not run if the app launches on Windows.

Known issues:

  • Double Curved Tracks won't "nudge" yet
  • Switching Tracks don't rotate or nudge
  • The app does not "follow" the entered track out of view so some scrolling is needed

Here's the download link.

TrackBuilder 0.8, Switching It Up

Another update to the TrackBuilder. This time there is support for switches and more vintage types of tracks and the "control panel" should stay a fixed width when resizing the window.

The tracks that got added are:

  • Brio's elusive Middle Straight, a piece of track that is 72mm long
  • Outer Curve of a Short Double Curved Track
  • Outer Curve of Double Curved Track
  • Curved Switch
  • Parallel Switch
  • Short Curved Switch
  • Cross Track

I've added the the schematics of a track I built recently, you can see where some "vario" is needed. But it's minimal and nothing to worry about. I used TrackBuilder to tidy up the track I had laid down as much as possible.

Brio track layout schematics

Next up will be "actual" double track curves I think. Now you need to add the inner and outer track separately, that's not good :)

And finally, the download link. As before, run it (on macOS) with: java -jar TrackBuilder.jar

[Update: Released 0.8.1 fixing the long curve radius and 0.8.2 fixing short curved switches getting badly calculated when rotating them. The download now links to 0.8.2]

TrackBuilder 0.7

[Edit: It has come to my attention that the app only works if you have the latest Java installed, and probably only on a Mac as well. ]

I couldn't just leave it with a sloppy UI like that so read up on Java Swing Layouts a bit and made some minimal adustments.

Fixed in this version:

  • Better resizing behaviour
  • Better layout of control panel
  • Better scrollbar behaviour


Known issues:

  • TrackBuilder does not follow the end-point of the track to keep it "in view". This means you'll need to scroll manually.


Download: TrackBuilder 0.7

Trackuilder 0.6

Had some more time today so I thought I'd make TrackBuilde a little more user-friendly.

New in this release:

  • Input track in TrackBuilder window, not on the command line anymore.
  • Track gets drawn on the fly.
  • Program does not exit on invalid input.
  • Input gets filtered. Only A, B, C, D, E, F, E' and F' are allowed.



  • Track draws immediately, no need to scroll or resize the window first.


Download: TrackBuilder 0.6

TrackBuilder 0.5

This version of TrackBuilder adds scrollbars and does not "end" after having entered the first layout. It shows the prompt again and waits for input for a new layout.

Fixed in this version:

  • The window in which the track is laid out does not scroll so if your layout is big it will fall outside of the window.
  • It seems that if you start your track with a straight it does not get drawn. I do not know why.

Known issues:

  • The track only gets drawn after clicking in the window.  

Download: TrackBuilder 0.5

Rudimentary Wooden Railway Track Builder

When you have a kid there's a chance you might be building wooden railway layouts at some point. And when you do you can "force" the tracks a little bit in order to make them fit, making use of what they call the "Vario" system.

Now, I like to build layouts with as little vario as possible. After a while the track has a lot of different track pieces, especially the short and long curve combinations skew things. With all these tracks on the ground you're never really quite sure if they make a perfect fit or not. You can of course hold down each track and line up the next one perfectly and work your way along thet track like that but I thought, what if I'd come up with a little tool that would let me add the tracks that I've added to the layout and let the computer tell me whether they make a perfect fit (or near fit) or not. A near fit is what I call a fit that is within 1cm of where the start and end of the track should meet and I consider that fine as well.

The tool is a Java .jar so you need the Java Runtime Engine (JRE) installed on your computer. When you download TrackBuilder it you can start it from the command line with java -jar TrackBuilder.jar

Go add the tracks you've added to your layout at home and see if they make a perfect fit.


  • The window in which the track is laid out does not scroll so if your layout is big it will fall outside of the window.
  • It seems that if you start your track with a straight it does not get drawn. I do not know why.  

Download: TrackBuilder