A Javascript library for scripting format agnostic grahics
an iPath object can currently be rendered into SVG & DXF.
Think of iPath as way to script a pen (laser, milling bit) on sheet.
var length=15; var pan = new iPath().line(15,0).line(pan.length,0).line(0,pan.length) .line(-pan.length,0).line(0, -pan.length) .move(0.45*pan.length,-5).line(0.1*pan.length,0);
document.querySelector("svg g .this") .setAttribute("d", pan.dPath(3, 0.5));
Also use polar coordinates with repitition, like turtle graphics:
var length=150; var gear = new iPath().turtleLine({a: Math.PI/2 , r: length,0)}.repeat(4);
iPath can partially render SVG very easy
When generating a "d-path" use a partial parameter:
var partial=0.56; var gear = new iPath() .turtleLine({a:Math.PI/2,r:length,0}).repeat(4);
document.querySelector("svg g .gear").setAttribute("d", gear.dPath(3, partial));
Arcs(circle segments)
Are problematic in SVG
♥ by CNC.
Can be used in iPath to round line joints.
SVG: a rx ry x-axis-rotation large-arc-flag sweep-flag dx dy iPath: new iPath().line(50,0).fillet(radius).line(0,50);
In combination with polar coordinates and repitition
Creating gears becomes quite simple
Beziers
are troublesome (to say the least) for CNC devices Most CNC devices or software can not handle (well)
are translated to linesegments by iPath
SVG's bezier continuation reflects the last controlpoint
iPath allows the same with a weight parameter
var weight=0.7; wave = new iPath().bezier(450,0,-100, -350,300,-350) .smooth(weight, 0,350,350,350);
Pen continuation is king so reflection is mirroring and reversing
Default reflection line is from current pen position to origin
var mirror = new iPath().line(50,50).fillet(2).line(-100,100)...;
document.querySelector("svg g .mirror").setAttribute("d" , mirror.reflect().dPath(3, partial));
Mirroring & reflection part 2
Optional argument is reflection vector
var mirror = new iPath().line(50,50).fillet(2).line(-100,100)...;
document.querySelector("svg g .mirror").setAttribute("d" , mirror.reflect({x:0,y:1}).dPath(3, partial));
Transforming
iPath's transform operations are equal to SVG's
Transfer
Rotation
Skewing
var heart = new iPath().bezier(-20, -20, -5, -40, 0,-20).mirror()
var rotation, dx, skew = 0;
document.querySelector("svg g .transform").setAttribute("d" , heart.rotate(Math.PI * rotation).skew(sew).dPath({x:dx,y:0}), 3);
CNC: Overcut aka dogbone
Because of radius milling bit, free fillet
But possibly unfit, for pen & hole connections
CNC: Overcut2 aka dogbone
Because of radius milling bit, free fillet
But possibly unfit for pen & hole connections among others
var overcut = new iPath().line(-10,0).overcut(bitradius).line(0,-20).overcut(bitradius).line(10,-20).overcut(bitradius).line(10,20)..overcut(bitradius).line(0,20).overcut(bitradius).line(-10,0);
document.querySelector("svg g .overcut2").setAttribute("d" , heart.rotate(Math.PI * rotation).skew(sew).dPath({x:dx,y:0}), 3);
iPath compared to SVG
Is better readable
has cartesian and polar coordinate system
Is waaaay more flexible with variables and expression
Is extensible with third party made add ons
Problem 3: This stool does not fit
Customize it!
And now it does fit
Since one month in Bijlmer store Tailor Maids
Thank you!
More information on www.stretchsketch.com
This presentation www.stretchsketch.com/presentation