// Original source: https://github.com/CullenJWebb/Cullenect-Labels use <../lib/label-decorations/label-decorations.scad> /* [General Settings] */ //I want to generate... Select_Output=0; // [0:Label, 10:Socket test fit, 11:Socket Negative Volume] //model = "" // ["Cullenect label","Socket test fit","Socket Negative Volume"] // Width in gridfinity units label_width = 1; // .1 // Generate V1 Latches for 1U labels? backward_compatible = true; // Deboss Text? label_deboss = false; /* [Label Text 1] */ // Multi-line text: use \n to split. Distance between line centers as a multiple of font size. Text_Line_Spacing = 1.2; // .1 // Label Text Text1 = "M5*8"; // Text Alignment Text1_Align = "center"; // ["left","center","right"] // Font Size Text1_Font_Size = 4; // .1 // Font Family Text1_Font = "Open Sans"; // [Open Sans, Open Sans Condensed, Ubuntu, Montserrat] // Font Style Text1_Font_Style = "Bold"; // [Regular,Black,Bold,ExtraBol,ExtraLight,Light,Medium,SemiBold,Thin,Italic,Black Italic,Bold Italic,ExtraBold Italic,ExtraLight Italic,Light Italic,Medium Italic,SemiBold Italic,Thin Italic] // Adjust X and Y Position Text1_XY = [0,0]; // .1 /* [Label Text 2] */ // Label Text Text2 = ""; // Text Alignment Text2_Align = "right"; // ["left","center","right"] // Font Size Text2_Font_Size = 4; // .1 // Font Family Text2_Font = "Open Sans"; // [Open Sans, Open Sans Condensed, Ubuntu, Montserrat] // Font Style Text2_Font_Style = "Bold"; // [Regular,Black,Bold,ExtraBol,ExtraLight,Light,Medium,SemiBold,Thin,Italic,Black Italic,Bold Italic,ExtraBold Italic,ExtraLight Italic,Light Italic,Medium Italic,SemiBold Italic,Thin Italic] // Adjust X and Y Position Text2_XY = [-2,0]; // .1 /* [Symbol 1] */ // Symbol shape (set to "none" to omit) Symbol1 = "side_pan"; // [none, hex_rounded, hex_flat, phillips, slotted, torx, square, pozidriv, bit_phillips, bit_slotted, bit_hex, bit_torx, bit_square, bit_pozidriv, side_cap, side_flat, side_pan, side_button, side_hex, washer, nut, printer, magnet, battery] // Symbol Alignment Symbol1_Align = "left"; // ["left","center","right"] // Symbol diameter in mm Symbol1_Size = 7; // .1 // Stroke thickness for symbol details (cross, slot, star arms) Symbol1_Stroke = 1.0; // .1 // Adjust X and Y Position Symbol1_XY = [1,0]; // .1 /* [Symbol 2] */ // Symbol shape (set to "none" to omit) Symbol2 = "hex_rounded"; // [none, hex_rounded, hex_flat, phillips, slotted, torx, square, pozidriv, bit_phillips, bit_slotted, bit_hex, bit_torx, bit_square, bit_pozidriv, side_cap, side_flat, side_pan, side_button, side_hex, washer, nut, printer, magnet, battery] // Symbol Alignment Symbol2_Align = "right"; // ["left","center","right"] // Symbol diameter in mm Symbol2_Size = 7; // .1 // Stroke thickness for symbol details (cross, slot, star arms) Symbol2_Stroke = 1.0; // .1 // Adjust X and Y Position Symbol2_XY = [-2,0]; // .1 /* [Advanced] */ // Increase or decrease resolution of certain details $fs = 0.01; // .01 // Use gridfinity U gridfinity = true; // Width of label in mm labelXmm = 36.0; // .1 // Height of label in mm labelYmm = 11.0; // .1 // Thickness of label in mm labelZmm = 1.2; // .1 /* [Hidden] */ gridfinityX = 42; // Grid size for gridfinity units. labelX = (gridfinity) ? (label_width * gridfinityX) - 6 : labelXmm; labelY = (gridfinity) ? 11 : labelYmm; labelZ = (gridfinity) ? 1.2 : labelZmm; latchX = 0.2; // Width of socket on label walls latchZ = 0.6; // Z-height of wall socket decoration_extrude = 0.4; decoration_z = labelZ - 0.2; // V1 Label with new wall sockets // Will only generate V1 label XY with V2 label Z module Cullenect_Label_V1() { // Variables labelX_v1 = 36; labelY_v1 = 11; $midX1 = 4.695; $midX2 = 10.18; $midlatchX = 1.95; $bottomX1 = 5.395; $bottomX2 = 11.18; $bottomlatchX = 0.95; // Base below socket // Base #1 color("Silver") RoundedCube([$bottomX1, labelY_v1, 0.2], 0.5); // Base #2 translate([$bottomX1 + $bottomlatchX,0,0]) color("Silver") RoundedCube([$bottomX2, labelY_v1, 0.2], 0.5); // Base #3 translate([$bottomX1 + $bottomlatchX + $bottomX2 + $bottomlatchX,0,0]) color("Silver") RoundedCube([$bottomX2, labelY_v1, 0.2], 0.5); // Base #4 translate([$bottomX1 + $bottomlatchX + $bottomX2 + $bottomlatchX + $bottomlatchX + $bottomX2,0,0]) color("Silver") RoundedCube([$bottomX1, labelY_v1, 0.2], 0.5); // Middle along socket // Middle #1 translate([latchX,latchX,0.2]) color("Gray") RoundedCube([$midX1, labelY_v1 - (latchX * 2), 0.6], 0.5); // Middle #2 translate([latchX + $midX1 + $midlatchX,latchX,0.2]) color("Gray") RoundedCube([$midX2, labelY_v1 - (latchX * 2), 0.6], 0.5); // Middle #3 translate([latchX + $midX1 + $midlatchX + $midX2 + $midlatchX,latchX,0.2]) color("Gray") RoundedCube([$midX2, labelY_v1 - (latchX * 2), 0.6], 0.5); // Middle #4 translate([latchX + $midX1 + $midlatchX + $midX2 + $midlatchX + $midX2 + $midlatchX,latchX,0.2]) color("Gray") RoundedCube([$midX1, labelY_v1 - (latchX * 2), 0.6], 0.5); // Top above socket translate([0,0,0.8]) color("Silver") RoundedCube([labelX_v1, labelY_v1, 0.4], 0.5); } // V2 Label without backward compatibility module Cullenect_Label_V2() { // Label base below socket color("Silver") RoundedCube([labelX, labelY, 0.2], 0.5); // Label middle within socket translate([latchX,latchX,0]) color("Gray") RoundedCube([labelX - (latchX * 2), labelY - (latchX * 2), labelZ - 0.2], 0.5); // Label top above socket translate([0,0,0.2 + latchZ]) color("Silver") RoundedCube([labelX, labelY, (labelZ - 0.2) - latchZ], 0.5); } // Module to generate the correct label type module Cullenect_Label() { if (backward_compatible && gridfinity && (label_width == 1)){ Cullenect_Label_V1(); } else { Cullenect_Label_V2(); } } // Combined text + symbol overlay using shared helpers module label_decorations() { color("Gray") { label_text(Text1, text_x(Text1_Align, Text1_XY.x, labelX), (labelY / 2) + Text1_XY.y, decoration_z, Text1_Font_Size, Text1_Font, Text1_Font_Style, Text1_Align, decoration_extrude, Text1_Font_Size * Text_Line_Spacing); label_text(Text2, text_x(Text2_Align, Text2_XY.x, labelX), (labelY / 2) + Text2_XY.y, decoration_z, Text2_Font_Size, Text2_Font, Text2_Font_Style, Text2_Align, decoration_extrude, Text2_Font_Size * Text_Line_Spacing); label_symbol(Symbol1, symbol_x(Symbol1_Align, Symbol1_Size, Symbol1_XY.x, labelX), (labelY / 2) + Symbol1_XY.y, decoration_z, Symbol1_Size, Symbol1_Stroke, decoration_extrude); label_symbol(Symbol2, symbol_x(Symbol2_Align, Symbol2_Size, Symbol2_XY.x, labelX), (labelY / 2) + Symbol2_XY.y, decoration_z, Symbol2_Size, Symbol2_Stroke, decoration_extrude); } } // Join or difference the label and decorations module cullenect_label_text(){ if (label_deboss) { difference() { Cullenect_Label(); label_decorations(); } } else { union() { Cullenect_Label(); label_decorations(); } } } *cullenect_label_text(); // Socket and Socket Negative Variables socket_offset = 0.3; socket_walls = 2; socketX = labelX + socket_offset; socketY = labelY + socket_offset; ribZ = 0.4; // Generate socket module cullenect_socket(){ union(){ difference(){ translate([-socket_walls,-socket_walls,-1]) color("Silver") RoundedCube([labelX + (socket_walls * 2), socketY + (socket_walls * 2), labelZ + 1], 0.2); color("Gray") RoundedCube([socketX, socketY, labelZ + 1], 0.5); } translate([0,0,0.2]) color("Silver") cube([socketX, latchX, ribZ]); translate([0, socketY - latchX,0.2]) color("Silver") cube([socketX, latchX, ribZ]); } } // Generate negative volume of socket module cullenect_socket_negative(){ difference(){ color("Gray") RoundedCube([socketX, socketY, labelZ], 0.5); cullenect_socket(); } } // Vertical socket variables vsocketY = labelZ - latchZ - 0.2; // define starting pos and depth vsocketZ = socketY + 1; // Vertical height with 45 degree ceiling // Generate vertical socket // Unlike the h-socket and label this starts with the negative volume due to easier rounded edges // Rounded edges are needed for the vertical printing of the ribbing module cullenect_vertical_socket() { difference(){ // Create base union(){ cube([socketX, vsocketY / 2, vsocketZ]);// front of socket, no rounding RoundedCube([socketX, vsocketY, vsocketZ], 0.1);// front of socket, rounded inside around rib translate([0,vsocketY,0]) cube([socketX,latchZ,vsocketZ]); // Middle of socket, to be cut away later by rounded cube for rib translate([-0.2,vsocketY + latchZ,0]) RoundedCube([socketX + 0.4, vsocketY, vsocketZ], 0.1); } // Remove rounded ribs translate([-1,vsocketY,0]) RoundedCube([latchX + 1, latchZ, vsocketZ], 0.1); translate([socketX - latchX,vsocketY,0]) RoundedCube([latchX + 1, latchZ, vsocketZ], 0.1); // remove 45 degree top translate([-2,labelZ / 2,vsocketY]) RoundedCube([latchX + 1, latchZ, vsocketZ], 0.1); } } *cullenect_vertical_socket(); // Vertical Socket still under development // Generate Selected Model... module selected_model() { if (Select_Output == 10) {cullenect_socket();} else if (Select_Output == 11) {cullenect_socket_negative();} else {cullenect_label_text();} } selected_model();