<commit_before>svg2nc
======

## About svg2nc

Command line tool to covert scalable vector graphics (svg) files to g-code nc files for a 3-axis nc mill. svg2nc assumes a cylindrical bit. All units are inches.


## Using svg2nc

svg2nc generates imperial unit nc files for a 3-axis mill from an svg file. It's easiest to understand with an example:

<pre>
./svg2nc --verbose             \
  --color-elevation=FF0000:.25 \
  --color-elevation=00FF00:.5  \
  --feed-rate=12               \
  --diameter=.125              \
  --clearance-space=.2         \
  --material-thickness=.5      \
  --svg-file=test-plan.svg     \
  --nc-file=test.nc            \
  --through-elevation=-.003    \
  --max-pass-depth=.3          \
  test.svg
</pre>

This command reads in test.svg and treats red (FF0000) as .25" and green (00FF00) as .5" elevations. The material thickness is explicitly set to .5". No cut will remove more than .3" inches at a time. Deeper cuts are done in passes. While moving, the tool will be lifted .2" above the surface. The results are written to two files: test-plan.svg and test.nc. The former is a svg file depicting the plan which is useful for sanity checking the results.

If no material thickness is specified, svg assumes the material is as thick as the highest elevation given.


## Known Issues and Limitations

svg2nc relies on libsvgtiny to handle svg input. Many paths and basic shapes are supported. Clones are ignored. Layers that are marked hidden are not actually ignored.

Parts place within holes of other parts are cut first.

svg2nc does not support color gradients. The elevation of each path must be uniform.


## Building svg2nc

svg2nc depends on
* Clipper (libpolyclipping-dev on debian).
* Boost (libboost-dev on debian)
* libsvgtiny

The following instructions assume a debian-based system and were tested on Ubuntu 14.04.

### git, g++, Clipper, Boost, Expat, and gperf
Clipper, and Boost are used directly by svg2nc. Expat and gperf are requried by libsvgtiny.
<pre>
$ sudo apt-get install --assume-yes libpolyclipping-dev libboost-dev libexpat1-dev gperf git g++
</pre>

### libsvgtiny
<pre>
$ mkdir tmp; cd tmp

$ git clone git://git.netsurf-browser.org/buildsystem
$ cd buildsystem && sudo make install && cd ..
<commit_msg>clarify readme<commit_after>svg2nc
======

## About svg2nc

Command line tool to covert scalable vector graphics (svg) files to g-code nc files for a 3-axis nc mill. svg2nc assumes a cylindrical bit. All units are inches.


## Using svg2nc

svg2nc generates imperial unit nc files for a 3-axis mill from an svg file. It's easiest to understand with an example:

<pre>
./svg2nc --verbose             \
  --color-elevation=FF0000:.25 \
  --color-elevation=00FF00:.5  \
  --feed-rate=12               \
  --diameter=.125              \
  --clearance-space=.2         \
  --material-thickness=.5      \
  --svg-file=test-plan.svg     \
  --nc-file=test.nc            \
  --through-elevation=-.003    \
  --max-pass-depth=.3          \
  test.svg
</pre>

This command reads in test.svg and treats red (FF0000) as .25" and green (00FF00) as .5" elevations. The material thickness is explicitly set to .5". No cut will remove more than .3" inches at a time. Deeper cuts are done in passes. While moving, the tool will be lifted .2" above the surface. The results are written to two files: test-plan.svg and test.nc. The former is a svg file depicting the plan which is useful for sanity checking the results.

If no material thickness is specified, svg assumes the material is as thick as the highest elevation given.


## Known Issues and Limitations

svg2nc relies on libsvgtiny to handle svg input. Many paths and basic shapes are supported. Notably absent is the svg arc command. Clones are ignored. Layers that are marked hidden are not actually ignored.

Parts placed within holes of other parts are cut first.

svg2nc does not support color gradients. The elevation of each path must be uniform.


## Building svg2nc

svg2nc depends on
* Clipper (libpolyclipping-dev on debian).
* Boost (libboost-dev on debian)
* libsvgtiny

The following instructions assume a debian-based system and were tested on Ubuntu 14.04.

### git, g++, Clipper, Boost, Expat, and gperf
Clipper, and Boost are used directly by svg2nc. Expat and gperf are requried by libsvgtiny.
<pre>
$ sudo apt-get install --assume-yes libpolyclipping-dev libboost-dev libexpat1-dev gperf git g++
</pre>

### libsvgtiny
<pre>
$ mkdir tmp; cd tmp

$ git clone git://git.netsurf-browser.org/buildsystem
$ cd buildsystem && sudo make install && cd ..

{'fraction_non_alphanumeric': 0.08804894035394363, 'fraction_numerical': 0.02359624207996504, 'mean_word_length': 3.0441696113074204, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1131015', 'n_tokens_mistral': 1497, 'n_tokens_neox': 1365, 'n_words': 604}