diff --git a/.gitignore b/.gitignore index 0361774..c757d93 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .DS_Store docgen +docs/.source_hashes diff --git a/.openscad_docsgen_rc b/.openscad_docsgen_rc index 71c0ba8..74e2448 100644 --- a/.openscad_docsgen_rc +++ b/.openscad_docsgen_rc @@ -1,3 +1,10 @@ TargetProfile: githubwiki ProjectName: Metal Library GenerateDocs: Files, TOC, Index, Topics, CheatSheet, Sidebar +SidebarHeader: + ## Indices + . +SidebarMiddle: + [Tutorials](Tutorials) +DefineHeader(BulletList): Side Effects +DefineHeader(Table;Headers=Anchor Name|Position): Extra Anchors diff --git a/Readme.md b/Readme.md index 1517a7e..e872758 100644 --- a/Readme.md +++ b/Readme.md @@ -2,6 +2,8 @@ Libraries for Metal makers +- [Documentation](./docs/metalib.scad.md) + ## Miter tubes module diff --git a/docs/Topics.md b/docs/Topics.md new file mode 100644 index 0000000..c45549b --- /dev/null +++ b/docs/Topics.md @@ -0,0 +1,11 @@ +# Topic Index + +An index of topics, with related functions, modules, and constants. + +**M**: [Metal](#metal) + +### Metal + +- [`miter_profile()`](metalib.scad#module-miter_profile) Mod – Creates a miter profile +- [`miter_tubes()`](metalib.scad#module-miter_tubes) Mod – Generates a sequence of mitered tubes + diff --git a/docs/images/metalib/miter_profile.png b/docs/images/metalib/miter_profile.png index 0f4c282..97e9986 100644 Binary files a/docs/images/metalib/miter_profile.png and b/docs/images/metalib/miter_profile.png differ diff --git a/docs/images/metalib/miter_tubes_2.png b/docs/images/metalib/miter_tubes_2.png new file mode 100644 index 0000000..d71a3f7 Binary files /dev/null and b/docs/images/metalib/miter_tubes_2.png differ diff --git a/docs/metalib.scad.md b/docs/metalib.scad.md index 4ab71d1..c05af0b 100644 --- a/docs/metalib.scad.md +++ b/docs/metalib.scad.md @@ -15,6 +15,8 @@ To use, add the following lines to the beginning of your file: **Synopsis:** Creates a miter profile +**Topics:** [Metal](Topics#metal) + **Usage:** As Module - miter_profile(length,height,depth); @@ -23,6 +25,13 @@ To use, add the following lines to the beginning of your file: Generates a flexible battery holder for 'n' cylindrical batteries with complex features like wire channels, screw holes, and contact points. + +This is the continues content + +**Side Effects:** + +- No side effects registered + **Arguments:** By Position | What it does @@ -46,6 +55,8 @@ Generates a flexible battery holder for 'n' cylindrical batteries with complex f **Synopsis:** Generates a sequence of mitered tubes +**Topics:** [Metal](Topics#metal) + **Description:** This module generates a sequence of mitered tubes based on the provided section lengths, @@ -58,6 +69,9 @@ This module generates a sequence of mitered tubes based on the provided section `section` | An array of section lengths, each specifying the length of an individual tube. Example: `[10, 20, 30]` will create three tubes of lengths 10, 20, and 30 units respectively. `heights` | The height of each tube. This value defines the dimension perpendicular to the tube's length and depth. `depth` | The depth of each tube. This value defines the dimension perpendicular to the tube's length and height. + +By Name | What it does +-------------------- | ------------ `unfold` | Determines whether the sequence of tubes should be unfolded for easier visualization or fabrication. When `true`, the tubes are laid out in a flat arrangement. Defaults to `false`. **Example 1:** Simple Case @@ -77,5 +91,20 @@ This module generates a sequence of mitered tubes based on the provided section

+**Example 2:** Unfolded + +miter\_tubes() Example 2 + + include ; + miter_tubes( + sections = [800,750], + height = 50, + depth = 50, + unfold = false, + quote=true + ); + +

