mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-09 08:16:50 +02:00
updated docs
This commit is contained in:
@@ -1,29 +1,35 @@
|
|||||||
# arc
|
# arc
|
||||||
|
|
||||||
Create an arc. You can pass a 2 element vector to define the central angle. Its `$fa`, `$fs` and `$fn` parameters are consistent with the circle module. It depends on the `circular_sector` module so you have to include circular_sector.scad.
|
Creates an arc. You can pass a 2 element vector to define the central angle. Its `$fa`, `$fs` and `$fn` parameters are consistent with the circle module. It depends on the `circular_sector` module so you have to include circular_sector.scad.
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
- `radius` : The radius of the circle.
|
- `radius` : The radius of the circle.
|
||||||
- `angles` : A 2 element vector which defines the central angle. The first element of the vector is the beginning angle in degrees, and the second element is the ending angle.
|
- `angles` : A 2 element vector which defines the central angle. The first element of the vector is the beginning angle in degrees, and the second element is the ending angle.
|
||||||
- `width_mode` : The default value is `"LINE_CROSS"`. The arc line will move outward by `width / 2` and inward by `width / 2`. If it's `"LINE_OUTWARD"`, the arc line moves outward by `width`. The `"LINE_INWARD"` moves the arc line inward by `width`.
|
- `width_mode` : The default value is `"LINE_CROSS"`. The arc line will move outward by `width / 2` and inward by `width / 2`. If it's `"LINE_OUTWARD"`, The arc line moves outward by `width`. The `"LINE_INWARD"` moves the arc line inward by `width`.
|
||||||
- `$fa`, `$fs`, `$fn` : Check [the circle module](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#circle) for more details.
|
- `$fa`, `$fs`, `$fn` : Check [the circle module](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#circle) for more details.
|
||||||
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
include <arc.scad>;
|
||||||
|
|
||||||
$fn = 24;
|
$fn = 24;
|
||||||
arc(radius = 20, angles = [45, 290], width = 2);
|
arc(radius = 20, angles = [45, 290], width = 2);
|
||||||
%circle(r = 20);
|
%circle(r = 20);
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
include <arc.scad>;
|
||||||
|
|
||||||
$fn = 24;
|
$fn = 24;
|
||||||
arc(radius = 20, angles = [45, 290], width = 2, width_mode = "LINE_INWARD");
|
arc(radius = 20, angles = [45, 290], width = 2, width_mode = "LINE_INWARD");
|
||||||
%circle(r = 20);
|
%circle(r = 20);
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
include <arc.scad>;
|
||||||
|
|
||||||
$fn = 24;
|
$fn = 24;
|
||||||
arc(radius = 20, angles = [45, 290], width = 2, width_mode = "LINE_OUTWARD");
|
arc(radius = 20, angles = [45, 290], width = 2, width_mode = "LINE_OUTWARD");
|
||||||
%circle(r = 20);
|
%circle(r = 20);
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
# archimedean_spiral
|
# archimedean_spiral
|
||||||
|
|
||||||
Get all points and angles on the path of an archimedean_spiral. The distance between two points is almost constant.
|
Gets all points and angles on the path of an archimedean_spiral. The distance between two points is almost constant.
|
||||||
|
|
||||||
It returns a vector of `[[x, y], angle]`.
|
It returns a vector of `[[x, y], angle]`.
|
||||||
|
|
||||||
@@ -17,6 +17,7 @@ An `init_angle` less than 180 degrees is not recommended because the function us
|
|||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
include <polyline2d.scad>;
|
include <polyline2d.scad>;
|
||||||
|
include <archimedean_spiral.scad>;
|
||||||
|
|
||||||
points_angles = archimedean_spiral(
|
points_angles = archimedean_spiral(
|
||||||
arm_distance = 10,
|
arm_distance = 10,
|
||||||
@@ -32,6 +33,8 @@ An `init_angle` less than 180 degrees is not recommended because the function us
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
include <archimedean_spiral.scad>;
|
||||||
|
|
||||||
points_angles = archimedean_spiral(
|
points_angles = archimedean_spiral(
|
||||||
arm_distance = 10,
|
arm_distance = 10,
|
||||||
init_angle = 180,
|
init_angle = 180,
|
||||||
@@ -46,6 +49,8 @@ An `init_angle` less than 180 degrees is not recommended because the function us
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
include <archimedean_spiral.scad>;
|
||||||
|
|
||||||
t = "3.141592653589793238462643383279502884197169399375105820974944592307816406286";
|
t = "3.141592653589793238462643383279502884197169399375105820974944592307816406286";
|
||||||
|
|
||||||
points = archimedean_spiral(
|
points = archimedean_spiral(
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
# bend
|
# bend
|
||||||
|
|
||||||
Bend a 3D object into an arc shape.
|
Bends a 3D object into an arc shape.
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
@@ -12,6 +12,8 @@ Bend a 3D object into an arc shape.
|
|||||||
|
|
||||||
The containing cube of the target object should be laid down on the x-y plane. For examples.
|
The containing cube of the target object should be laid down on the x-y plane. For examples.
|
||||||
|
|
||||||
|
include <bend.scad>;
|
||||||
|
|
||||||
x = 9.25;
|
x = 9.25;
|
||||||
y = 9.55;
|
y = 9.55;
|
||||||
z = 1;
|
z = 1;
|
||||||
@@ -23,6 +25,8 @@ The containing cube of the target object should be laid down on the x-y plane. F
|
|||||||
|
|
||||||
Once you have the size of the containing cube, you can use it as the `size` argument of the `bend` module.
|
Once you have the size of the containing cube, you can use it as the `size` argument of the `bend` module.
|
||||||
|
|
||||||
|
include <bend.scad>;
|
||||||
|
|
||||||
x = 9.25;
|
x = 9.25;
|
||||||
y = 9.55;
|
y = 9.55;
|
||||||
z = 1;
|
z = 1;
|
||||||
@@ -36,6 +40,8 @@ Once you have the size of the containing cube, you can use it as the `size` argu
|
|||||||
|
|
||||||
The arc shape is smoother if the `frags` value is larger.
|
The arc shape is smoother if the `frags` value is larger.
|
||||||
|
|
||||||
|
include <bend.scad>;
|
||||||
|
|
||||||
x = 9.25;
|
x = 9.25;
|
||||||
y = 9.55;
|
y = 9.55;
|
||||||
z = 1;
|
z = 1;
|
||||||
|
@@ -11,6 +11,8 @@ Given a set of control points, the bezier function returns points of the Bézier
|
|||||||
|
|
||||||
If you have four control points and combine with the `hull_polyline3d` module:
|
If you have four control points and combine with the `hull_polyline3d` module:
|
||||||
|
|
||||||
|
include <bezier.scad>;
|
||||||
|
|
||||||
t_step = 0.05;
|
t_step = 0.05;
|
||||||
width = 2;
|
width = 2;
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
# box_extrude
|
# box_extrude
|
||||||
|
|
||||||
Create a box (container) from a 2D object.
|
Creates a box (container) from a 2D object.
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
@@ -9,11 +9,15 @@ Create a box (container) from a 2D object.
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
include <box_extrude.scad>;
|
||||||
|
|
||||||
box_extrude(height = 30, shell_thickness = 2)
|
box_extrude(height = 30, shell_thickness = 2)
|
||||||
circle(r = 30);
|
circle(r = 30);
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
include <box_extrude.scad>;
|
||||||
|
|
||||||
box_extrude(height = 30, shell_thickness = 2)
|
box_extrude(height = 30, shell_thickness = 2)
|
||||||
text("XD", size = 40, font = "Cooper Black");
|
text("XD", size = 40, font = "Cooper Black");
|
||||||
|
|
||||||
|
@@ -9,6 +9,8 @@ Sometimes you need all points on the path of a circle. Here's the function. Its
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
include <circle_path.scad>;
|
||||||
|
|
||||||
$fn = 24;
|
$fn = 24;
|
||||||
|
|
||||||
points = circle_path(radius = 50);
|
points = circle_path(radius = 50);
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
# circular_sector
|
# circular_sector
|
||||||
|
|
||||||
Create a circular sector. You can pass a 2 element vector to define the central angle. Its `$fa`, `$fs` and `$fn` parameters are consistent with the circle module.
|
Creates a circular sector. You can pass a 2 element vector to define the central angle. Its `$fa`, `$fs` and `$fn` parameters are consistent with the circle module.
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
@@ -10,6 +10,8 @@ Create a circular sector. You can pass a 2 element vector to define the central
|
|||||||
-
|
-
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
include <circular_sector.scad>;
|
||||||
|
|
||||||
circular_sector(radius = 20, angles = [-50, -150]);
|
circular_sector(radius = 20, angles = [-50, -150]);
|
||||||
translate([-15, 0, 0]) circular_sector(radius = 20, angles = [45, 135]);
|
translate([-15, 0, 0]) circular_sector(radius = 20, angles = [45, 135]);
|
||||||
translate([15, 0, 0]) circular_sector(radius = 20, angles = [45, 135], $fn = 12);
|
translate([15, 0, 0]) circular_sector(radius = 20, angles = [45, 135], $fn = 12);
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
# cylinder_spiral
|
# cylinder_spiral
|
||||||
|
|
||||||
Get all points on the path of a spiral around a cylinder. Its `$fa`, `$fs` and `$fn` parameters are consistent with the `cylinder` module. It depends on the `circle_path` module so you have to include circle_path.scad.
|
Gets all points on the path of a spiral around a cylinder. Its `$fa`, `$fs` and `$fn` parameters are consistent with the `cylinder` module. It depends on the `circle_path` module so you have to include circle_path.scad.
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
# hollow_out
|
# hollow_out
|
||||||
|
|
||||||
Hollow out a 2D object.
|
Hollows out a 2D object.
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
@@ -8,6 +8,8 @@ Hollow out a 2D object.
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
include <hollow_out.scad>;
|
||||||
|
|
||||||
hollow_out(shell_thickness = 1) circle(r = 3, $fn = 48);
|
hollow_out(shell_thickness = 1) circle(r = 3, $fn = 48);
|
||||||
hollow_out(shell_thickness = 1) square([10, 5]);
|
hollow_out(shell_thickness = 1) square([10, 5]);
|
||||||
|
|
||||||
|
@@ -10,6 +10,8 @@ Creates a 3D polyline from a list of `[x, y, z]` coordinates. As the name says,
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
include <hull_polyline3d.scad>;
|
||||||
|
|
||||||
hull_polyline3d(
|
hull_polyline3d(
|
||||||
points = [
|
points = [
|
||||||
[1, 2, 3],
|
[1, 2, 3],
|
||||||
@@ -23,6 +25,8 @@ Creates a 3D polyline from a list of `[x, y, z]` coordinates. As the name says,
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
include <hull_polyline3d.scad>;
|
||||||
|
|
||||||
r = 50;
|
r = 50;
|
||||||
points = [
|
points = [
|
||||||
for(a = [0:180])
|
for(a = [0:180])
|
||||||
|
@@ -13,6 +13,8 @@ Creates a line from two points. When the end points are `CAP_ROUND`, you can use
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
include <line2d.scad>;
|
||||||
|
|
||||||
$fn = 24;
|
$fn = 24;
|
||||||
|
|
||||||
line2d(p1 = [0, 0], p2 = [5, 0], width = 1);
|
line2d(p1 = [0, 0], p2 = [5, 0], width = 1);
|
||||||
|
@@ -13,6 +13,8 @@ Creates a 3D line from two points.
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
include <line3d.scad>;
|
||||||
|
|
||||||
line3d(
|
line3d(
|
||||||
p1 = [0, 0, 0],
|
p1 = [0, 0, 0],
|
||||||
p2 = [10, 2, 10],
|
p2 = [10, 2, 10],
|
||||||
@@ -22,6 +24,8 @@ Creates a 3D line from two points.
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
include <line3d.scad>;
|
||||||
|
|
||||||
line3d(
|
line3d(
|
||||||
p1 = [0, 0, 0],
|
p1 = [0, 0, 0],
|
||||||
p2 = [10, 2, 10],
|
p2 = [10, 2, 10],
|
||||||
@@ -33,6 +37,8 @@ Creates a 3D line from two points.
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
include <line3d.scad>;
|
||||||
|
|
||||||
line3d(
|
line3d(
|
||||||
p1 = [0, 0, 0],
|
p1 = [0, 0, 0],
|
||||||
p2 = [10, 2, 10],
|
p2 = [10, 2, 10],
|
||||||
|
@@ -8,5 +8,7 @@ Parses the string argument as an number. It depends on the `split_str` and the `
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
include <parse_number.scad>;
|
||||||
|
|
||||||
echo(parse_number("10") + 1); // ECHO: 11
|
echo(parse_number("10") + 1); // ECHO: 11
|
||||||
echo(parse_number("-1.1") + 1); // ECHO: -0.1
|
echo(parse_number("-1.1") + 1); // ECHO: -0.1
|
||||||
|
@@ -13,17 +13,23 @@ Creates a polyline from a list of `x`, `y` coordinates. When the end points are
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
include <polyline2d.scad>;
|
||||||
|
|
||||||
$fn = 24;
|
$fn = 24;
|
||||||
polyline2d(points = [[1, 2], [-5, -4], [-5, 3], [5, 5]], width = 1);
|
polyline2d(points = [[1, 2], [-5, -4], [-5, 3], [5, 5]], width = 1);
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
include <polyline2d.scad>;
|
||||||
|
|
||||||
$fn = 24;
|
$fn = 24;
|
||||||
polyline2d(points = [[1, 2], [-5, -4], [-5, 3], [5, 5]], width = 1,
|
polyline2d(points = [[1, 2], [-5, -4], [-5, 3], [5, 5]], width = 1,
|
||||||
endingStyle = "CAP_ROUND");
|
endingStyle = "CAP_ROUND");
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
include <polyline2d.scad>;
|
||||||
|
|
||||||
$fn = 24;
|
$fn = 24;
|
||||||
polyline2d(points = [[1, 2], [-5, -4], [-5, 3], [5, 5]], width = 1,
|
polyline2d(points = [[1, 2], [-5, -4], [-5, 3], [5, 5]], width = 1,
|
||||||
startingStyle = "CAP_ROUND", endingStyle = "CAP_ROUND");
|
startingStyle = "CAP_ROUND", endingStyle = "CAP_ROUND");
|
||||||
|
@@ -12,6 +12,8 @@ Creates a polyline from a list of `[x, y, z]` coordinates. It depends on the `li
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
include <polyline3d.scad>;
|
||||||
|
|
||||||
polyline3d(
|
polyline3d(
|
||||||
points = [
|
points = [
|
||||||
[1, 2, 1],
|
[1, 2, 1],
|
||||||
@@ -25,6 +27,8 @@ Creates a polyline from a list of `[x, y, z]` coordinates. It depends on the `li
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
include <polyline3d.scad>;
|
||||||
|
|
||||||
polyline3d(
|
polyline3d(
|
||||||
points = [
|
points = [
|
||||||
[1, 2, 1],
|
[1, 2, 1],
|
||||||
@@ -39,6 +43,8 @@ Creates a polyline from a list of `[x, y, z]` coordinates. It depends on the `li
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
include <polyline3d.scad>;
|
||||||
|
|
||||||
polyline3d(
|
polyline3d(
|
||||||
points = [
|
points = [
|
||||||
[1, 2, 1],
|
[1, 2, 1],
|
||||||
@@ -54,6 +60,8 @@ Creates a polyline from a list of `[x, y, z]` coordinates. It depends on the `li
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
include <polyline3d.scad>;
|
||||||
|
|
||||||
r = 20;
|
r = 20;
|
||||||
h = 5;
|
h = 5;
|
||||||
fa = 15;
|
fa = 15;
|
||||||
|
@@ -11,6 +11,8 @@ Rotates a point `a` degrees around an arbitrary axis. The rotation is applied in
|
|||||||
|
|
||||||
You can use the code below to create a line.
|
You can use the code below to create a line.
|
||||||
|
|
||||||
|
include <rotate_p.scad>;
|
||||||
|
|
||||||
hull() {
|
hull() {
|
||||||
sphere(1);
|
sphere(1);
|
||||||
rotate([0, -45, 45])
|
rotate([0, -45, 45])
|
||||||
@@ -20,6 +22,8 @@ You can use the code below to create a line.
|
|||||||
|
|
||||||
The following code has the same effect.
|
The following code has the same effect.
|
||||||
|
|
||||||
|
include <rotate_p.scad>;
|
||||||
|
|
||||||
point = [20, 0, 0];
|
point = [20, 0, 0];
|
||||||
a = [0, -45, 45];
|
a = [0, -45, 45];
|
||||||
|
|
||||||
@@ -34,6 +38,8 @@ The following code has the same effect.
|
|||||||
|
|
||||||
The `rotate_p` function is useful in some situations. For examples, you probably want to get all points on the path of a spiral around a sphere.
|
The `rotate_p` function is useful in some situations. For examples, you probably want to get all points on the path of a spiral around a sphere.
|
||||||
|
|
||||||
|
include <rotate_p.scad>;
|
||||||
|
|
||||||
radius = 40;
|
radius = 40;
|
||||||
step_angle = 10;
|
step_angle = 10;
|
||||||
z_circles = 20;
|
z_circles = 20;
|
||||||
|
@@ -12,6 +12,8 @@ The 2D polygon should center at the origin and you have to determine the side le
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
include <stereographic_extrude.scad>;
|
||||||
|
|
||||||
dimension = 100;
|
dimension = 100;
|
||||||
|
|
||||||
render() stereographic_extrude(shadow_side_leng = dimension)
|
render() stereographic_extrude(shadow_side_leng = dimension)
|
||||||
|
@@ -10,5 +10,7 @@ Returns a new string that is a substring of the given string.
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
include <sub_str.scad>;
|
||||||
|
|
||||||
echo(sub_str("helloworld", 0, 5)); // ECHO: "hello"
|
echo(sub_str("helloworld", 0, 5)); // ECHO: "hello"
|
||||||
echo(sub_str("helloworld", 5)); // ECHO: "world"
|
echo(sub_str("helloworld", 5)); // ECHO: "world"
|
||||||
|
Reference in New Issue
Block a user