-rw-r--r-- | delta.jscad | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/delta.jscad b/delta.jscad index fd36ba5..489e20d 100644 --- a/delta.jscad +++ b/delta.jscad | |||
@@ -385,87 +385,99 @@ var EFFECTOR = { | |||
385 | radius: fh.screw.d/2 | 385 | radius: fh.screw.d/2 |
386 | })).subtract( CSG.cylinder({ | 386 | })).subtract( CSG.cylinder({ |
387 | start: [0,-this.rmount,1], | 387 | start: [0,-this.rmount,1], |
388 | end: [0,-this.rmount,-fh.w-1], | 388 | end: [0,-this.rmount,-fh.w-1], |
389 | radius: fh.screw.d/2 | 389 | radius: fh.screw.d/2 |
390 | })).setColor([0.3,0.8,0.3,0.9]).rotateZ(-120); | 390 | })).setColor([0.3,0.8,0.3,0.9]).rotateZ(-120); |
391 | } | 391 | } |
392 | }; | 392 | }; |
393 | 393 | ||
394 | function columns() { | 394 | function columns() { |
395 | var rv = [0,1,2].map(function(x) { | 395 | var rv = [0,1,2].map(function(x) { |
396 | return union(vector_char(0,0,String.fromCharCode('A'.charCodeAt(0)+x)).segments.map(function(x) { | 396 | return union(vector_char(0,0,String.fromCharCode('A'.charCodeAt(0)+x)).segments.map(function(x) { |
397 | return rectangular_extrude(x,{w:2,h:1}); | 397 | return rectangular_extrude(x,{w:2,h:1}); |
398 | })).center().rotateX(90).translate([0,50,0]).rotateZ(x*120+120); | 398 | })).center().rotateX(90).translate([0,50,0]).rotateZ(x*120+120); |
399 | }); | 399 | }); |
400 | return union(rv); | 400 | return union(rv); |
401 | } | 401 | } |
402 | 402 | ||
403 | function microswitch() { | 403 | function microswitch() { |
404 | var screw_connector = new CSG.Properties(); | 404 | var screw_connector = new CSG.Properties(); |
405 | var rv = CSG.cube({ center:[0,0,2.5],radius: [19.8/2,6/2,10/2] }).union( | 405 | var rv = CSG.cube({ center:[0,0,2.5],radius: [19.8/2,6/2,10/2] }).union( |
406 | CSG.cube({ center: [2.5,0.5,6], radius: [2/2,3.5/2,5/2] }) | 406 | CSG.cube({ center: [2.5,0.5,6], radius: [2/2,3.5/2,5/2] }) |
407 | ).union( | 407 | ).union( |
408 | [-8,-1,8].map(function(x) { | 408 | [-8,-1,8].map(function(x) { |
409 | return CSG.cube({ center:[x,0,0], radius: [0.6/2,3.2/2,13/2] }) | 409 | return CSG.cube({ center:[x,0,0], radius: [0.6/2,3.2/2,13/2] }) |
410 | }) | 410 | }) |
411 | ).subtract( | 411 | ).subtract( |
412 | [-9.5/2,9.5/2].map(function(x,i) { | 412 | [-9.5/2,9.5/2].map(function(x,i) { |
413 | screw_connector[i] = new CSG.Connector([x,6/2,0],[0,-1,0],[0,0,1]); | 413 | screw_connector[i] = new CSG.Connector([x,6/2,0],[0,-1,0],[0,0,1]); |
414 | return CSG.cylinder({ | 414 | return CSG.cylinder({ |
415 | start: [x,-4,0], end: [x,4,0], | 415 | start: [x,-4,0], end: [x,4,0], |
416 | radius: 2/2 | 416 | radius: 2/2 |
417 | }) | 417 | }) |
418 | }) | 418 | }) |
419 | ); | 419 | ); |
420 | rv.properties.switch_connector = new CSG.Connector([2.5,0.5,6+5/2],[0,0,1],[0,-1,0]); | 420 | rv.properties.switch_connector = new CSG.Connector([2.5,0.5,6+5/2],[0,0,1],[0,-1,0]); |
421 | rv.properties.screw_connector = screw_connector; | 421 | rv.properties.screw_connector = screw_connector; |
422 | rv.properties.microswitch = new CSG.Properties(); | 422 | rv.properties.microswitch = new CSG.Properties(); |
423 | rv.properties.microswitch.size = new CSG.Vector3D( | 423 | rv.properties.microswitch.size = new CSG.Vector3D( |
424 | 19.8,6,10 | 424 | 19.8,6,10 |
425 | ); | 425 | ); |
426 | return rv; | 426 | return rv; |
427 | } | 427 | } |
428 | 428 | ||
429 | function getParameterDefinitions() { | 429 | function getParameterDefinitions() { |
430 | return [{ | 430 | return [{ |
431 | name: 'part', | 431 | name: 'part', |
432 | type: 'choice', | 432 | type: 'choice', |
433 | values: ['platform', 'hinged', 'clamp', 'fanholder', 'alltogethernow'], | 433 | values: [ |
434 | captions: ['Effector platform','Hinged part', 'Clamp', 'Fan holder', 'All together now!'], | 434 | 'platform', |
435 | 'hinged', | ||
436 | 'clamp', | ||
437 | 'fanholder', | ||
438 | 'alltogethernow' | ||
439 | ], | ||
440 | captions: [ | ||
441 | 'Effector platform', | ||
442 | 'Hinged part', | ||
443 | 'Clamp', | ||
444 | 'Fan holder', | ||
445 | 'All together now!' | ||
446 | ], | ||
435 | caption: 'Part', | 447 | caption: 'Part', |
436 | initial: 'alltogethernow' | 448 | initial: 'alltogethernow' |
437 | }]; | 449 | }]; |
438 | } | 450 | } |
439 | 451 | ||
440 | function main(params) { | 452 | function main(params) { |
441 | var e = EFFECTOR.effector(); | 453 | var e = EFFECTOR.effector(); |
442 | var hs = E3DV6.heatsink(); | 454 | var hs = E3DV6.heatsink(); |
443 | hs = hs.connectTo(hs.properties.grove_connector,e.properties.grove_connector,false,0); | 455 | hs = hs.connectTo(hs.properties.grove_connector,e.properties.grove_connector,false,0); |
444 | var ms = microswitch(); | 456 | var ms = microswitch(); |
445 | var hd = EFFECTOR.hinged({ | 457 | var hd = EFFECTOR.hinged({ |
446 | microswitch:ms,effector:e | 458 | microswitch:ms,effector:e |
447 | }); | 459 | }); |
448 | ms = ms.connectTo( | 460 | ms = ms.connectTo( |
449 | ms.properties.screw_connector[0], | 461 | ms.properties.screw_connector[0], |
450 | hd.properties.microswitch_screw_connector[0], | 462 | hd.properties.microswitch_screw_connector[0], |
451 | false, 0); | 463 | false, 0); |
452 | var hdhd = EFFECTOR.split_hinged(hd); | 464 | var hdhd = EFFECTOR.split_hinged(hd); |
453 | var fh = EFFECTOR.fanholder(); | 465 | var fh = EFFECTOR.fanholder(); |
454 | return union({ | 466 | return union({ |
455 | platform: e, | 467 | platform: e, |
456 | hinged: hdhd[1], | 468 | hinged: hdhd[1], |
457 | clamp: hdhd[0], | 469 | clamp: hdhd[0], |
458 | fanholder: fh, | 470 | fanholder: fh, |
459 | alltogethernow: [e,hdhd[0],hdhd[1], columns(),hs,ms,fh] | 471 | alltogethernow: [e,hdhd[0],hdhd[1], columns(),hs,ms,fh] |
460 | }[params.part||'alltogethernow']) | 472 | }[params.part||'alltogethernow']) |
461 | var rv = union( | 473 | var rv = union( |
462 | e, | 474 | e, |
463 | hs, | 475 | hs, |
464 | columns(), | 476 | columns(), |
465 | ///hd, | 477 | ///hd, |
466 | hdhd[0], hdhd[1], | 478 | hdhd[0], hdhd[1], |
467 | ms); | 479 | ms); |
468 | return rv; | 480 | return rv; |
469 | } | 481 | } |
470 | /* vim:set ft=javascript ai: */ | 482 | /* vim:set ft=javascript ai: */ |
471 | 483 | ||