# Graphics3D from Mathematica to SolidWorks (for 3D-printing)

I have an 3D Graphic generated with Mathematica's Graphics3D, and want to use it later in SolidWorks. SolidWorks files are usually *.stp, *.step, *.stl extentions.

google search hasn't given me a solution yet, and I didn't find anything on this page either.

Are there solutions to that? What is the best way to do this? Or do you know any workarounds?

edit: Just for info - my 3D Graphics (from here) is:

Graphics3D[{GraphicsComplex[
Join[{Cos[#], Sin[#], 0} & /@ Range[0, Pi, Pi/(25)], {{0, 0, 1}}],
{
{#, Rotate[Rotate[#, 180 °, {0, 0, 1}], 90 °, {0, 1, 0}]} &[
GeometricTransformation[Polygon[{##, 27} & @@@ Partition[Range[26], 2, 1]],
{IdentityMatrix[3], ScalingTransform[{1, 1, -1}]}]
]
}]}]


edit2: Thanks to Simon Woods' wonderful answere, I was able to export to Solid Works, and print it with my 3D-printer. Here are real-world results:

Thanks alot again :)

• Export[path.stl,something in 3D] works for me. Then I don't know if SolidWorks can handle it. – Öskå May 26 '14 at 10:32
• Thanks Öska, looks promising. Unfortunatly, I got a error when writing this, namely: Export::nodta: "Graphics3D contains no data that can be exported to the \!$$\"STL\"$$ format. ". I added my instruction above, could you try whether it works for you? – Mario Krenn May 26 '14 at 10:49
• I found a video with Solidworks with Mathematica. I thought it was cool to share: youtu.be/grGauPYuYSs – LCarvalho Feb 24 '18 at 23:07

## 2 Answers

You need to use Normal to explicitly apply the various transformations, resulting in an ordinary collection of polygons which Export can translate to STL. Unfortunately, it looks like Normal has a problem when multiple transformations are supplied to GeometricTransformation. We need to handle this with a specific rule.

Assuming g is your Graphics3D:

gn = Normal[g /. GeometricTransformation[prims_, tf_List] :>
(GeometricTransformation[prims, #] & /@ tf)]

Export["test.stl", gn]


This produces an output file. I do not have SolidWorks to tell if it's any good or not.

• works great for me, I can open the file without problems in SolidWorks. Thank you! – Mario Krenn May 27 '14 at 9:12

The Mathematica Package below exports to either of two popular raytracer file formats (not 3ds which is proprietary/binary), and can be used Live in Mathematica interactively/Live.

https://sourceforge.net/projects/rayshade-math/

I'm interested myself if anyone is exporting to a Cuda rendering suite or even 3DStudio ARt Renderer and how well Export[] did (in the past export was very poor, i have no copy of 3dstudio to check today's results - but do not have fingers crossed since Wolfram only shows pics being exported not their results?)

• Mathematica has import/export to institutional formats for geo mapping and chemical. For most, those are the work-horses and more the focus - but i have no idea there how well mm does exporting. Importing wise, Mathematica can use maps we all know that! – john May 19 '17 at 14:00
• Please, make it more self contained -- did you write the software, license, code samples, what if the link goes down or it is pulled out of the VC, etc, etc. – Sektor May 19 '17 at 14:20