Kicad and Wings

You couldn’t pair up a more esoteric set. The only thing that beats wings3d’s user interface is wxwidgets.

My understanding is that wings3d vmrl (or wrl) files are used in kicad because that is just about the only open format that also supports textured faces, but then kicad goes and only supports an old obsolete vmrl format. Some programs, like FreeCAD, can export wrl files. You might get excited by that. You might then get very, very disappointed. It is not compatible.

I’ve found a pretty good groove though for creating pretty 3d models for kicad. First I generate the model using either FreeCADftsh-mt or OpenSCAD. I find FreeCAD more amenable to creating things like pin arrays, like the ones in this 0.05 pitch header I modeled, and OpenSCAD a better fit for making oddball shapes. That probably seems backwards to other people. Meh, it’s my experience. OpenSCAD is also good for making parameterized models where you can generate a slew of different sized headers or SMD DIP packages. I’ve BOMeddip-smd some MOC3031 and opto-transistors in what can only be described as a standard DIP through hole package, but with the legs bent and flattened out for SMD. This here is the footprint preview in kicad. Having this modeled in OpenSCAD, and properly parameterized, would make adding a 10 pin version quick and easy. This one was, however, modeled with FreeCAD as well.

Once I’ve got a model I’m happy with, I export it into a format that wings3d understands. I have not,
for all my trying and googling, found any format that wings3d will import with color. Nothing. Nada. If anyone knows of one, please… So my export is usually STL or obj. Now here’s the trick! Create a separate export for each color. Everything that’s black, export in one file. Everything that’s silver in another, and so on.

Now start up wings3d. You might think you could give it a file on the command line, and have it open that file! You’re wrong. At least, if the file type you’re opening is actually an importable file type and not the native .wings filetype. But actually I do open a wings file, one I’ve populated with various “materials” that wings3d uses to apply colors to the final wrl export. Spend some time playing with the materials, maybe find some existing .wings files online for examples? It’s not hard, but it’s very much not intuitive. This post has a great rundown of how to access materials, create new ones, and apply them to surfaces.

Here’s the trouble. At least, I haven’t found a way to get materials from different files and combine them into a single file! The mind boggles. So whenever I want a new color, I open up that particular file that shall forever hold all my different materials, and add the new material there, not while I’m playing with my shiny new model. I know, it’s so tempting!

So, now I’ve opened my colors file that already has the colors I want. Then I delete the ‘test objects’ from geometry graph (there’s a few windows you’ll want open from the windows menu item while you work in wings3d). With a blank workspace, Go to File -> Import -> STL (or .obj). Import each separate model file for each color. This is the trick from before. As Happy Robot Labs mentions in the linked post above, selecting the faces to color is not exactly all that easy. Dragging a selection box is effective, but you’ve got to orient things. And any concave selections… forget about it. However, each separate import becomes a group. And with the solid red box icon selected, you just click on any part of that group and the whole thing is selected. Apply the material, bam.

Finally, export the material in .wrl format. Add it to the footprint in kicad (I usually have to scale it by 1/2.54), play with the rotations, and enjoy amazing 3d board previews!