# Is it possible to create .stp 3D model from Graphics3D ？

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}]


Update

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.

• Could any of the currently supported 3D Geometry & Modeling Formats be supported by those programmes? Nov 11, 2016 at 2:46
• No. I checked the same document page, but didnot find one. Nov 11, 2016 at 3:46
• 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 Nov 11, 2016 at 4:33
• 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. Nov 22, 2016 at 17:09
• @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. Jun 19, 2017 at 7:29

## 1 Answer

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:

Needs["NDSolveFEM"]
Needs["OpenCascadeLink"]


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] & /@
Range[n]);


convert them into the open cascade shape expression:

shape = OpenCascadeShape[ru];


For visualization only we extract a boundary mesh from it:

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


To export the shape use:

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


Here is an example of importing a step file:

path = FileNameJoin[{\$OpenCascadeInstallationDirectory,
"ExampleData"}];
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]]
`

• 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? Aug 17, 2019 at 3:37
• @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. Aug 26, 2019 at 9:29
• @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. Mar 20, 2020 at 14:12