I want to create some 3D solid model by Mathematica, and then export it into stp (step) format for further finite element or finite volume analysis in Fluent/ANSYS or Abaqus.

But so far to me, it seems mathematica supports STL or DXF format only, which are basically 3D surface model not 3D solid model.

Is it possible to convert the thus obtained STL or DXF into STP?

The Graphics3D object I am interested is something like that created by the code below:

radius = .3;
length = 5;
cyl = Cylinder[{{0, 0, 0}, {0, 0, length}}, radius];
cylinder := 
 cyl // Rotate[#, RandomReal[{0, 2 \[Pi]}], RandomReal[1, 3]] & // 
  Translate[#, RandomReal[{-5, 5}, 3]] &

Graphics3D[#, Boxed -> False, Lighting -> "Neutral"] &@
 Table[cylinder, {59}]


I finally solved the prolem by using VBA script in AutoCAD. It seems python scripts in Abaques should also work. But the thus obtained stp 3D solid model usually has prolbem in meshing by Abaqus and further analysis.

  • $\begingroup$ Could any of the currently supported 3D Geometry & Modeling Formats be supported by those programmes? $\endgroup$
    – Edmund
    Commented Nov 11, 2016 at 2:46
  • $\begingroup$ No. I checked the same document page, but didnot find one. $\endgroup$ Commented Nov 11, 2016 at 3:46
  • $\begingroup$ It seems AceFEM has a potential solution, but I still doubt it since there is no description about stp conversion in the manual of it $\endgroup$ Commented Nov 11, 2016 at 4:33
  • $\begingroup$ when you say you solved it do you mean you found a way to import mathematica geometry or did you do something completely different? If you found a mathematica-relevant solution you should post it as an answer with more detail. $\endgroup$
    – george2079
    Commented Nov 22, 2016 at 17:09
  • 1
    $\begingroup$ @user6043040 With AceFEM you can do advanced FEM analysis inside Mathematica (using mesh generated by Mathematica or external mesher). But it has no functionality to convert any file formats, like STL to STP. $\endgroup$
    – Pinti
    Commented Jun 19, 2017 at 7:29

1 Answer 1


Mathematia currenlty (Version 12.0) does not provide a functionality to export step files. So a solution will have to happen in the external program used.

Update 12.1:

Through the OpenCascdeLink Mathematica now has some capabilities to import and export step files. Now, STEP is a huge file format with many variants. Here we are talking about AP203 and AP214. Here is an example of an export and an import:


We generate some random cylinders:

n = 15; r = 0.2;
pt1 = RandomReal[{-1, 1}, {n, 3}];
pt2 = RandomReal[{-1, 1}, {n, 3}];
ru = RegionUnion @@ (Cylinder[{pt1[[#]], pt2[[#]]}, r] & /@ 

convert them into the open cascade shape expression:

shape = OpenCascadeShape[ru];

For visualization only we extract a boundary mesh from it:

bmesh = OpenCascadeShapeSurfaceMeshToBoundaryMesh[shape];
  "MeshElementStyle" -> Directive[{FaceForm[LightBlue], EdgeForm[]}]]]

enter image description here

To export the shape use:

OpenCascadeShapeExport["~/test.step", shape]

Here is an example of importing a step file:

path = FileNameJoin[{$OpenCascadeInstallationDirectory, 
shape = OpenCascadeShapeImport[FileNameJoin[{path, "screw.step"}]];

To do something with it we convert it to a boundary element mesh:

bmesh = OpenCascadeShapeSurfaceMeshToBoundaryMesh[shape];
groups = bmesh["BoundaryElementMarkerUnion"];
temp = Most[Range[0, 1, 1/(Length[groups])]];
colors = ColorData["BrightBands"][#] & /@ temp;
bmesh["Wireframe"["MeshElementStyle" -> FaceForm /@ colors]]

enter image description here

  • $\begingroup$ user21, can you clarify if it is possible for one to make a file format converter in WL to take dxf or similar to stp? $\endgroup$ Commented Aug 17, 2019 at 3:37
  • 1
    $\begingroup$ @CATrevillian, I am sure it is possible to do something like this. The question is how much work is one prepared do to set it up. It's probably a larger project. $\endgroup$
    – user21
    Commented Aug 26, 2019 at 9:29
  • 1
    $\begingroup$ @CATrevillian, in version 12.1 is more conceivable: Import the dxf file, extract the graphics primitives and convert them into open cacade shapes to then export as a step file. $\endgroup$
    – user21
    Commented Mar 20, 2020 at 14:12

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.