Nº 02Tools / Converters

DXF, SVG, STEP and BREP converter

Convert DXF, SVG, planar STEP and BREP files into one another, or into PDF and PNG, many at once and at true size. planex2d reads and writes them in this tab, running on Pyodide/ngapp. Nothing is uploaded.

The converter writes the geometry as it reads it. For more control, such as defeaturing tiny edges or healing gaps and open contours before the file is written, use the contour checker.

No files
Save as

Files

DXF, SVG, planar STEP and BREP files, or a zip of them, found by their content. Click a file to see it.

    Output

    DXF gets the faces as hatches, SVG, PDF and PNG as filled areas. STEP and BREP always hold the faces.

    Add files, then pick the format to save them in.

    Drop DXF, SVG, STEP or BREP files, or a zip of them, onto the sheet, then pick the format at the top. One file is saved as it is, several as one zip.

    Reference

    What the converters do

    planex2d reads each file into exact geometry and writes that geometry in the format you pick.

    Each of these formats has its place in a workflow. DXF is the exchange format of 2D CAD programs and the usual input of laser, waterjet and plasma cutting software. SVG is the format of drawing programs such as Inkscape, of vinyl and laser cutters, and of the web. STEP carries geometry between CAD, CAM and simulation programs, and BREP is the native format of OpenCASCADE, which programs built on it, such as FreeCAD and Gmsh, read. PDF and PNG are for printing and for documents. The converters take a drawing from one of these formats into another without a CAD program, many files at once and at true size.

    Reading

    The format of each file is found from its content, so a file with an unusual or missing extension is read as well. planex2d reads DXF files with ezdxf, SVG files with svgelements, and STEP and BREP files with its own readers. Lines, arcs and circles stay lines, arcs and circles, and splines and ellipses stay exact curves. Each DXF layer and each SVG group is read on its own, so that a center line does not cut the outline it crosses. Within a layer, lines that cross are split where they cross, and a stretch drawn twice is kept once.

    Faces and curves

    A closed outline becomes a face, with the outlines inside it as its holes, and an open line stays a curve. STEP and BREP files hold the faces as planar surfaces and the curves as edges. DXF and SVG files hold the outlines as lines, arcs, circles and splines. With Fill faces, DXF adds each face as a hatch and SVG as a filled path.

    Units

    The drawing keeps its size. A file that names its unit is read in it, and the output counts in the unit you pick. DXF, SVG and STEP files name the unit in the file. BREP names none and simply holds its numbers in the unit you pick. A BREP file, and a DXF file whose header names no unit, is taken as millimeters. An SVG file without a unit counts in CSS pixels of 1/96 inch, as the SVG standard defines them.

    PDF and PNG

    A PDF shows the drawing in black at true size, on a page 10 mm larger than the drawing on every side, so that printed at 100 % it matches the part. A PNG is the same picture on white, 2000 pixels along its longer side. The unit setting does not apply to either.

    Layers and colors

    Each edge keeps its layer and its color. DXF writes them as the layer and its true color, and SVG as a labeled group, which Inkscape shows as a layer, with the stroke color. STEP writes them as the names and colors of its edges and faces. BREP keeps no names or colors.

    Methodology

    How the converters work

    A small page around the planex2d Python library. It runs the same code you get with pip install planex2d, compiled to WebAssembly and loaded with Pyodide/ngapp.

    1. Load

      The page loads Python and planex2d into this tab. Your browser keeps both in its cache, so later visits start faster.

    2. Read

      The browser reads the files you add from your disk into memory and unpacks a zip in the tab. No request carries a file to a server.

    3. Convert

      planex2d finds each file's format from its content, reads it into exact geometry and turns its closed outlines into faces.

    4. Write

      Every file is written in the format you pick. One file is saved as it is, several as one zip, each named after the file it came from.

    Supported files

    FormatReadsWritesNotes
    DXF.dxf.dxfLines, arcs, circles, polylines, splines and ellipses of the model space, by layer. See Files.
    SVG.svg.svgPaths and shapes, by group label. See SVG.
    STEP.step .stp.stepPlanar parts with their names and colors. See STEP and BREP.
    BREP.brep.brepPlanar parts, without names or colors.
    PDF, PNG.pdf .pngThe drawing at true size, for printing and documents.
    Zip.zip.zipEvery DXF, SVG, STEP and BREP file inside is read; several output files are saved as one zip.

    Run it in Python

    Everything the converters do is available in the library. Install it and see Files in the docs for every reader and writer. The example reads the outline layer of a DXF file, without its center lines, and writes the part as STEP and SVG in millimeters.

    $ pip install planex2d
    import planex as px
    
    bracket = px.Face(px.FromDXF("mounting-bracket.dxf", layers=["contour"]))
    bracket.WriteStep("mounting-bracket.step", unit=px.mm)
    bracket.WriteSVG("mounting-bracket.svg", unit=px.mm)

    Privacy

    NOTE

    Nothing is uploaded. Files are read and written in this tab and are gone when you close it. Python, planex2d and its packages come from public package servers (jsDelivr and PyPI). See the privacy notice.

    Limits

    • This tool reads and writes planar STEP and BREP files only: each part lies in one plane.
    • SVG has no exact form for rational splines or splines above degree 3. planex2d writes them as their arc approximation and says so below the file list.
    • Text, dimensions, hatches and images are not read; the converters carry the geometry only.
    • Gaps, open contours and tiny edges stay as they are. The contour checker finds and repairs them.
    • In the browser, planex2d runs in one thread, so large drawings take longer than in Python on your machine.
    • A file that fails? Open an issue on GitHub and attach the file if you can.
    Questions

    Questions and answers

    Are my files uploaded?

    No. The files are read and written in this browser tab by planex2d, running on Pyodide/ngapp, and are gone when you close the tab. Python and its packages come from jsDelivr and PyPI; your files are never sent anywhere.

    How do I convert a DXF file to STEP?

    Drop the DXF file onto the sheet and press STEP. Each closed outline becomes a planar face with the outlines inside it as holes, open lines become curves, and the STEP file counts in millimeters unless you pick another unit.

    Can I convert STEP to DXF?

    Yes, for planar parts: this tool reads and writes planar STEP and BREP files only. The outlines of the faces are written as lines, arcs, circles and splines, with the names the STEP file gives the edges as layers.

    Can I convert many files at once?

    Yes. Add as many DXF, SVG, STEP and BREP files as you like, or a zip of them. One button writes them all in one format and saves them as one zip, each file named after its source.

    Does the drawing keep its size?

    Yes. A file that names its unit is read in it, and the output names the unit you pick. A DXF or BREP file that names no unit is taken as millimeters, an SVG file without one counts in CSS pixels of 1/96 inch. A PDF prints at true size at 100 %.

    Can it repair gaps or tiny edges?

    No. The converter writes the geometry as it reads it. The contour checker finds open contours, gaps, doubled lines and tiny edges and repairs them.

    More tools

    Other tools on planex2d.org

    Every tool runs on the planex2d library, in your browser.

    • Viewer

      DXF, SVG, planar STEP and BREP files shown layer by layer, read by planex2d.

    • Calculator

      Area, centroid, second moments and section moduli of a drawing, and the mass of a sheet part.

    • Contour checker

      Open contours, gaps, doubled lines and tiny edges in DXF, SVG and STEP drawings, marked and repaired.

    • Nesting

      Plies and flat parts placed on a roll for the shortest length, with the fiber direction kept.

    • Playground

      planex2d code in the browser, beside what it prints and draws, shared as a link that carries the code.

    The planex2d documentation shows the library behind the tools, and the homepage lists everything on planex2d.org.