Convert OpenSCAD CSG Files to PLY Meshes
Upload the .csg file that OpenSCAD exports and download a binary PLY triangle mesh of the finished solid, with coordinates in millimeters. Export the CSG from OpenSCAD first: .scad source files are not accepted, and models built with hull(), minkowski() or text() cannot be rebuilt here.
Download Started!
How would you rate your experience with MiConvert?
What happens when a CSG file becomes PLY
A .csg file is what OpenSCAD writes when you export the CSG tree of a design. It is plain text listing primitives such as cube, sphere and cylinder, the matrices that place them, and the union, difference and intersection steps that combine them. It contains no triangles. MeshLab, CloudCompare, Blender and other programs that read PLY expect a finished surface, so the tree has to be evaluated before the shape can be opened there.
MiConvert evaluates it on its servers with FreeCAD 1.1 and FreeCAD's OpenSCAD importer, which parses the CSG text itself instead of calling OpenSCAD. The importer turns the tree into FreeCAD solids. Only the top-level results are exported, so the cutting bodies inside a difference() do not end up in your file. Identical bodies stacked in the same place are written once. The solids are then triangulated and saved as PLY.
Round shapes are handled in a specific way. A cylinder exported with $fn between 3 and 16 becomes a prism with that many sides. Any other value gives an exact cylinder, and spheres are always exact. Exact surfaces are then meshed with a fixed tolerance: 0.1 mm of chord deviation and 0.5 radians (about 29 degrees) between facets. That tolerance is the same for every model and cannot be adjusted. Facets on those curved surfaces therefore follow it, not the $fa and $fs values or a $fn above 16 that you rendered with in OpenSCAD.
The PLY is binary little-endian. It holds vertex positions and triangles, plus one extra per-face integer property named stl that the mesh writer adds. It has no color, so color() statements are not carried over. The numbers are FreeCAD's internal millimeters. PLY stores no unit, so the program that opens the file decides how to interpret them.
People reach for this conversion in a few situations: to bring a parametric OpenSCAD part into MeshLab or CloudCompare (for instance, to compare it against a 3D scan), to feed a research or graphics pipeline that only accepts PLY, or to hand the shape to a colleague who does not use OpenSCAD. If all you need is a print file, OpenSCAD can export STL or 3MF directly.
How to convert a CSG file to PLY
- Open your design in OpenSCAD and choose File > Export > Export as CSG to write the .csg file.
- Search the code for hull(), minkowski(), text(), projection(), import() and surface(). If any are used, the conversion will stop with a message naming them (see the FAQ for the workaround).
- Upload the .csg file on this page. Guests can upload files up to 50 MB and send up to 10 at a time.
- The server builds the solids in FreeCAD and meshes them into PLY. A run that exceeds 10 minutes is stopped.
- Download the .ply and open it in MeshLab, CloudCompare or Blender. If your program assumes meters, scale the model by 0.001 on import.
What this CSG to PLY converter does
- Reads OpenSCAD's exported .csg text with FreeCAD 1.1's own parser; the OpenSCAD program is not run on our servers.
- Exports only the final top-level solids, and writes duplicate bodies that sit in the same place only once.
- Rebuilds spheres and cylinders as exact shapes, except cylinders with $fn of 3 to 16, which stay prisms with that number of sides.
- Meshes every model at the same fixed 0.1 mm / 0.5 radian tolerance, with no setting to change it.
- Writes a compact binary little-endian PLY with coordinates in millimeters.
- Names unsupported operations such as hull() or minkowski() in the error message instead of producing a broken mesh.
Video Tutorial
Are you struggling with how to convert your CSG file to PLY format? Don't worry, in this video I will reveal a super convenient tool to help you change your file extension completely for free without
CSG to PLY questions
Can I upload my .scad file directly?
No. Only the .csg export is accepted, and a .scad file is rejected before it uploads. In OpenSCAD, choose File > Export > Export as CSG and upload that file instead. Variables and Customizer values are already resolved in the exported tree, so the PLY reflects the settings you had when you exported.
Why does my file fail with a message about hull() or minkowski()?
Some operations need OpenSCAD's own geometry engine, which is not installed alongside the FreeCAD importer used here. These are hull(), minkowski(), text(), projection(), import(), surface(), glide() and subdiv(). When the converter meets one of them, it stops and the message names the problem. To work around it, render the model in OpenSCAD (F6) and export a mesh there, such as STL or OFF. MeshLab can then save that mesh as PLY.
The page says it could not read my 3D file. What went wrong?
For a .csg, this usually means the text has a syntax error, for example because the file was cut short or edited by hand. The message is a generic one shared with other 3D formats, so it does not point to the faulty line. Re-export the file from OpenSCAD instead of editing it, and upload the fresh copy.
What does "No valid 3D geometry found" mean for a CSG file?
The converter found nothing it could triangulate. This happens when the model contains only curves and no solids, or when a surface cannot be meshed. If the file really describes flat outlines, the CSG to DXF converter on MiConvert writes the curves instead. For a PLY, give the shape volume in OpenSCAD (for example with linear_extrude()) and export the CSG again.
Will the PLY keep the colors I set with color()?
No. The PLY written here contains geometry only: vertex positions and triangles. If you need per-vertex color, paint or assign it afterward in a mesh editor such as MeshLab or Blender.
Why are curved surfaces smoother or coarser than in OpenSCAD?
OpenSCAD facets curves according to $fn, $fa and $fs. Here, spheres and cylinders whose $fn is not between 3 and 16 are rebuilt as true curved surfaces. They are then meshed to the fixed 0.1 mm / 0.5 radian tolerance, which you cannot change. If you need exactly the facets OpenSCAD produces, export STL or OFF from OpenSCAD instead.
How big will the model be when I open it?
Coordinates come through as millimeters, matching OpenSCAD's usual convention of one unit per millimeter. PLY has no unit field, so a program that works in meters, such as Blender, will show a 20 mm bracket as 20 m. Scale it by 0.001 in that case.
What happens to my CSG file after conversion?
The conversion runs on MiConvert's servers, not in your browser. Your uploaded .csg is removed as soon as the job ends. The PLY stays downloadable for about 4 hours and is then deleted automatically. Anyone who has the download link can use it until then, so share it carefully. File names and conversion outcomes are logged so we can run the service.