Skip to content

Commit

Permalink
shelf
Browse files Browse the repository at this point in the history
  • Loading branch information
jw4rd committed May 18, 2017
1 parent eb9b206 commit 391b392
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 46 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[DEMO](http://jw4rd.github.io/table)
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 24 additions & 22 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@


<div id="parameters" style="top:10px;left:10px">

TABLE<br>

&emsp;<select id="size" autocomplete="off">
Expand Down Expand Up @@ -135,20 +136,8 @@
&emsp;&emsp;<input id='radius' type="number" value="1" step="0.0625" autocomplete="off"/><br>

&emsp;top edge overhang<br>
&emsp;&emsp;<input id='overhang' type="number" value="2" step="0.0625" autocomplete="off"/><br>



<!--
-----------------------<br>
&emsp;tool diameter<br>
&emsp;&emsp;<input id='radius' type="number" value="0.25" step="0.125" autocomplete="off"/><br>
&emsp;&emsp;<input id='overhang' type="number" value="2" min="0" step="0.0625" autocomplete="off"/><br>

IMAGES
-->
<p>
&emsp;BOM<br>
&emsp;&emsp;<a title="16 per table 4 per shelf" href="https://www.mcmaster.com/#90910A543">screws</a><br>
Expand All @@ -160,7 +149,7 @@

<div id="notes">
&emsp;note:<br>
&emsp;&emsp;height does not include caster height (2-3/4")
&emsp;&emsp;height does not include caster height (2-3/4")<br>


</div>
Expand Down Expand Up @@ -552,6 +541,10 @@
tableFoot1={cutout:[],holes:[],pockets:[]}
tableFoot2={cutout:[],holes:[],pockets:[]}


tableShelf={cutout:[],holes:[],pockets:[]}
tableShelfBlock={cutout:[],holes:[],pockets:[]}

n=100

for(i=n;i>=0;i--){
Expand Down Expand Up @@ -869,16 +862,25 @@
tableFoot1.holes=[tableFoot2.holes]
tableFoot2.holes=[tableFoot2.holes]

tableShelf.cutout.push({X:-(table.depth/2)+table.overHang+(thickness*2),Y:-(table.depth/2)+table.overHang+(thickness*2)})
tableShelf.cutout.push({X:-(table.depth/2)+table.overHang+(thickness*2),Y:(table.depth/2)-table.overHang-(thickness*2)})
tableShelf.cutout.push({X:(table.depth/2)-table.overHang-(thickness*2),Y:(table.depth/2)-table.overHang-(thickness*2)})
tableShelf.cutout.push({X:(table.depth/2)-table.overHang-(thickness*2),Y:-(table.depth/2)+table.overHang+(thickness*2)})
tableShelf.cutout.push({X:-(table.width/2)+table.overHang+(thickness*2),Y:-(table.depth/2)+table.overHang+(thickness*2)})
tableShelf.cutout.push({X:-(table.width/2)+table.overHang+(thickness*2),Y:(table.depth/2)-table.overHang-(thickness*2)})
tableShelf.cutout.push({X:(table.width/2)-table.overHang-(thickness*2),Y:(table.depth/2)-table.overHang-(thickness*2)})
tableShelf.cutout.push({X:(table.width/2)-table.overHang-(thickness*2),Y:-(table.depth/2)+table.overHang+(thickness*2)})


tableShelfBlock.cutout.push({X:-table.legWidth/4,Y:-1})
tableShelfBlock.cutout.push({X:-table.legWidth/4,Y:1})
tableShelfBlock.cutout.push({X:table.legWidth/4,Y:1})

tableShelfBlock.cutout.push({X:-1,Y:-1})
tableShelfBlock.cutout.push({X:-1,Y:1})
tableShelfBlock.cutout.push({X:1,Y:1})
tableShelfBlock.cutout.push({X:1,Y:-1})
tableShelfBlock.cutout.push({X:table.legWidth/4,Y:0})
tableShelfBlock.cutout.push({X:table.legWidth/4-thickness,Y:0})
tableShelfBlock.cutout.push({X:table.legWidth/4-thickness,Y:-1})


tableShelfBlock.holes.push([])
for(i=n;i>=0;i--){
tableShelfBlock.holes[tableShelfBlock.holes.length-1].push({X:(0)+Math.sin(((Math.PI*2)/n*i))*0.155,Y:(0)+Math.cos(((Math.PI*2)/n*i))*0.155})
}

draw()

Expand Down
43 changes: 19 additions & 24 deletions js/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ function draw(){
ctx.fillStyle="rgba(210,185,160,0.8)"
//ctx.fillStyle="#fff"


//ctx.rect(ctx.canvas.width/2-18,ctx.canvas.height/2-18,36,36)
//ctx.fill()
//ctx.stroke()

/*
for(i=0;i<part.length;i++){
//console.log(part[i].depth)
Expand All @@ -40,16 +40,9 @@ function draw(){
ctx.rect(ctx.canvas.width/2-(part[i].width/2)*sf2,ctx.canvas.height/2-(part[i].height/2)*sf2,part[i].width*sf2,part[i].height*sf2)
}
}
*/

//top
//ctx.rect(ctx.canvas.width/2-(table.width/2)*sf2,ctx.canvas.height/2-(table.depth/2)*sf2,table.width*sf2,table.depth*sf2)
//ctx.rect(ctx.canvas.width/2-(table.width/2)*sf2,ctx.canvas.height/2-(table.depth/2)*sf2,table.width*sf2,table.depth*sf2)
//leg
//ctx.moveTo(ctx.canvas.width/2,ctx.canvas.height/2)
*/

space=1

Expand All @@ -58,10 +51,10 @@ function draw(){
ctx.lineWidth=0.5

ctx.strokeStyle="#000"

//ctx.fillStyle="rgb(210,185,160)"
//ctx.fillStyle="rgb(210,185,160)"


ctx.beginPath()

for(i=0;i<tableTop.cutout.length;i++){
Expand All @@ -71,15 +64,16 @@ function draw(){

ctx.fill()
ctx.stroke()


for(i=0;i<tableTop.pockets.length;i++){

ctx.beginPath()
for(j=0;j<tableTop.pockets[i].length;j++){
ctx.lineTo(tableTop.pockets[i][j].X*sf2,tableTop.pockets[i][j].Y*sf2)
}
ctx.lineTo(tableTop.pockets[i][0].X*sf2,tableTop.pockets[i][0].Y*sf2)
ctx.stroke()

}

//front support
Expand Down Expand Up @@ -119,13 +113,11 @@ function draw(){
}
}


ctx.fill()
ctx.stroke()

//leg1


ctx.beginPath()
for(i=0;i<tableLeg1.cutout.length;i++){
ctx.lineTo((tableLeg1.cutout[i].X+table.width/2+table.legWidth/2+space)*sf2,tableLeg1.cutout[i].Y*sf2)
Expand Down Expand Up @@ -160,15 +152,11 @@ function draw(){
ctx.lineTo((tableLeg2.holes[i][0].X+table.width/2+table.legWidth*2+space)*sf2,tableLeg2.holes[i][0].Y*sf2)
}


ctx.fill()
ctx.stroke()


//foot1



ctx.beginPath()
for(i=0;i<tableFoot1.cutout.length;i++){
ctx.lineTo((tableFoot1.cutout[i].X+table.width/2+table.legWidth*0.75+space)*sf2,(tableFoot1.cutout[i].Y+table.height/2+table.legWidth/4+space)*sf2)
Expand Down Expand Up @@ -208,27 +196,34 @@ function draw(){

//ctx.fillStyle="#0000ff"

/*
//shelf

ctx.beginPath()

for(i=0;i<tableShelf.cutout.length;i++){
ctx.lineTo(tableShelf.cutout[i].X*sf2,(tableShelf.cutout[i].Y)*sf2)
ctx.lineTo(tableShelf.cutout[i].X*sf2,(tableShelf.cutout[i].Y-table.depth+table.overHang+(thickness/2))*sf2)
}
ctx.lineTo(tableShelf.cutout[0].X*sf2,(tableShelf.cutout[0].Y)*sf2)
ctx.lineTo(tableShelf.cutout[0].X*sf2,(tableShelf.cutout[0].Y-table.depth+table.overHang+(thickness/2))*sf2)
ctx.stroke()
ctx.fill()

//block

ctx.beginPath()
for(i=0;i<tableShelfBlock.cutout.length;i++){
ctx.lineTo(tableShelfBlock.cutout[i].X*sf2,(tableShelfBlock.cutout[i].Y)*sf2)
ctx.lineTo((tableShelfBlock.cutout[i].X+table.width/2)*sf2,(tableShelfBlock.cutout[i].Y-(table.depth/2)-2)*sf2)
}
ctx.lineTo((tableShelfBlock.cutout[0].X+table.width/2)*sf2,(tableShelfBlock.cutout[0].Y-(table.depth/2)-2)*sf2)

ctx.moveTo((tableShelfBlock.holes[0][0].X+table.width/2)*sf2,(tableShelfBlock.holes[0][0].Y-(table.depth/2)-2)*sf2)
for(i=0;i<tableShelfBlock.holes[0].length;i++){
ctx.lineTo((tableShelfBlock.holes[0][i].X+table.width/2)*sf2,(tableShelfBlock.holes[0][i].Y-(table.depth/2)-2)*sf2)
}
ctx.lineTo(tableShelfBlock.cutout[0].X*sf2,(tableShelfBlock.cutout[0].Y)*sf2)
ctx.lineTo((tableShelfBlock.holes[0][0].X+table.width/2)*sf2,(tableShelfBlock.holes[0][0].Y-(table.depth/2)-2)*sf2)

ctx.stroke()
ctx.fill()

*/

//points

/*
Expand Down
51 changes: 51 additions & 0 deletions js/make.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,57 @@ function make(){
dxf+= (tableFoot2.pockets[0].Y-(table.depth/2+table.supportWidth/2+partSpace+thickness/2)).toFixed(3) + "\n0\n"
dxf+="SEQEND\n0\n"

//shelf


dxf+="POLYLINE\n8\n0\n62\n0\n70\n1\n0\n"

for(i=0;i<tableShelf.cutout.length;i++){

dxf+="VERTEX\n8\n0\n10\n"
dxf+= tableShelf.cutout[i].X.toFixed(3) + "\n20\n"
dxf+= tableShelf.cutout[i].Y+table.depth-table.overHang+(thickness/2) + "\n0\n"

}
dxf+="VERTEX\n8\n0\n10\n"
dxf+= tableShelf.cutout[0].X.toFixed(3) + "\n20\n"
dxf+= tableShelf.cutout[0].Y+table.depth-table.overHang+(thickness/2) + "\n0\n"

dxf+="SEQEND\n0\n"



dxf+="POLYLINE\n8\n0\n62\n0\n70\n1\n0\n"

for(i=0;i<tableShelfBlock.cutout.length;i++){

dxf+="VERTEX\n8\n0\n10\n"
dxf+= (tableShelfBlock.cutout[i].X+table.width/2).toFixed(3) + "\n20\n"
dxf+= tableShelfBlock.cutout[i].Y+table.depth/2+2 + "\n0\n"

}
dxf+="VERTEX\n8\n0\n10\n"
dxf+= (tableShelfBlock.cutout[0].X+table.width/2).toFixed(3) + "\n20\n"
dxf+= tableShelfBlock.cutout[0].Y+table.depth/2+2 + "\n0\n"

dxf+="SEQEND\n0\n"

dxf+="POLYLINE\n8\n0\n62\n0\n70\n1\n0\n"

for(i=0;i<tableShelfBlock.holes[0].length;i++){

dxf+="VERTEX\n8\n0\n10\n"
dxf+= (tableShelfBlock.holes[0][i].X+table.width/2).toFixed(3) + "\n20\n"
dxf+= tableShelfBlock.holes[0][i].Y+table.depth/2+2 + "\n0\n"

}
dxf+="VERTEX\n8\n0\n10\n"
dxf+= (tableShelfBlock.holes[0][0].X+table.width/2).toFixed(3) + "\n20\n"
dxf+= tableShelfBlock.holes[0][0].Y+table.depth/2+2 + "\n0\n"

dxf+="SEQEND\n0\n"



//end
dxf+="ENDSEC\n0\nEOF"
Expand Down

0 comments on commit 391b392

Please sign in to comment.