Hello, My name is Chris Want, and I do visualization support at the University of Alberta -- and in particular I run the university's 3D printer.
I'm not a pymol user per se, but I have had a client who really liked the 'surface' visualization from pymol and wanted to print some molecules off on the 3D printer. Unfortunately, pymol lacks an export export option for the 'STL' format, so I crafted together a little hack that quietly dumps out an STL file when a surface is created, which I hope may be of use to other users (or perhaps somebody who finds it useful, and who also has an understanding of the pymol user interface code, can create a button for it). Here it is (sorry it's not in a proper 'diff' format -- I'm not using cvs code): File layer2/RepSurface.c, 2 modifications: 1) Add this function: void DumpStlAscii(char *filename, RepSurface *I) { FILE *fpSTL; float *x, *y, *z; int a; fpSTL = fopen(filename, "wb"); fprintf(fpSTL, "pymol molecule\n" ); for (a=0; a < I->NT; ++a) { x = I->V + 3*((I->T)[3*a]); y = I->V + 3*((I->T)[3*a+1]); z = I->V + 3*((I->T)[3*a+2]); /* We'll let whatever app opens this file * deal with the face normals. */ fprintf(fpSTL, " facet normal 0.0 0.0 0.0\n" " outer loop\n" " vertex %g %g %g\n" " vertex %g %g %g\n" " vertex %g %g %g\n" " endloop\n" " endfacet\n", x[0],x[1],x[2], y[0],y[1],y[2], z[0],z[1],z[2]); } fprintf(fpSTL, "endsolid\n" ); fclose(fpSTL); } 2) In the function RepSurfaceNew(), locate these lines: PRINTFB(FB_RepSurface,FB_Details) " RepSurface: %i triangles.\n",I->NT ENDFB; Add the following function call immediately after the above lines: DumpStlAscii("/tmp/pymol.stl", I); Now, when the 'surface' is calculated, it's geometry is dumped to the file /tmp/pymol.stl. I Hope this is useful to somebody! Regards, Chris P.S. I wish this mailing list had archives ... -- Chris Want Research Computing Support Computing & Network Services University of Alberta Tel: 1-780-492-9418