Simple example using a plane
View article
View summary
Here is a simple example which renders an XY plane, with a preset configuration.
// 3456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789
// ||||||||||| Leave this in place to show the 79-character limit ||||||||||||||
// DETAILS:
/*
Undecorated solid plane, for bottom / lid, the largest in the set.
Decorate it with holes, hinges, dovetails, etc. to attach
In FreeCAD build it in the XY plane, on the printer print it flat
Call it with parameters:
yWidth = the shorter side
xlength = the longer side, optionally multiply by PHI to get the golden mean
listID = preset configurations, to keep track of all variations in production
*/
undecoratedXYPlane(yWidth=60, xLength=60*PHI, listID=1);
module undecoratedXYPlane(yWidth, xLength, zDepth, listID) {
boxList=[ //["chamfer mm","edges=[TOP+FRONT, TOP+LEFT, TOP+RIGHT, TOP+BACK]","Z depth"]
[0.4, 1]
,[0.4,[TOP+FRONT, TOP+LEFT, TOP+RIGHT, TOP+BACK], 1]
,[0.4,[BOT+FRONT, BOT+LEFT, BOT+RIGHT, BOT+BACK], 1]
,[0.5, [FRONT+LEFT, FRONT+RIGHT, BACK+LEFT, BACK+RIGHT],1.01]
];
if(listID) {
cuboid([xLength, yWidth, boxList[listID][2]], chamfer=boxList[listID][0], edges=boxList[listID][1]);
} else {
cuboid([xLength, yWidth, boxList[listID][1]], chamfer=boxList[listID][0]);
}
}
The idea is that every time I need a new type of plane I add it to boxList.
One obvious problem is that the BOSL2 cuboid can only support one chamfer size, and any other plane that needs that should be created in FreeCAD (and exported to OpenSCAD).