mirror of
https://github.com/Irev-Dev/Round-Anything.git
synced 2025-01-17 02:58:14 +01:00
Merge pull request #30 from Irev-Dev/kurt/individual-exampes-29
Add individual examples
This commit is contained in:
commit
bce6705d4c
3
examples/README.md
Normal file
3
examples/README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Round-Anything examples
|
||||||
|
|
||||||
|
These examples are mostly to go with the [library Documentation](https://learn.cadhub.xyz/docs/round-anything/overview) and so are best viewed there.
|
29
examples/beamChain-1.scad
Normal file
29
examples/beamChain-1.scad
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// beamChain example 1
|
||||||
|
|
||||||
|
include <Round-Anything-1.0.4/polyround.scad>
|
||||||
|
|
||||||
|
function beamPoints(r1,r2,rStart=0,rEnd=0)=[[0,0,rStart],[2,8,0],[5,4,r1],[15,10,r2],[17,2,rEnd]];
|
||||||
|
|
||||||
|
linear_extrude(1){
|
||||||
|
|
||||||
|
// chained lines by themselves
|
||||||
|
translate(){
|
||||||
|
radiiPoints=beamPoints(0,0);
|
||||||
|
polygon(polyRound(beamChain(radiiPoints,offset1=0.02, offset2=-0.02),20));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Add some radii to the line transitions
|
||||||
|
translate([0,-7,0]){
|
||||||
|
radiiPoints=beamPoints(2,1);
|
||||||
|
for(i=[0: len(beamPoints(2,1))]){color("red")translate([radiiPoints[i].x,radiiPoints[i].y,0])cylinder(d=0.2, h=1);}
|
||||||
|
polygon(polyRound(beamChain(radiiPoints,offset1=0.02, offset2=-0.02),20));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Give make the lines beams with some thickness
|
||||||
|
translate([0,-7*2,0]){
|
||||||
|
radiiPoints=beamPoints(2,1);
|
||||||
|
polygon(polyRound(beamChain(radiiPoints,offset1=0.5, offset2=-0.5),20));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
21
examples/beamChain-2.scad
Normal file
21
examples/beamChain-2.scad
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// beamChain example 2
|
||||||
|
|
||||||
|
include <Round-Anything-1.0.4/polyround.scad>
|
||||||
|
|
||||||
|
function beamPoints(r1,r2,rStart=0,rEnd=0)=[[0,0,rStart],[2,8,0],[5,4,r1],[15,10,r2],[17,2,rEnd]];
|
||||||
|
|
||||||
|
linear_extrude(1){
|
||||||
|
|
||||||
|
// Add an angle to the start of the beam
|
||||||
|
translate([0,-7*3,0]){
|
||||||
|
radiiPoints=beamPoints(2,1);
|
||||||
|
polygon(polyRound(beamChain(radiiPoints,offset1=0.5, offset2=-0.5, startAngle=45),20));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Put a negative radius at the start for transationing to a flat surface
|
||||||
|
translate([0,-7*4,0]){
|
||||||
|
radiiPoints=beamPoints(2,1,rStart=-0.7);
|
||||||
|
polygon(polyRound(beamChain(radiiPoints,offset1=0.5, offset2=-0.5, startAngle=45),20));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
35
examples/beamChain-3.scad
Normal file
35
examples/beamChain-3.scad
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// beamChain example 3
|
||||||
|
|
||||||
|
include <Round-Anything-1.0.4/polyround.scad>
|
||||||
|
|
||||||
|
function beamPoints(r1,r2,rStart=0,rEnd=0)=[[0,0,rStart],[2,8,0],[5,4,r1],[15,10,r2],[17,2,rEnd]];
|
||||||
|
|
||||||
|
// Define more points for a polygon to be atteched to the end of the beam chain
|
||||||
|
clipP=[[16,1.2,0],[16,0,0],[16.5,0,0],[16.5,1,0.2],[17.5,1,0.2],[17.5,0,0],[18,0,0],[18,1.2,0]];
|
||||||
|
|
||||||
|
linear_extrude(1){
|
||||||
|
// end hook
|
||||||
|
translate([-15,-7*5+3,0]){
|
||||||
|
polygon(polyRound(clipP,20));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attached to the end of the beam chain by dividing the beam paths in forward and return and
|
||||||
|
// concat other polygon inbetween
|
||||||
|
translate([0,-7*6,0]){
|
||||||
|
radiiPoints=beamPoints(2,1);
|
||||||
|
forwardPath=beamChain(radiiPoints,offset1=0.5,startAngle=-15,mode=2);
|
||||||
|
returnPath=revList(beamChain(radiiPoints,offset1=-0.5,startAngle=-15,mode=2));
|
||||||
|
entirePath=concat(forwardPath,clipP,returnPath);
|
||||||
|
polygon(polyRound(entirePath,20));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add transitioning radii into the end polygong
|
||||||
|
translate([0,-7*7-2,0]){
|
||||||
|
radiiPoints=beamPoints(2,1,rEnd=3);
|
||||||
|
forwardPath=beamChain(radiiPoints,offset1=0.5,startAngle=-15,mode=2);
|
||||||
|
returnPath=revList(beamChain(radiiPoints,offset1=-0.5,startAngle=-15,mode=2));
|
||||||
|
entirePath=concat(forwardPath,clipP,returnPath);
|
||||||
|
polygon(polyRound(entirePath,20));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
16
examples/beamChain-4.scad
Normal file
16
examples/beamChain-4.scad
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// beamChain example 4
|
||||||
|
|
||||||
|
include <Round-Anything-1.0.4/polyround.scad>
|
||||||
|
|
||||||
|
function beamPoints(r1,r2,rStart=0,rEnd=0)=[[0,0,rStart],[2,8,0],[5,4,r1],[15,10,r2],[17,2,rEnd]];
|
||||||
|
|
||||||
|
linear_extrude(1){
|
||||||
|
|
||||||
|
translate([0,-7*9,0]){
|
||||||
|
// Define multiple shells from the the one set of points
|
||||||
|
for(i=[0:2]){
|
||||||
|
polygon(polyRound(beamChain(beamPoints(2,1),offset1=-1+i*0.4, offset2=-1+i*0.4+0.25),20));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
13
examples/extrudeWithRadius.scad
Normal file
13
examples/extrudeWithRadius.scad
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// extrudeWithRadius example
|
||||||
|
|
||||||
|
include <Round-Anything-1.0.4/polyround.scad>
|
||||||
|
|
||||||
|
radiiPoints=[
|
||||||
|
[-4, 0, 1 ],
|
||||||
|
[5, 3, 1.5 ],
|
||||||
|
[0, 7, 0.1 ],
|
||||||
|
[8, 7, 10 ],
|
||||||
|
[20, 20, 0.8 ],
|
||||||
|
[10, 0, 10 ]
|
||||||
|
];
|
||||||
|
extrudeWithRadius(3,0.5,0.5,5)polygon(polyRound(radiiPoints,30));
|
10
examples/mirrorPoints.scad
Normal file
10
examples/mirrorPoints.scad
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// mirrorPoints example
|
||||||
|
|
||||||
|
include <Round-Anything-1.0.4/polyround.scad>
|
||||||
|
|
||||||
|
centerRadius=7;
|
||||||
|
points=[[0,0,0],[2,8,0],[5,4,3],[15,10,0.5],[10,2,centerRadius]];
|
||||||
|
mirroredPoints=mirrorPoints(points,0,[0,0]);
|
||||||
|
linear_extrude(1)
|
||||||
|
translate([0,-20,0])
|
||||||
|
polygon(polyRound(mirroredPoints,20));
|
13
examples/polyRoundExtrude.scad
Normal file
13
examples/polyRoundExtrude.scad
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// polyRoundExtrude example
|
||||||
|
|
||||||
|
include <Round-Anything-1.0.4/polyround.scad>
|
||||||
|
|
||||||
|
radiiPoints=[
|
||||||
|
[10, 0, 10 ],
|
||||||
|
[20, 20, 1.1],
|
||||||
|
[8, 7, 10 ],
|
||||||
|
[0, 7, 0.3],
|
||||||
|
[5, 3, 0.1],
|
||||||
|
[-4, 0, 1 ]
|
||||||
|
];
|
||||||
|
polyRoundExtrude(radiiPoints,2,0.5,-0.8,fn=20);
|
13
examples/polyround.scad
Normal file
13
examples/polyround.scad
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// polyRound example
|
||||||
|
|
||||||
|
include <Round-Anything-1.0.4/polyround.scad>
|
||||||
|
|
||||||
|
radiiPoints=[
|
||||||
|
[-4, 0, 1 ],
|
||||||
|
[5, 3, 1.5 ],
|
||||||
|
[0, 7, 0.1 ],
|
||||||
|
[8, 7, 10 ],
|
||||||
|
[20, 20, 0.8 ],
|
||||||
|
[10, 0, 10 ]
|
||||||
|
];
|
||||||
|
linear_extrude(3)polygon(polyRound(radiiPoints,30));
|
25
examples/radii-conflict.scad
Normal file
25
examples/radii-conflict.scad
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// radii conflict example
|
||||||
|
|
||||||
|
include <Round-Anything-1.0.4/polyround.scad>
|
||||||
|
|
||||||
|
//example of radii conflict handling and debuging feature
|
||||||
|
function makeRadiiPoints(r1, r2)=[
|
||||||
|
[0, 0, 0 ],
|
||||||
|
[0, 20, r1 ],
|
||||||
|
[20, 20, r2 ],
|
||||||
|
[20, 0, 0 ]
|
||||||
|
];
|
||||||
|
|
||||||
|
linear_extrude(3){
|
||||||
|
// the squre shape being 20 wide, two radii of 10 both fit into the shape (just)
|
||||||
|
translate([-25,0,0])polygon(polyRound(makeRadiiPoints(10,10),50));
|
||||||
|
|
||||||
|
//radii are too large and are reduced to fit and will be reduce to 10 and 10
|
||||||
|
translate([0,0,0])polygon(polyRound(makeRadiiPoints(30,30),50));
|
||||||
|
|
||||||
|
//radii are too large again and are reduced to fit, but keep their ratios r1 will go from 10 to 4 and r2 will go from 40 to 16
|
||||||
|
translate([25,0,0])polygon(polyRound(makeRadiiPoints(10,40),50));
|
||||||
|
|
||||||
|
//mode 2 = no radii limiting
|
||||||
|
translate([50,0,0])polygon(polyRound(makeRadiiPoints(15,20),50,mode=2));
|
||||||
|
}
|
29
examples/shell2d.scad
Normal file
29
examples/shell2d.scad
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// shell2d example
|
||||||
|
|
||||||
|
include <Round-Anything-1.0.4/polyround.scad>
|
||||||
|
|
||||||
|
module gridpattern(memberW = 4, sqW = 12, iter = 5, r = 3){
|
||||||
|
round2d(0, r)rotate([0, 0, 45])translate([-(iter * (sqW + memberW) + memberW) / 2, -(iter * (sqW + memberW) + memberW) / 2])difference(){
|
||||||
|
square([(iter) * (sqW + memberW) + memberW, (iter) * (sqW + memberW) + memberW]);
|
||||||
|
for (i = [0:iter - 1], j = [0:iter - 1]){
|
||||||
|
translate([i * (sqW + memberW) + memberW, j * (sqW + memberW) + memberW])square([sqW, sqW]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
radiiPoints=[
|
||||||
|
[-4, 0, 1 ],
|
||||||
|
[5, 3, 1.5 ],
|
||||||
|
[0, 7, 0.1 ],
|
||||||
|
[8, 7, 10 ],
|
||||||
|
[20, 20, 0.8 ],
|
||||||
|
[10, 0, 10 ]
|
||||||
|
];
|
||||||
|
|
||||||
|
linear_extrude(1){
|
||||||
|
shell2d(-0.5)polygon(polyRound(radiiPoints,30));
|
||||||
|
translate([0,-10,0])shell2d(-0.5){
|
||||||
|
polygon(polyRound(radiiPoints,30));
|
||||||
|
translate([8,8])gridpattern(memberW = 0.3, sqW = 1, iter = 17, r = 0.2);
|
||||||
|
}
|
||||||
|
}
|
30
examples/translateRadiiPoints.scad
Normal file
30
examples/translateRadiiPoints.scad
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// translateRadiiPoints example
|
||||||
|
|
||||||
|
include <Round-Anything-1.0.4/polyround.scad>
|
||||||
|
|
||||||
|
nutW=5.5; nutH=3; boltR=1.6;
|
||||||
|
minT=2; minR=0.8;
|
||||||
|
function nutCapture(startAndEndRadius=0)=[
|
||||||
|
[-boltR, 0, startAndEndRadius],
|
||||||
|
[-boltR, minT, 0],
|
||||||
|
[-nutW/2, minT, minR],
|
||||||
|
[-nutW/2, minT+nutH, minR],
|
||||||
|
[nutW/2, minT+nutH, minR],
|
||||||
|
[nutW/2, minT, minR],
|
||||||
|
[boltR, minT, 0],
|
||||||
|
[boltR, 0, startAndEndRadius],
|
||||||
|
];
|
||||||
|
linear_extrude(3)translate([-5,0,0])polygon(polyRound(nutCapture(),20));
|
||||||
|
|
||||||
|
negativeNutCapture=translateRadiiPoints(nutCapture(),tran=[5,0]);
|
||||||
|
rotatedNegativeNutCapture=translateRadiiPoints(nutCapture(1),tran=[20,5],rot=90);
|
||||||
|
aSquare=concat(
|
||||||
|
[[0,0,0]],
|
||||||
|
negativeNutCapture,
|
||||||
|
[[20,0,0]],
|
||||||
|
rotatedNegativeNutCapture,
|
||||||
|
[[20,10,0]],
|
||||||
|
[[0,10,0]]
|
||||||
|
);
|
||||||
|
|
||||||
|
linear_extrude(3)polygon(polyRound(aSquare,20));
|
Loading…
x
Reference in New Issue
Block a user