2
$\begingroup$

I will create a 3D printable model of a kagome lattice on a torus.

My solution:

c[p_, m_, n_, v_] := Join @@ CoordinateBoundingBoxArray[{p, p + {m, n} v}, v];
tor[u_, v_, m_, n_] := {(m + n Cos[v]) Cos[u], (m + n Cos[v]) Sin[u], n Sin[v]};
f[x_, m_, n_] := Rescale[x, {m, n}, {0, 2 Pi}];
torp[m_, n_, a_, b_] := With[{pts = CirclePoints[{##}, 1, 6] & @@@ Join @@ (c[#, m, n, {2, 2 Sqrt[3]}] & /@ {{0, 0}, {1, Sqrt[3]}})}, Map[tor[f[#[[1]], -1, 2 m + 2 - 1], f[#[[2]], -Sqrt[3]/2, (4 n + 3) Sqrt[3]/2], a, b] &, pts, {2}]];
gv[m_?IntegerQ, n_?IntegerQ] :=
  Module[{lst, cylinders, spheres, cyR = 0.1, sphR = 0.3},
    lst = torp[m, n, (2 m + 3)/(2 Pi), (4 n + 3) Pi/(4 Pi)];
    cylinders = 
    Table[Cylinder[{lst[[i, j]], lst[[i, If[j < 6, j + 1, 1]]]}, cyR], {i, Length@lst}, {j, 6}];
    spheres = Sphere[#, sphR] & /@ lst;
    Graphics3D[{Black, spheres, cylinders}]
  ];
output = gv[30, 3];
Print[output];

Old question:

I've used some code of this question.

c[p_, m_, n_, v_] := Join @@ CoordinateBoundingBoxArray[{p, p + {m, n} v}, v]
tor[u_, v_, m_, n_] := {(m + n Cos[v]) Cos[u], (m + n Cos[v]) Sin[u], n Sin[v]}
f[x_, m_, n_] := Rescale[x, {m, n}, {0, 2 Pi}]
torp[m_, n_, a_, b_] := With[{pts = CirclePoints[{##}, 1, 6] & @@@ Join @@ (c[#, m, n, {2, 2 Sqrt[3]}] & /@ {{0, 0}, {1, Sqrt[3]}})}, Map[tor[f[#[[1]], -1, 2 m + 2], f[#[[2]], -Sqrt[3]/2, (4 n + 3) Sqrt[3]/2], a, b] &, pts, {2}]]
gv[m_, n_] := Graphics3D[{EdgeForm[{Thick}], FaceForm[None], Polygon /@ torp[m, n, (2 m + 3)/(2 Pi), (4 n + 3) Pi/(4 Pi)], Point /@ torp[m, n, (2 m + 3)/(2 Pi), (4 n + 3) Pi/(4 Pi)]}]
output = Show[gv[30, 3]]
Export["Kagome3DModell.stl", output];

In the Mathematica script it shows only edges as I want.

Model in Mathematica

After exporting it to a STL file, we can only see the faces.

View in STL viewer

How can I produce a STL file only showing the edges like in the Mathematica Show-command?

Thank you very much for help.

$\endgroup$
3
  • 3
    $\begingroup$ The way you construct the lattice is based on polygons. You then "hide" the faces of these polygons with FaceForm -> None, which only modifies the way they are displayed, but doesn't make them disappear. You could try constructing your structure using e.g. Line elements instead. $\endgroup$
    – MarcoB
    Jun 11, 2018 at 16:09
  • 1
    $\begingroup$ I believe STL can't show color. It can only save triangles. $\endgroup$
    – Greg Hurst
    Jun 11, 2018 at 16:13
  • $\begingroup$ It's very easy to do it with Blender 3D.1.Import model. 2.Add Modifer-Wireframe-> Apply. 3 And export to STL. $\endgroup$ Jun 11, 2018 at 16:27

1 Answer 1

3
$\begingroup$

Using DXF instead of STL, you can export only lines if you want.

gvlines[m_, n_] := Graphics3D[{Thick, 
   Line[Append[#, First[#]] & /@ torp[m, n, (2 m + 3)/(2 Pi), (4 n + 3) Pi/(4 Pi)]]}]

Import @ Export["Kagome3DModell.dxf", gvlines[30, 3]]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.