Skip to content

Commit

Permalink
2d shelf update
Browse files Browse the repository at this point in the history
  • Loading branch information
jw4rd committed Sep 21, 2017
1 parent 1696b71 commit 82b19e4
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 46 deletions.
21 changes: 10 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
&emsp;&emsp;dxf does not yet include dogbone fillets<br>
&emsp;&emsp;tool: 1/4" 2-flute upcut, 1/4" cut depth, 1.5"/sec<br>
&emsp;&emsp;pocket interior shapes of table top<br>
&emsp;&emsp;shelf parts included in dxf<br>

</div>

</div>
Expand Down Expand Up @@ -203,9 +203,6 @@
//TODO
//
//
//
//shelf 3d
//

//
//dogbones
Expand All @@ -224,7 +221,7 @@


document.getElementById('2D').checked=false
//document.getElementById('shelf').checked=false
document.getElementById('shelf').checked=false


var scene = new THREE.Scene()
Expand Down Expand Up @@ -897,6 +894,13 @@
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)})

//pocket shelf blocks
//tableShelf.pockets.push([])
//tableShelf.pockets[tableShelf.pockets.length-1].push({X:-1,Y:1})
//tableShelf.pockets[tableShelf.pockets.length-1].push({X:1,Y:1})
//tableShelf.pockets[tableShelf.pockets.length-1].push({X:1,Y:-1})
//tableShelf.pockets[tableShelf.pockets.length-1].push({X:-1,Y:-1})
//console.log(tableShelf)

tableShelfBlock.cutout.push({X:-table.legWidth/4,Y:-1})
tableShelfBlock.cutout.push({X:-table.legWidth/4,Y:1})
Expand Down Expand Up @@ -924,26 +928,21 @@
makePart(tableLeg2,"leg2.3")
makePart(tableLeg2,"leg2.4")



makePart(tableFoot1,"foot1")
makePart(tableFoot1,"foot1.2")
makePart(tableFoot1,"foot1.3")
makePart(tableFoot1,"foot1.4")


makePart(tableFoot2,"foot2")
makePart(tableFoot2,"foot2.2")
makePart(tableFoot2,"foot2.3")
makePart(tableFoot2,"foot2.4")


makePart(tableSupportFront,"support1")
makePart(tableSupportFront,"support1-b")
makePart(tableSupportSide,"support2")
makePart(tableSupportSide,"support2-l")


makePart(tableShelf,"shelf")

makePart(tableShelfBlock,"shelfB1")
Expand Down Expand Up @@ -1538,7 +1537,7 @@

}
else{
console.log(type)
//console.log(type)
}


Expand Down
49 changes: 41 additions & 8 deletions js/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function draw(){
*/

space=1
space=2

ctx.translate(ctx.canvas.width/2,ctx.canvas.height/2)

Expand All @@ -63,6 +63,8 @@ function draw(){

ctx.fill()
ctx.stroke()

ctx.strokeStyle="#0000aa"

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

Expand All @@ -75,6 +77,9 @@ function draw(){

}


ctx.strokeStyle="#000"

//front support

ctx.beginPath()
Expand Down Expand Up @@ -188,41 +193,69 @@ function draw(){

ctx.moveTo((tableFoot2.pockets[0].X+table.width/2+table.legWidth*2+space-+table.legWidth*0.25)*sf2,(tableFoot2.pockets[0].Y+table.height/2+table.legWidth/4+space)*sf2)

ctx.strokeStyle="#0000aa"

for(i=0;i<tableFoot2.pockets.length;i++){
ctx.lineTo((tableFoot2.pockets[i].X+table.width/2+table.legWidth*2+space-+table.legWidth*0.25)*sf2,(tableFoot2.pockets[i].Y+table.height/2+table.legWidth/4+space)*sf2)
}
ctx.stroke()

ctx.strokeStyle="#000"

//ctx.fillStyle="#0000ff"

//shelf
if(document.getElementById('shelf').checked==true){

ctx.beginPath()

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


ctx.strokeStyle="#0000aa"

if(tableShelf.pockets.length>0){

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

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

}

}


ctx.strokeStyle="#000"

//block

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

ctx.moveTo((tableShelfBlock.holes[0][0].X+table.width/2)*sf2,(tableShelfBlock.holes[0][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-space)*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.holes[0][i].X+table.width/2)*sf2,(tableShelfBlock.holes[0][i].Y-(table.depth/2)-2-space)*sf2)
}
ctx.lineTo((tableShelfBlock.holes[0][0].X+table.width/2)*sf2,(tableShelfBlock.holes[0][0].Y-(table.depth/2)-2)*sf2)
ctx.lineTo((tableShelfBlock.holes[0][0].X+table.width/2)*sf2,(tableShelfBlock.holes[0][0].Y-(table.depth/2)-2-space)*sf2)

ctx.stroke()
ctx.fill()

}

//points

/*
Expand Down
63 changes: 36 additions & 27 deletions js/make.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function make(){

partSpace=1
partSpace=2

dxf = "0\nSECTION\n2\nENTITIES\n999\nw4rd.com\n0\n"

Expand Down Expand Up @@ -207,52 +207,61 @@ function make(){
dxf+="SEQEND\n0\n"

//shelf
////


if(document.getElementById('shelf').checked==true){

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

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

for(i=0;i<tableShelf.cutout.length;i++){
dxf+="VERTEX\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\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+= tableShelf.cutout[0].X.toFixed(3) + "\n20\n"
dxf+= tableShelf.cutout[0].Y+table.depth-table.overHang+(thickness/2) + "\n0\n"

}
dxf+="VERTEX\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+="SEQEND\n0\n"
dxf+="POLYLINE\n8\nshelf_block\n62\n200\n70\n1\n0\n"

dxf+="POLYLINE\n8\nshelf_block\n62\n208\n70\n1\n0\n"
for(i=0;i<tableShelfBlock.cutout.length;i++){

for(i=0;i<tableShelfBlock.cutout.length;i++){
dxf+="VERTEX\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\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+= (tableShelfBlock.cutout[0].X+table.width/2).toFixed(3) + "\n20\n"
dxf+= tableShelfBlock.cutout[0].Y+table.depth/2+2 + "\n0\n"

}
dxf+="VERTEX\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+="SEQEND\n0\n"
dxf+="POLYLINE\n8\nshelf_block\n62\n200\n70\n1\n0\n"

dxf+="POLYLINE\n8\nshelf_block\n62\n208\n70\n1\n0\n"
for(i=0;i<tableShelfBlock.holes[0].length;i++){

for(i=0;i<tableShelfBlock.holes[0].length;i++){
dxf+="VERTEX\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\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+= (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"

}
dxf+="VERTEX\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 82b19e4

Please sign in to comment.