KosmoSCAD: Parametric Panel Generator

I mentioned this in another thread already, but I’ve started a little project for making custom panels with OpenSCAD that can be made on a 3D printer.

The included panel is a little passive utility panel I want to make with a passive 3:1 multiple, 2 passive attenuators, a switch and 2 1/8:1/4 converters.

I’m not 100% certain that all the holes are the right sizes since all my components haven’t arrived yet, so if somebody wants to check the values I’d really appreciate that. I’m also not sure if the mounting holes are spaced far enough from the corners for it to be stable, so I’ll have to try that too. I’m hoping to get this printed on an Ender3 later this week.

Code here: https://github.com/Miserlou/KosmoSCAD - any and all feedback welcome!



Take a look at Kosmo Specification.


Ok, I updated the values.


while I currently have zero use for this, its freakin cool :slight_smile:


You may want to add some ribs to the back for 3D printed panels. On Kosmo sized panels they can be awfully flexy without them. I’ve been using 1.5mm wide ribs inset .5mm from the edges and 5mm tall with 5mm chamfers on them to taper them in:

I also do my labels as embosses so I can print the front of the panel flat on the build plate. I also fill those embosses with separate bodies since I have a multi-filament printer and can print them in a contrasting color - but you can also just leave those out and have a nice emboss that can be filled after printing in several ways.


Ahhhh, this is such a better idea. Yeah, I bet the plastic panels can be wobbly without rails when you’re adding and removing cables, the PCB holders are a great idea, and the embossed name probably means that the whole panel looks nicer since it’s the face is printed on the hot surface. V2 coming tomorrow…


Version 0.2.0 is out! Features chamfered embossed text, structural rails, PCB holders, and raised text on the rear just because.

Thanks for the feedback, everybody!

1 Like

That raised text on the rear is going to interfere with the case’s mounting rail.

1 Like

Oh, yeah. D’oh.


1 Like

Every step is in the right direction.
Look at @juggle’s design.
You should really chamfer the ends of the rails, or else all the stress of (un-)plugin the jacks will be applied where they stop abruptly and will result in a breakage exactly there after some time.
The small 0.5mm inset of the rails will help when you have to insert the panel between two already mounted panels… Which happens often in DIY for fixing (I mean… improving) that module in the middle of a row.
Not sure about the square holes for the PCB mounts… they look really big to me. Remember the screws can’t extend beyond the panel…

I will definitely use this for making a prototype before designing a PCB panel !


Also note, I put the mounts inside the rails so the screw heads are over the rails and will clear neighboring panels. The small inset helps a bit with that as well. Unfortunately, that really benefits from fillets to reinforce the mounts and fillets are really tricky to do in opeenscad.

I went with skinnier taller rails so they wouldn’t limit me putting things as close to the edges. I did a few test prints to determine a height that gave me the desired rigidity. I still get some flex on wider panels, but since all my wider panels only have Jack’s near the bottom it isn’t a big deal.

But great progress!

1 Like

Okay! Good feedback.

Added rail chamfer, rail buffer and horizontal rails for extra strength.

Everything is parametric, so it’s really easy to tweak everything to your desired tolerances simply by changing the values at the top of the file.

You can have skinny rails:

Or big fat rails:

And everything in between. I’m not going to work on this until I’m able to print the current version and then make adjustments from that.

Thanks for the feedback everybody!


That’s much better.

The big fat rails are really fat, you won’t be able to put the jacks thru their holes, but like you said, it’s all parametric.

@BlackDeath - you may want to model in clearances around the panel holes that can cut through the rails/mounts when neecessary. I’ve had to do this on a few of my panels to get jacks to fit. If you look at the one I posted earlier you’ll see that parts of the fillets around the board mounts are cut off - only the top most one on the far right isn’t notched to clear a jack. For the jacks I use 20mm of clearance is the minimal necessary - and that’s cutting it very close due to the arm that contacts the tip sticking out a bit further. But I can usually rotate them to make those fit.

You may also want to look at the openflexure microscope and the 3 lobe holes they use in openscad for screw holes. I’ve had mixed luck with them myself - the same code producing the same holes in one part of the model were too tight and in another part too loose. Can’t explain why and even their designer was stumped about it. Look at the “trylinder” functions in their utilities.scad file

They actually have a lot of great helper functions in there that may assist you.

Loving the progress. I used to do almost all of my CAD in openscad…but the issues with doing effective fillets frustrated me. And after trying OnShape I got hooked on more visual sketch/feature based modeling and now am hooked on F360. (though there are still things I much prefer about OnShape, and doing parametric designs in F360 is clunky and frustrating since you can’t keep the parameters window open and there’s no hot key to open it so you have to keep going back to the menus where it’s multiple clicks to get to and I never remember where it is since it’s moved a few times.)

My 3D printed panels are holding up great so far. 3mm thick printed at 20% infill - all the white panels were done on my Mk3s with MMU2s:


If I ever stop messing with making PCB’s and start actually building some of the boards I’m etching one day I’ll be able to fill the whole case with 3D printed panels :laughing: (It’s been a weeks diversion but my boards are finally coming out usable so I should be making progress building again very soon now!)


