TorchTableToolChainTesting: Difference between revisions

From Open Source Ecology
Jump to navigation Jump to search
Line 14: Line 14:
[[file:164_plate.png|400px]]
[[file:164_plate.png|400px]]


First, ignore the holes and draw the rectangular outline in escad:
<pre>
<pre>
/* 164_plate.escad */
/* 164_plate.escad, units=inch */
p164_wd = 13.5;
p164_wd = 13.5;
p164_ln = 30.32;
p164_ln = 30.32;
square([p164_wd, p164_ln]);
holedia = 0.81;
</pre>
inset_x = 1.75;
(Note that I have put dimensions in inches.)
inset_y = 1.5;
difference() {
  square([p164_wd, p164_ln]);
  union() {
    translate([inset_x, inset_y]) circle(holedia/2);
    translate([p164_wd-inset_x, inset_y]) circle(holedia/2);
    translate([inset_x, p164_ln-inset_y]) circle(holedia/2);
    translate([p164_wd-inset_x, p164_ln-inset_y]) circle(holedia/2);
  }
}</pre>
 
run implicitCAD's extopenscad program
run implicitCAD's extopenscad program
<pre>
<pre>
Line 27: Line 36:
</pre>
</pre>


producing
Unfortunately, the out.svg file does not contain any clues that the units are inches, and if we open this file with inkscape it will assume user units are pixels. Based on [http://stackoverflow.com/questions/1346922/svg-and-dpi-absolute-units-and-user-units-inkscape-vs-firefox-vs-imagemagick this posting] I found that user units can be forced to inches by substituting a few lines near the beginning of the svg file. Here is a diff
<pre>
<pre>
<?xml version="1.0" encoding="UTF-8"?>
4c4,10
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
< <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"><g stroke="rgb(0,0,255)" stroke-width="1" fill="none">
    "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
---
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"><g stroke="rgb(0,0,255)" stroke-width="1" fill="none"><polyline points="0.0e0,3.032e1 1.35e1,3.032e1 1.35e1,0.0e0 0.0e0,0.0e0 0.0e0,3.032e1 " /></g></svg>
> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"
>    width="100in"
>    height="100in"
>    viewBox="0 0 100 100"
> >
> >
> <g stroke="rgb(0,0,255)" stroke-width="1" fill="none">
</pre>
</pre>
Now if we simply open out.svg with inkscape, we get a tiny rectangle in the upper left corner:
[[file:is_test1.png]]
Researching svg scaling
* http://stackoverflow.com/questions/1346922/svg-and-dpi-absolute-units-and-user-units-inkscape-vs-firefox-vs-imagemagick

Revision as of 01:44, 3 December 2012

Tool chain experiments for Torch Table programming

Initial tests ChuckH 22:52, 2 December 2012 (CET)

  • environment: Windows XP SP3 laptop
  • software installation
    • inkscape download inkscape 0.48.2, standard Windows exe installer to Program Files/Inkscape
    • 'gcodetools download gcodetools v1.7 here and unpack into Inkscape subdirectory per instructions.
    • implicitCAD
      • Haskell Platform download installer here. Some Haskell packages are not too happy with Windows path name conventions, particularly spaces inside filenames. I installed at C:\Haskell_Platform instead of the default C:\Program Files\Haskell_Platform. However, this may not be necessary.
      • download implicitCAD using cabal (see [instructions]), but it does not build properly. (Unfortunately I did not record exactly my sequence of steps here.)
      • patch implicitCAD files to enable Windows install. File:ImplicitCADWindowsPatch0.docThis patch made it compile for me, at the cost of disabling PNG output (not necessary for our toolchain) and disabling file includes (probably painful; need workaround).

simple test part

164 plate.png

/* 164_plate.escad, units=inch */
p164_wd = 13.5;
p164_ln = 30.32;
holedia = 0.81;
inset_x = 1.75;
inset_y = 1.5;
difference() {
  square([p164_wd, p164_ln]);
  union() {
    translate([inset_x, inset_y]) circle(holedia/2);
    translate([p164_wd-inset_x, inset_y]) circle(holedia/2);
    translate([inset_x, p164_ln-inset_y]) circle(holedia/2);
    translate([p164_wd-inset_x, p164_ln-inset_y]) circle(holedia/2);
  }
}

run implicitCAD's extopenscad program

extopenscad 164_plate.escad out.svg

Unfortunately, the out.svg file does not contain any clues that the units are inches, and if we open this file with inkscape it will assume user units are pixels. Based on this posting I found that user units can be forced to inches by substituting a few lines near the beginning of the svg file. Here is a diff

4c4,10
< <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"><g stroke="rgb(0,0,255)" stroke-width="1" fill="none">
---
> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"
>    width="100in"
>    height="100in"
>    viewBox="0 0 100 100"
> >
> >
> <g stroke="rgb(0,0,255)" stroke-width="1" fill="none">