+ --- diff --git a/gen_doc.sh b/gen_doc.sh new file mode 100755 index 0000000..3d0f8d6 --- /dev/null +++ b/gen_doc.sh @@ -0,0 +1 @@ +openscad-docsgen -m -I -P "Metalib" --force diff --git a/metalib.json b/metalib.json new file mode 100644 index 0000000..214bbfc --- /dev/null +++ b/metalib.json @@ -0,0 +1,7 @@ +{ + "fileFormatVersion": "1", + "parameterSets": { + "New set 1": "", + "New set 2": "" + } +} diff --git a/metalib.scad b/metalib.scad index 8aca2fe..e052dbc 100644 --- a/metalib.scad +++ b/metalib.scad @@ -1,19 +1,45 @@ +////////////////////////////////////////////////////////////////////// +// LibFile: metalib.scad +// Includes: +// include ; +// FileGroup: Metal +// FileSummary: Metal, metalon, profile, and geometry. +////////////////////////////////////////////////////////////////////// include ; -/* -section=20; -height=800; -depth=560; -width=563; + +debugging = false; -side_length = 20; // Length of each side of the square -thickness = 3; // Thickness of the material -*/ +/* [Hidden] */ + $fn=32; -module miter_profile(length=200,height=30,depth=20) { + +// Module: miter_profile() +// Synopsis: Creates a miter profile +// Topics: Metal +// Description: +// Generates a flexible battery holder for 'n' cylindrical batteries with complex features like wire channels, screw holes, and contact points. +// +// Continues: +// This is the continues content +// Side Effects: +// No side effects registered +// Usage: As Module +// miter_profile(length,height,depth); +// Arguments: +// length = Length +// height = Height +// depth = Depth +// +// Example: Simple Case +// miter_profile(length=200, height=30, depth=20); + +module miter_profile( length=200, height=30, depth=20 ) { + //cube([50,50,50]); + delta=1; difference() { cuboid([length,depth,height],anchor=CENTER,rounding=1); @@ -24,10 +50,12 @@ module miter_profile(length=200,height=30,depth=20) { translate([length/2, 0, -height/2]) yrot(-45) color([0.5,0.5,0,0.5]) - cube([height, depth+2*delta, height*sqrt(2)+2],anchor=CENTER+LEFT+BOT); + cube([height, depth+2*delta, height*sqrt(2)+2],anchor = CENTER+LEFT+BOT); } } +//miter_profile(length=200, height=30, depth=20); + /** @@ -50,6 +78,8 @@ module miter_profile(length=200,height=30,depth=20) { * for easier visualization or fabrication. When `true`, the tubes are laid out in a flat arrangement. * Defaults to `false`. * + * @param quote - Display quote + * * Internal Variables and Process: * - `moves` (array): Computed positions and rotations for each tube, determined by the `rotSlide` * function applied to the `sections` and `unfold` parameters. @@ -70,13 +100,64 @@ module miter_profile(length=200,height=30,depth=20) { * miter_tubes([10, 20, 30], height=5, depth=3, unfold=true); * ``` */ -module miter_tubes( sections, height, depth, start=true,end=true,unfold=false){ + +// Module: miter_tubes() +// Synopsis: Generates a sequence of mitered tubes +// Topics: Metal +// Description: +// This module generates a sequence of mitered tubes based on the provided section lengths, +// with options for customizing their dimensions and unfolding their arrangement. +// Arguments: +// section = An array of section lengths, each specifying the length of an individual tube. Example: `[10, 20, 30]` will create three tubes of lengths 10, 20, and 30 units respectively. +// heights = The height of each tube. This value defines the dimension perpendicular to the tube's length and depth. +// depth = The depth of each tube. This value defines the dimension perpendicular to the tube's length and height. +// --- +// unfold = Determines whether the sequence of tubes should be unfolded for easier visualization or fabrication. When `true`, the tubes are laid out in a flat arrangement. Defaults to `false`. +// Example: Simple Case +// miter_tubes( +// sections = [800,750,800], +// height = 50, +// depth = 50, +// start=false, +// end=false, +// unfold = false, +// quote=true +// ); +// Example: Unfolded +// miter_tubes( +// sections = [800,750], +// height = 50, +// depth = 50, +// unfold = false, +// quote=true +// ); + +module miter_tubes( sections, height, depth, start=true,end=true,unfold=false,quote=false){ for (index = [0:len(sections)-1]) { length = sections[index]; m = computeSectionPositions( sections, unfold )[index]; translate([m[0],m[1], m[2]]) - yrot(-m[3]) - miter_tube( length, height, depth, start = index==0 ? start : true,end = index==len(sections)-1 ? end : true ); + yrot(-m[3]) { + miter_tube( + length, + height, + depth, + start = index==0 ? start : true, + end = index==len(sections)-1 ? end : true + ); + if (quote) { + dimension(length); + //path = [[0,length], [length,length]]; + path = [[0,-140], [length-5,-140]]; + stroke(path, width=3,endcaps="arrow2",endcap_width=15); + //ext1 = [[0,-140], [length-5,-140]]; + ext1 = [[0,0], [0,-140-40]]; + stroke(ext1, width=3); + ext2 = [[length,0], [length,-140-40]]; + stroke(ext2, width=3); + + } + } } } @@ -111,6 +192,17 @@ module miter_tube(length=200,height=30,depth=20,rounding=2,wall=1.5,start=true,e } +/** + * Dimension + * + */ +module dimension(value) { + fwd(120) + right(value/2) + text(str(value),size=60,font="Saira Stencil One",halign="center"); + +} + /** @@ -152,3 +244,25 @@ function computeSectionPositions(sections, unfold=false) = //miter_tubes([400,500,600,700,800],30,20); //echo ("rotSlide",rotSlide([400,500,600,500])); +if (debugging) { zrot(90) yrot(-90*0) { + miter_tubes( + sections = [800,750,800], + height = 50, + depth = 50, + start=false, + end=false, + unfold = true, + quote=true + ); + back(200) miter_tubes( + sections = [800,750,800], + height = 50, + depth = 50, + start=false, + end=false, + unfold = false, + quote=false + ); + + } +}