Print attempt one was a stringy mess. :frowning:

Any printing tips? My first time with Ender3, the hole outlines and embossed text stuck fine, but it just made thing stringies that didn’t attach to the bed once it started doing the infill. I made the GCode in the Prusa-fork of Slic3r.

Make sure that you don’t alter the height of the bed in any way after your tests and calibrations. DO NOT lift off the build surface to remove your test print as this can alter the heights! If the first few strands are adhering (you should be able to run your fingers over them without them pulling up) then the rest will be fine. This is an easy way to make sure things are going smoothly before letting the prints get too far in. If they are not adhering you most likely need to get your nozzle closer to the bed.

I use a handy calibration file (where I found it escapes me) every time before I print. It moves the head to the four corners of the build platform and pauses there until you hit the button to continue. At each point I slide a piece of paper under the nozzle. It should just slide under with the barest amount of friction.

Make sure that the bed is coming up to temperature and perhaps use a raft support. If the raft adheres properly you’ll know the rest of the print will be fine.


Found it. Just follow these instructions.


Big flat parts like these are one of the trickier things to print. They really like to warp and curl up at the corners. Worst case you can try adding a brim…but I hate having to do that.

Good bed level and proper height first layer will be critical to success.

I also found I have to keep my enclosure (I have a lack table enclosure I built for my mk3) closed when printing panels or at least one corner will always lift. It won’t usually lift enough to cause the print to fail (though it easily can, especially if your first layer is off or bed isn’t totally level) but it did bug me that the very visible front was deformed on my first few attempts. With the doors of the enclosure closed I don’t get any warping anymore.

Depending on your particular printer/filament/print bed you may need to use some additional tricks to get better bed adhesion when printing. I have the textured power coated PEI sheet for my Prusa and it works great for me. But on my old printer with a glass bed I routinely needed to use hair spray or glue stick on prints like this.

I also make 3D printed panels, and if it’s any help, here are a few design principles that have worked for me. I settled on a form factor that looks like this:

The big protrusion coming from the back is only necessary if the PCB is wider than the front panel. If the PCB can fit within the panel’s area, I mount it directly to the panel with standoffs. These “card” style ones I use less often but they allow you to mount the PCB on standoffs or with wood screws directly to the backing.

I also like to make my mounting holes ovals instead of circles since it is more forgiving with inaccurate dimensions. My rails aren’t all perfectly square, and sometimes the prints warp a bit. I’m a fan of the square continuous wall around the perimeter since it adds rigidity across the height and width of the panel, but sub-divisions can be necessary for very wide panels. A trick I use all the time in 3D printing is to use a nice big nozzle and print two parallel traces for thin walls that are each equal to 1.2x the nozzle width. So the walls I use on my panels (which are printed with an 0.8 mm nozzle) are 0.8 * 1.2 * 2 = 1.92 mm - this gives a nice sturdy wall with two clean traces and not much material used. Your mileage may vary.

I’ve also found that any labeling you do using paint or sharpie will come out much better if you print low and squash the first layer, and a layer or two of clearcoat makes a world of difference keeping the ink from rubbing off. It will also add a nice finish.
I’ve done my designs in Fusion 360, I like the ability to add a variable for each type of mounting hole and have the model update itself when the variable is adjusted (although Open SCAD can probably do the same - shrug). Anyway, I hope that’s helpful, and here’s a thingiverse link if anyone wants to inspect this type of design more closely: https://www.thingiverse.com/thing:4436055

EDIT: One more thing I forgot to mention - most potentiometers have little tabs on them that protrude outward, attempting to push into the panel. Some people remove the tabs or use washers - I prefer to model indentations in the panel so the tabs lock into place, making the pot sit nice and firmly. If you look closely, you can see them in the photo above. I just copy/paste the template sketch into my panel as needed, and my template file includes a extrusion cut at the appropriate depth that I apply to all the potentiometer tab holes. They only go part way through the panel and are not visible from the front.


Replying to the question of bed adhesion - my advice for the first layer is to print low and slow, don’t be afraid to squash that first layer a bit until you get into the swing of things. Also, I don’t believe the Ender 3 comes with a Marlin build that allows for mesh bed leveling, but this can be rectified with a little tinkering. Essentially, no surface is perfectly flat. Especially a print surface that will flex a bit differently every time you heat it up. Your printer doesn’t know this, and will try to print a perfectly flat plane onto a slightly uneven one, creating problems with first layer adhesion when some parts print high and others print low. Mesh bed leveling allows you to take measurements at different points across the bed (9 is usually plenty. I use a cheap feeler gauge, work’s great) and your printer will take that information into account and follow the curve of the bed on your first few layers. You can flash a new version of Marlin onto your motherboard via usb, and tweak lots of other variables while you are at it. For example, many printers have a slightly conservative build volume - the printer might mechanically reach a slightly greater area, your firmware just doesn’t know it. You can define your build area yourself once you start hacking on firmware - it’s quite handy. My CR-10 went from 300x300 to 305x310 with no problems just by moving the end switches and messing with the firmware.

New firmware will also allow you to tweak some other handy settings such as PID loops if your printer is having a tough time keeping a stable temperature, but I’d save that stuff for later down the road.