### Call capsule_qtr() Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Example call to the capsule_qtr module with a diameter of 10 and height of 20. ```openscad capsule_qtr( 10, 20 ); ``` -------------------------------- ### Define cutout module using cyl_grid() Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md This example demonstrates how to define a 'cutout' module using cyl_grid() to create perforations on the faces of a box. The parameters control the scaling, cylinder size, spacing, and $fn. ```openscad module cutout(d) { cyl_grid(d, 0.60, 3, 4.8, 6 ); } // Apply our cutout() module to each face we want perforated module cutout_top( d ) { cutout(d); } module cutout_bottom( d ) { cutout(d); } module cutout_left( d ) { cutout(d); } module cutout_right( d ) { cutout(d); } ``` -------------------------------- ### Call capsule() Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Example call to the capsule module with a diameter of 10 and height of 20. ```openscad capsule( 10, 20 ); ``` -------------------------------- ### Include Hingebox Code and Initialize Box Source: https://github.com/sbambach/marksenclosurehelper/blob/master/LETSBUILD-beebox.md This snippet includes the necessary OpenSCAD library and invokes the main `hingedbox` module to create a default box. It's the starting point for any custom box design. ```openscad include hingedbox( box_def ); ``` -------------------------------- ### Create a bottom insert with two X-axis dividers Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md This example demonstrates creating a bottom insert with two dividers along the X-axis and one along the Y-axis. The dividers are positioned using fractional values relative to the box dimensions. ```openscad module insert_bottom( d ) { diecut(d) { dividers(d, [0.25, 0.75], [0.5], d.z); } } ``` -------------------------------- ### Call cylinder_half() Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Example call to the cylinder_half module with a diameter of 10 and height of 20. ```openscad cylinder_half( 10, 20 ); ``` -------------------------------- ### Create a bottom insert with dividers() and diecut() Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md This example shows how to create a bottom insert using the dividers() module to form a cross shape, dividing a box into four sections. The diecut() module is used to trim the dividers to the base box shape. ```openscad module insert_bottom( d ) { diecut(d) { dividers(d, [0.5], [0.5], d.z); } } ``` -------------------------------- ### Create a bottom insert with shorter Y-axis divider Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md This example shows how to create a bottom insert where the division in one dimension is shorter. It calls the dividers() module twice: once for a shorter Y-axis divider and once for full-height X-axis dividers. ```openscad module insert_bottom( d ) { diecut(d) { dividers(d, [], [0.5], d.z / 2 ); dividers(d, [0.25, 0.75], [], d.z); } } ``` -------------------------------- ### Add Text Label to Box Top Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Place a text label on the inside top face of the box by defining the 'decorate_top' module. This example uses linear_extrude to create the text. ```openscad module decorate_top( d ) { #linear_extrude() { text("Snafu" ); } } ``` -------------------------------- ### Create grids and slots with slots(), yslots(), and grid() Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md These modules create grids on one or both dimensions within the center/scaled portion of box 'd'. They are constrained by uneven division, not scaling, and may produce asymmetrical results. 'hsz' defines the gap between walls, and 't' is the wall thickness. ```openscad module slots(d, scl, hsz, t=wall_thick ) module yslots(d, scl, hsz, t=wall_thick ) module grid(d, scl, hsz, t=wall_thick ) d, scl - as above hsz - size of hole (gap between walls) t - thickness of wall (default wall_thick) ``` -------------------------------- ### Create divider walls with dividers() Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md The dividers() module creates divider walls along the X or Y axes within a box 'd'. 'xdiv' and 'ydiv' specify the positions for dividers, 'h' is the wall height, and 't' is the wall thickness. Positions can be absolute units or factors. ```openscad module dividers( d, xdiv, ydiv, h, t=wall_thick ) - create divider walls as defined by xdiv and ydiv lists d - 3vec [x,y,z] box definition xdiv - points along d.x to make dividers high and thick ydiv - same for d.y (either list may be empty.) h - height of wall t - thickness of wall (defaults to wall_thick) ``` -------------------------------- ### Configure Magwart Parameters Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Set global parameters for magwart dimensions, magnet size, and slot rotation. These variables control the physical properties of the magwarts and the magnets they contain. ```openscad magwart_points = []; // as with hinge_zrat; the point at which the magwarts meet in the assembled box magwart_zrat = 0.5; // rotation angle for magnet slot. 0 = straight "down", -45 to +45 are likely useful angles. magwart_slotra = 0; // how far apart the magnets ride when closed. can be <0 to have the magnets peek out the flats magwart_offset=false; // 0-CLEAR; // diameter and height of magnet void (should be 0.3 to 0.6 or so larger than your magnets) magnet_d =6.3; magnet_h =2.3; // width of stress relief slot in magwart, 0 to disable magnet_slot_d = 0.5; // calculated later, default // [round( (magnet_d*1.0)+(wall_thick*2) ), // round( (magnet_d*1.0)+(wall_thick*2) ), // round( magnet_h+(wall_thick*2))] magwart_box = false; ``` -------------------------------- ### Create a grid of cylinders with cyl_grid() Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md The cyl_grid() module creates a grid of cylinders (holes) centered and scaled within box 'd'. 'sz' is the cylinder diameter, 'iv' is the spacing, and 'xfn' is the cylinder $fn. This module scales by rough division and may not fill the area completely. ```openscad module cyl_grid( d, scl, sz, iv, xfn=$fn ) - create a grid of cylinders (holes), center/scaled to box d - [x,y,z] box definition scl - factor to scale by; how much space in to fill sz - size (diameter) of cylinder iv - interval, space between cylinders xfn - cylinder $fn ``` -------------------------------- ### Include and Use Hingedbox Module in OpenSCAD Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Include the hingebox_code.scad library and call the hingedbox function with your box definition. Define variables like box dimensions, wall thickness, and hinge parameters as needed. ```openscad include hingedbox( box_def ); box_def = [60, 35, 20]; wall_thick = 1.2; top_rat = 0.35; lip_rat= 0.05; hinge_points = [0.5]; hinge_len = 22; catch_points=[0.5]; ``` -------------------------------- ### Complete Beebox Configuration Source: https://github.com/sbambach/marksenclosurehelper/blob/master/LETSBUILD-beebox.md This is a complete configuration for a functional beebox, including dimensions, wall thickness, hinge, and catch clasp definitions. ```openscad include hingedbox( box_def ); box_def = [60, 40, 20]; wall_thick = 1.2; top_rat = 0.20; lip_rat= 0.10; hinge_points = [0.5]; hinge_len = 24; catch_points=[0.5]; ``` -------------------------------- ### Define Cutout Modules Source: https://github.com/sbambach/marksenclosurehelper/blob/master/LETSBUILD-beebox.md Defines specific modules for creating cutouts on the top, bottom, left, and right faces of the box by calling the `myperf` module. ```openscad module cutout_top( d ) { myperf(d); } module cutout_bottom( d ) { myperf(d); } module cutout_left( d ) { myperf(d); } module cutout_right( d ) { myperf(d); } ``` -------------------------------- ### Configure Catch Clasp Source: https://github.com/sbambach/marksenclosurehelper/blob/master/example-minitin/README.md To use a catch clasp, comment out the magwart_points variable and uncomment the catch_points definition. Adjust the value for further control. ```plaintext catch_points=[0.5]; //magwart_points = [0.3,0.7]; ``` -------------------------------- ### Catch Clasp Configuration Variables Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Define parameters for catch clasps, controlling their dimensions, tooth shape, and structural properties. Variables set to 'false' are calculated at runtime unless overridden. ```SCAD // where to put catch clasps catch_points = []; // width of catch clasp (<1 * box_def.x, >1 actual units) catch_wide = 0.40; // width of catch clasp bottom (<1 * catch_wide, >1 actual units) catch_wide_bottom = 0.8; // width of tooth / cutout in catch (* catch_wide_bottom) catch_tooth_xrat = 0.7; // where on the bottom height the tooth rides catch_tooth_zrat = 0.3; // thickness of thicker catch bars; and tooth catch_thick = false; //wall_thick * 2; // thickness of catch inner fill catch_inner_thick = false; //wall_thick; // $fn for catch corner sphere shapes catch_fn = 32; // extra height to take from cutout catch_hole_xtra = false; //CLEAR; // space between tooth and catch when closed catch_offset = false; //CLEAR/2; // thickness of catch foot piece catch_foot_thick = false;//catch_thick *2; // width of foot bar grip piece (* catch_wide_bottom) catch_foot_xrat = 1.0; ``` -------------------------------- ### Layout Variables for Visualization and Spacing Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Sets global variables for visualizing ghost assemblies and defining the spacing between printed parts. These flags control visual aids and physical separation. ```openscad // show ghosts, top/bottom and magnets VIS=true; // extra space between top and bottom for printing PART_SPACE= 2; ``` -------------------------------- ### Screw Tower Configuration Parameters Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Defines various parameters for screw towers, including placement, dimensions, hole depth, and optional features. Adjust these to customize screw tower behavior and appearance. ```openscad // points to place screw towers screw_points = []; // boolean, do screwtower in the top or bottom half of the box screwtower_top = true; screwtower_bottom = true; // diameters of screw tower screw_od = 8; screw_id = 3.3; // factor to multiply screw_od by to brace to wall. screw_bspread = 1.3; // how deep the screw hole is (0 for none) screw_deep = 16; // $fn for screw tower outside and inside screw_ofn = 16; screw_ifn = 8; // reduce the size of the bottom of the screw hole a bit screw_id_bottom = false; //(screw_id*0.80); // (bool) have the screw hole go completely through the tower and bottom surface screw_punchbottom = false; // height of slot in screw tower (0 to disable feature) screw_slot_h = 0; // diameter of slot in screw tower screw_slot_d = 0; // extra factor to add to separate slots further or make them closer // (positive values drive the slots further from each other, // negative values bring them closer together screw_slot_xdepth = 0;//(0-CLEAR); ``` -------------------------------- ### Enable Bottom Punching for Screw Towers Source: https://github.com/sbambach/marksenclosurehelper/blob/master/LETSBUILD-beebox.md Set this to true to enable the screw tower to punch through the bottom of the box, allowing for securing with a ziptie. ```python screw_punchbottom = true; ``` -------------------------------- ### Define Hinge Placement and Length Source: https://github.com/sbambach/marksenclosurehelper/blob/master/LETSBUILD-beebox.md Specify the points along the box width where hinges should be placed and the overall length of the hinge. Multiple hinge points can be defined. ```openscad hinge_points = [0.5]; hinge_len = 24; ``` -------------------------------- ### Define Box Wall Thickness and Lid Proportions Source: https://github.com/sbambach/marksenclosurehelper/blob/master/LETSBUILD-beebox.md Configures the wall thickness and the proportional height of the box lid and lip. These parameters control the material usage and how the box halves fit together. ```openscad include hingedbox( box_def ); box_def = [60,40,20]; wall_thick = 1.2; top_rat = 0.20; lip_rat = 0.10; ``` -------------------------------- ### Test Ventilation Module Source: https://github.com/sbambach/marksenclosurehelper/blob/master/LETSBUILD-beebox.md This code snippet shows how to test the `myperf` module by commenting out the `hingedbox` call and invoking `myperf` with the `box_def`. This isolates the ventilation pattern for debugging. ```openscad include //hingedbox( box_def ); // <-- NOTE COMMENTED myperf( box_def); box_def = [60, 40, 20]; wall_thick = 1.2; top_rat = 0.20; lip_rat= 0.10; hinge_points = [0.5]; hinge_len = 24; catch_points=[0.5]; screw_points = [0.4, 0.6]; screw_punchbottom = true; module myperf(d) { cyl_grid(d, 0.60, 3, 4.8, 6 ); } ``` -------------------------------- ### Define Custom Box Insert Modules Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Define modules like insert_top or insert_bottom to add custom structures inside the top or bottom of a box. These modules receive a 'd' parameter defining the full volume of their respective box half. ```openscad module insert_top( d ) {} module insert_bottom( d) {} module decorate_top( d ) {} module decorate_bottom( d ) {} module decorate_left( d ) {} module decorate_right( d ) {} module decorate_front( d ) {} module decorate_back( d ) {} module decorate_top_left( d ) {} module decorate_top_right( d ) {} module decorate_top_front( d ) {} module decorate_top_back( d ) {} module cutout_top( d ) {} module cutout_bottom( d ) {} module cutout_left( d ) {} module cutout_right( d ) {} module cutout_front( d ) {} module cutout_back( d ) {} module cutout_top_left( d ) {} module cutout_top_right( d ) {} module cutout_top_front( d ) {} module cutout_top_back( d ) {} ``` -------------------------------- ### Integrate Cutouts into Box Design Source: https://github.com/sbambach/marksenclosurehelper/blob/master/LETSBUILD-beebox.md This complete script integrates the cutout modules into the main box design. It un-comments the `hingedbox` call and comments out the `myperf` test call, allowing the cutout modules to be applied during the box generation. ```openscad include hingedbox( box_def ); //myperf( box_def ); // <--NOTE box_def = [60, 40, 20]; wall_thick = 1.2; top_rat = 0.20; lip_rat= 0.10; hinge_points = [0.5]; hinge_len = 24; catch_points=[0.5]; screw_points = [0.4, 0.6]; screw_punchbottom = true; module myperf(d) { cyl_grid(d, 0.60, 3, 4.8, 6 ); } module cutout_top( d ) { myperf(d); } module cutout_bottom( d ) { myperf(d); } module cutout_left( d ) { myperf(d); } module cutout_right( d ) { myperf(d); } ``` -------------------------------- ### Hinge Configuration Parameters Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Defines various parameters for customizing the hinges of an enclosure. Adjust these to control hinge placement, size, and structural integrity. Ensure hinge_id is suitable for your chosen screw or zip tie. ```openscad // height of hinge axis; % of total height (aka dz or box_def[2] ) hinge_zrat = 0.70; // points along width (x) to place hinges, leave empty for none hinge_points = [ ]; // length of single hinge; splits top/bottom by hinge_xrat // anything under 10 is probably too delicate to use hinge_len = 16; // how much hinge_len is bottom tower. (>1 taken as a concrete unit) // ( the hinge top splits the rest in half, on the outside of the lower hinge) hinge_xrat = 0.33; // if you want to separate the hinge towers from the box body hinge_standoff = 0; // where the hinge leg bends (z), % of hinge height hinge_midpoint = 0.5; // where the hinge leg ends. <1 * lz, >1 taken absolute. hinge_basepoint_bottom = 0; hinge_basepoint_top = 0; // diameter of hinge root cylinder hinge_root_d = false; // hinge_id; // the diameter of the outer hinge cylinder hinge_od = 8; // hinge_id of 3.8 to 4.0 works for m3 screw and 4in ziptie hinge_id = 4.0; // size of hole to put through hinge_midpoint; 0 to disble hinge_mid_hole = 0; // outer $fn for hinge, and inner $fn for hinge pin hole // keep outer high; hinges rub the other half of the box without standoff hinge_ofn = 36; hinge_ifn = 8; // Zip tie notches // if nonzero, take a cubical notch this size from the top hinge outside faces hinge_ztnotch = 0; ``` -------------------------------- ### Define Catch Clasp Placement Source: https://github.com/sbambach/marksenclosurehelper/blob/master/LETSBUILD-beebox.md Determine the placement of the catch clasp on the box. A value of 0.5 centers the clasp at half the box width. ```openscad catch_points = [0.5]; ``` -------------------------------- ### Define Cylinder Half Module Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Defines the cylinder_half module for creating a half-cylinder shape. It takes diameter, height, and optional $fn as parameters. ```openscad module cylinder_half( cd, ch, cfn=$fn ) ``` -------------------------------- ### Center and scale children within a box with center_scale() Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md The center_scale() module centers and scales children within a box defined by 'd' using the 'scl' factor. Note that this uses resize(), which may be slow. Consider the 'auto' flag on OpenSCAD's resize function for more advanced scaling. ```openscad module center_scale( d, scl ) {} - X/Y centers and scales children in box . NOTE uses resize() so may be slow. d - [x,y,z] box definition scl - factor by which to multiply d for scaling. ``` -------------------------------- ### Create Wartclip Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Generates a clip shape based on a distorted quarter sphere. Adjust `thick` for clip body thickness and `ra` for rotation. ```plaintext module wartclip( bd, thick, ra=0 ) { bd - bounding box thick - how thick the clip part is (at the top of the bounding box) ra - rotation angle to apply to clip body. 0 is parallel, ~ 10 will have the tip touching base level } ``` -------------------------------- ### Scale and Center Text Label on Box Top Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Use the 'center_scale' utility function to scale and center a text label on the inside top face of the box. The second parameter to center_scale controls the scaling factor. ```openscad module decorate_top( d ) { center_scale( d, 0.42 ) { linear_extrude() { text("Snafu" ); } } } ``` -------------------------------- ### Box Definition Variables Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Defines the primary dimensions, wall thickness, lid proportions, corner details, and clearance for the enclosure. These variables are fundamental to the box's geometry and assembly. ```openscad // width (x), depth (y), height (z) box_def = [60, 30, 30]; // wall thickness (all around) wall_thick = 2; // how much height (z) is top (rest is bottom) top_rat = 0.15; // height (z) of lid lip overlap chamfer (0 to disable). // (should be less than top_rat) lip_rat= 0; // box corner radius corner_radius = 8; // box corner $fn corner_fn = 16; //nut inset dia and nut inset thick (depth) // used in hinge and screw tower, disable by setting hnut_t = 0 hnut_d = 6; hnut_t = 0; // space between hinge parts, top/bottom screw towers CLEAR=0.6; ``` -------------------------------- ### Define Capsule Quarter Module Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Defines the capsule_qtr module for creating a quarter-capsule shape. It takes diameter, height, and optional $fn as parameters. This is the default catch clasp tooth. ```openscad module capsule_qtr( cd, ch, cfn=$fn ) ``` -------------------------------- ### Trim objects to a base box shape with diecut() Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Use diecut() to trim child objects to the shape of a base box defined by 'd'. This is useful for creating neat internal inserts or decorative rounded corners. Adjust 'd.z' if objects are cut too short. ```openscad module diecut(d) {} - trims child objects to the base_box shape described by d - [x,y,z] box definition ``` -------------------------------- ### Define Hinged Box Half Module Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Builds either the top or bottom half of a box based on a boolean flag. This module contains the core logic for constructing the box halves. ```openscad hingedbox_half( d, topflag=false) {} ``` -------------------------------- ### Create Dovetail Block Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Constructs a block with a dovetail void. The `clr` parameter adjusts the void size to control joint tightness. ```plaintext module dovetail_block( d, dtspec, clr=CLEAR ) d - block desc (outside of notch) dtspec - dovetail profile, see dovetail_rail() note: no taper is taken from the notch shape ``` -------------------------------- ### Define Hinged Box Module Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Defines the main module for creating a hinged box. It can optionally show ghost assemblies and add space between parts. ```openscad module hingedbox( d ) {} ``` -------------------------------- ### Define Cylinder Grid Module Source: https://github.com/sbambach/marksenclosurehelper/blob/master/LETSBUILD-beebox.md Defines a module to generate a pattern of cylinders for ventilation. `d` is the box definition, 0.60 is the cylinder scale, 3 is the cylinder diameter, 4.8 is the spacing, and 6 is the cylinder facet count. ```openscad module myperf(d) { cyl_grid(d, 0.60, 3, 4.8, 6 ); } ``` -------------------------------- ### Create Dovetail Rail Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Generates a dovetail rail of a specified length and profile. The `tpr` and `tbk` parameters control tapering. ```plaintext module dovetail_rail( tlen, dtspec ) tlen - block length dtspec = [height, top_wide, bottom_wide, taper=0, breakpt=0] dovetail profile tpr - (=0) taper subtracted from one end. make negative to reverse tbk - (=0) point along length to begin tapering off ``` -------------------------------- ### Define Screw Tower Positions Source: https://github.com/sbambach/marksenclosurehelper/blob/master/LETSBUILD-beebox.md Specify the relative positions for screw towers along the box's length. These are fractions between 0 and 1. ```python screw_points = [0.4, 0.6]; ``` -------------------------------- ### Define Custom Catch Tooth Shape Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Allows for a custom definition of the catch tooth shape using the capsule_qtr module. This provides flexibility in designing the tooth's geometry. ```SCAD module catch_tooth_shape( cd, ch, cfn ) { capsule_qtr( cd, ch, cfn ); } ``` -------------------------------- ### Define Box Dimensions Source: https://github.com/sbambach/marksenclosurehelper/blob/master/LETSBUILD-beebox.md Sets the external dimensions (width, depth, height) for the bee box. These values determine the overall size of the enclosure. ```openscad include hingedbox( box_def ); box_def = [60,40,20]; ``` -------------------------------- ### Define Capsule Module Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Defines the capsule module for creating a capsule shape. It takes diameter, height, and optional $fn as parameters. ```openscad module capsule( cd, ch, cfn=$fn ) ``` -------------------------------- ### Define Custom Magwart Box Dimensions Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Override the default calculation for magwart box dimensions. This allows for stretching the magwarts to fit specific box designs, especially when lid and bottom features do not align perfectly. ```openscad magwart_box= [ round( (magnet_d*2.0)+(wall_thick*2) ), round( (magnet_d*1.5)+(wall_thick*2) ), round( magnet_h+(wall_thick*2))]; ``` -------------------------------- ### Define Custom Magwart Shape Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Override the default magwart shape by defining a custom `magwart_shape` module. This allows for non-standard pocket shapes, such as cubes, by passing the calculated `magwart_box` dimensions. ```openscad module magwart_shape(d) { qwart(d); } ``` ```openscad module magwart_shape(d) { cube(d); } ``` -------------------------------- ### Define Dovetail Shape Specification Source: https://github.com/sbambach/marksenclosurehelper/blob/master/REFERENCE.md Defines the parameters for a dovetail shape. Adjust `taper` and `breakpt` for custom profiles. ```plaintext dtspec = [height, top_wide, bottom_wide, taper=0, breakpt=0] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.