# How do I create an STL file from nearest neighbour graph edges?

I'm trying to figure out to deal with (and design) .stl files within Mathematica.

As an example, I would like to generate a FCC lattice without the atoms (but connecting all nearest neighbours), and exporting it as an STL file. I've obtained the coordinates from LatticeData, connected the nearest neighbours with NearestNeighbourGraph, and modified the Edge thickness. However, exporting the data as an .stl file only shows the atoms (the vertices), and not the edges.

How can I generate a list of nearest neighbour edges within Mathematica from a lattice structure that can then be successfully exported into the .stl format?

cell = LatticeData["FaceCenteredCubic", "Image"];
coords = Translate[DeleteCases[cell, {_, _, Polygon[_]}, Infinity][[1]], 2 Tuples[Range[1], 3]][[1]][[1]][[1]]
graph = NearestNeighborGraph[coords, VertexSize -> .05,  EdgeShapeFunction -> ({Darker[Black], Thickness[0.04], Line[#1]} &)]
Export["temp.stl",Show[graph]]

• Instead of Line[#1] for the EdgeShapeFunction, try Tube[#1, 1/40]. Nov 14 '20 at 8:28

gr = EdgeList[graph] /. UndirectedEdge[x_, y_] :> Tube[{x, y}, 0.1] //

• I've been working on ways to print molecules: Export["<file.stl>", MoleculePlot3D@Molecule["Methane"]] and simple models work fine if the bonds and atoms are similar in size. As I move up to bigger molecules (and therefore want smaller atoms and bonds) the support structure is becoming an issue. Nov 14 '20 at 19:25