This commit is contained in:
Sébastien Dante Ursini 2025-02-12 17:47:59 -03:00
parent 2f3c573c19
commit 4c9b382115
10 changed files with 185 additions and 13 deletions

1
.gitignore vendored

@ -1,3 +1,4 @@
.DS_Store
docgen
docs/.source_hashes

@ -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

@ -2,6 +2,8 @@
Libraries for Metal makers
- [Documentation](./docs/metalib.scad.md)
## Miter tubes module

11
docs/Topics.md Normal file

@ -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

Binary file not shown.

Before

(image error) Size: 23 KiB

After

(image error) Size: 23 KiB

Binary file not shown.

After

(image error) Size: 32 KiB

@ -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:**
<abbr title="These args can be used by position or by name.">By&nbsp;Position</abbr> | 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.
<abbr title="These args must be used by name, ie: name=value">By&nbsp;Name</abbr> | 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
<br clear="all" /><br/>
**Example 2:** Unfolded
<img align="left" alt="miter\_tubes() Example 2" src="images/metalib/miter_tubes_2.png" width="320" height="240">
include <metalib.scad>;
miter_tubes(
sections = [800,750],
height = 50,
depth = 50,
unfold = false,
quote=true
);
<br clear="all" /><br/>
---

1
gen_doc.sh Executable file

@ -0,0 +1 @@
openscad-docsgen -m -I -P "Metalib" --force

7
metalib.json Normal file

@ -0,0 +1,7 @@
{
"fileFormatVersion": "1",
"parameterSets": {
"New set 1": "",
"New set 2": ""
}
}

@ -1,19 +1,45 @@
//////////////////////////////////////////////////////////////////////
// LibFile: metalib.scad
// Includes:
// include <metalib.scad>;
// FileGroup: Metal
// FileSummary: Metal, metalon, profile, and geometry.
//////////////////////////////////////////////////////////////////////
include <BOSL2/std.scad>;
/*
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
);
}
}