title=Battery v3 CAD|code=
// Here we define the user editable parameters:
function getParameterDefinitions() {
return [
{ type: 'float', name: 'nozzle_width', caption: 'Nozzle width', default: 0.4 },
{ type: 'float', name: 'walls', caption: 'Walls', default: 2 },
];
}
function shell(params){
return CSG.cylinder({
start: [0, 0, 0],
end: [0, 0, 65],
radius: (19+wall_thickness*2)/2,
resolution: params.cylresolution
});
}
function batteryyyyyyy(params){
return CSG.cylinder({
start: [0, 0, -1],
end: [0, 0, 66],
radius: 19/2,
resolution: params.cylresolution
});
}
function battery() {
var cube = CSG.cube({
center: [beam_width/2, beam_width/2, (length*beam_width)/2],
radius: [beam_width/2, beam_width/2, (length*beam_width)/2]
});
var holes = [];
for (var i = 0; i < length; i++)
{
holes.push(xHole(i));
holes.push(yHole(i));
}
var beam = cube.subtract(holes);
beam.properties.myConnector = new CSG.Connector([10, 0, 0], [1, 0, 0], [0, 0, 1]);
return beam;
}
function zBeam(length) {
var cube = CSG.cube({
center: [beam_width/2, beam_width/2, (length*beam_width)/2],
radius: [beam_width/2, beam_width/2, (length*beam_width)/2]
});
var holes = [];
for (var i = 0; i < length; i++)
{
holes.push(xHole(i));
holes.push(yHole(i));
}
var beam = cube.subtract(holes);
beam.properties.myConnector = new CSG.Connector([10, 0, 0], [1, 0, 0], [0, 0, 1]);
return beam;
}
function main(params) {
params.cylresolution=(params.quality == "1")? 64:16;
var nozzle_width=params.nozzle_width;
var walls=params.walls;
var wall_thickness=nozzle_width*walls*2;
//for (var j = 0; j < 4; j++){
//return CSG.cylinder({r: 19/2, h: 69}).rotateX(90);
return CSG.cylinder({r: 9.5, h: 65}).rotateX(90);
}