Printing proteins: pdb to scad


Getting a message from Cathal Garvey reminded me I haven't played with OpenSCAD for a while. OpenSCAD is a simple but powerful scripting language for making 3D models. I've been wondering for a while about converting PDB files into spacefill models of molecules in a format I could print them from, so I wrote a little Perl script to convert PDB to SCAD. Nothing clever. 

This might look like a bear investigating a big flower, but it's actually aspirin rendered in OpenSCAD from this PDB file.

 


If you want the script it is here. Do whatever you like with it. Van der Waal's radii taken from here are expected in a local copy of this file. It should also work for proteins (which is why I chose PDB and not mol, sdf or whatever), but rendering so many atoms in OpenSCAD does tend to make things crash. I should probably try clean my PDB file up first by stripping out waters and so on.

I've no idea whether these would print or not, I can imagine all manner of problems that might arise. I'll try it some time, but if you get there before do let me know.


2 comments:

  1. Spookily similar thinking (but several steps ahead of me) from Cathal with his DNA sculpture.

    ReplyDelete
  2. Latest version comes with CPK atom colouring too.

    Get aspirin scad here.

    ReplyDelete