Skip to content
Convert a DXF vector graphics file to HTML 5 <canvas> and/or <svg> drawing primitives
Erlang HTML Shell
Latest commit 9430cf7 Jan 19, 2016 skvamme minor
Failed to load latest commit information.
.gitignore
README Typo in readme Jan 8, 2016
canvas.erl
dxf2js.erl minor Jan 19, 2016
dxf2js.sh New text handling Nov 2, 2013
meter.dxf samples added Nov 27, 2010
meter.html
svg.erl minor Jan 19, 2016
switch.dwg new example drawing switch Dec 29, 2012
switch.dxf new example drawing switch Dec 29, 2012
switch.html
switch_layer_0.html new example drawing switch Dec 29, 2012
switch_layer_svg.html new example drawing switch Dec 29, 2012

README

This Erlang Program converts a DXF (binary or ASCII) to an HTML file. View it in an HTML5-ready browser (Safari, Chromium etc).

The DXF file can be created in QCAD (free) http://www.ribbonsoft.com/en/ , AUTOCAD and other CAD systems. Note that a closed pline will be filled in the HTML file. Entities with higher thickness will be on top in the HTML file.

1. Mirror your drawing in the CAD-app down over the X-axis (X=0)
2. Move the drawing up to it's previous position (up above the X-axis)
3. Save as DXF
4. Undo Move and Miror

Make sure you have compiled the 3 erl-files, the Erlang command is erlc *.erl

In a terminal, type ./dxf2js.sh myfile 0
to create a file myfile.html with a canvas representation of the drawing at layer 0.

In a terminal, type ./dxf2js.sh myfile svg
to create a file myfile.html with a svg representation of the drawing at layer svg.

If you are on a Windows system you have to create a bat-file or run dxf2js module from the erlang console.

If you are using QCAD, set the paper size in Drawing Preferences.
 

The parameters to dxf2js.sh is a dxffilename without extension, and a layername

If the layer name is svg the output format will be svg, all other layers will be in canvas format. This makes it easy to create a combined svg/canvas graphics.
 
You need to download and install Erlang http://www.erlang.org to run this program. After installation, run erlc *.erl in HTML-vector-graphics directory.
 
 
Something went wrong with that request. Please try again.