1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-01 04:20:27 +02:00

updated docs

This commit is contained in:
Justin Lin
2017-03-30 14:22:48 +08:00
parent ca5f3904c8
commit 54eb382ff6
18 changed files with 75 additions and 8 deletions

View File

@@ -1,29 +1,35 @@
# 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
- `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.
- `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.
## Examples
include <arc.scad>;
$fn = 24;
arc(radius = 20, angles = [45, 290], width = 2);
%circle(r = 20);
![arc](images/lib-arc-1.JPG)
include <arc.scad>;
$fn = 24;
arc(radius = 20, angles = [45, 290], width = 2, width_mode = "LINE_INWARD");
%circle(r = 20);
![arc](images/lib-arc-2.JPG)
include <arc.scad>;
$fn = 24;
arc(radius = 20, angles = [45, 290], width = 2, width_mode = "LINE_OUTWARD");
%circle(r = 20);

View File

@@ -1,6 +1,6 @@
# 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]`.
@@ -17,6 +17,7 @@ An `init_angle` less than 180 degrees is not recommended because the function us
## Examples
include <polyline2d.scad>;
include <archimedean_spiral.scad>;
points_angles = archimedean_spiral(
arm_distance = 10,
@@ -32,6 +33,8 @@ An `init_angle` less than 180 degrees is not recommended because the function us
![archimedean_spiral](images/lib-archimedean_spiral-1.JPG)
include <archimedean_spiral.scad>;
points_angles = archimedean_spiral(
arm_distance = 10,
init_angle = 180,
@@ -46,6 +49,8 @@ An `init_angle` less than 180 degrees is not recommended because the function us
![archimedean_spiral](images/lib-archimedean_spiral-2.JPG)
include <archimedean_spiral.scad>;
t = "3.141592653589793238462643383279502884197169399375105820974944592307816406286";
points = archimedean_spiral(

View File

@@ -1,6 +1,6 @@
# bend
Bend a 3D object into an arc shape.
Bends a 3D object into an arc shape.
## 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.
include <bend.scad>;
x = 9.25;
y = 9.55;
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.
include <bend.scad>;
x = 9.25;
y = 9.55;
z = 1;
@@ -35,6 +39,8 @@ Once you have the size of the containing cube, you can use it as the `size` argu
![bend](images/lib-bend-2.JPG)
The arc shape is smoother if the `frags` value is larger.
include <bend.scad>;
x = 9.25;
y = 9.55;

View File

@@ -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:
include <bezier.scad>;
t_step = 0.05;
width = 2;

View File

@@ -1,6 +1,6 @@
# box_extrude
Create a box (container) from a 2D object.
Creates a box (container) from a 2D object.
## Parameters
@@ -9,11 +9,15 @@ Create a box (container) from a 2D object.
## Examples
include <box_extrude.scad>;
box_extrude(height = 30, shell_thickness = 2)
circle(r = 30);
![box_extrude](images/lib-box_extrude-1.JPG)
include <box_extrude.scad>;
box_extrude(height = 30, shell_thickness = 2)
text("XD", size = 40, font = "Cooper Black");

View File

@@ -9,6 +9,8 @@ Sometimes you need all points on the path of a circle. Here's the function. Its
## Examples
include <circle_path.scad>;
$fn = 24;
points = circle_path(radius = 50);

View File

@@ -1,6 +1,6 @@
# 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
@@ -10,6 +10,8 @@ Create a circular sector. You can pass a 2 element vector to define the central
-
## Examples
include <circular_sector.scad>;
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], $fn = 12);

View File

@@ -1,6 +1,6 @@
# 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

View File

@@ -1,6 +1,6 @@
# hollow_out
Hollow out a 2D object.
Hollows out a 2D object.
## Parameters
@@ -8,6 +8,8 @@ Hollow out a 2D object.
## Examples
include <hollow_out.scad>;
hollow_out(shell_thickness = 1) circle(r = 3, $fn = 48);
hollow_out(shell_thickness = 1) square([10, 5]);

View File

@@ -10,6 +10,8 @@ Creates a 3D polyline from a list of `[x, y, z]` coordinates. As the name says,
## Examples
include <hull_polyline3d.scad>;
hull_polyline3d(
points = [
[1, 2, 3],
@@ -23,6 +25,8 @@ Creates a 3D polyline from a list of `[x, y, z]` coordinates. As the name says,
![polyline3d](images/lib-hull_polyline3d-1.JPG)
include <hull_polyline3d.scad>;
r = 50;
points = [
for(a = [0:180])

View File

@@ -13,6 +13,8 @@ Creates a line from two points. When the end points are `CAP_ROUND`, you can use
## Examples
include <line2d.scad>;
$fn = 24;
line2d(p1 = [0, 0], p2 = [5, 0], width = 1);

View File

@@ -13,6 +13,8 @@ Creates a 3D line from two points.
## Examples
include <line3d.scad>;
line3d(
p1 = [0, 0, 0],
p2 = [10, 2, 10],
@@ -21,6 +23,8 @@ Creates a 3D line from two points.
);
![line3d](images/lib-line3d-1.JPG)
include <line3d.scad>;
line3d(
p1 = [0, 0, 0],
@@ -33,6 +37,8 @@ Creates a 3D line from two points.
![line3d](images/lib-line3d-2.JPG)
include <line3d.scad>;
line3d(
p1 = [0, 0, 0],
p2 = [10, 2, 10],

View File

@@ -8,5 +8,7 @@ Parses the string argument as an number. It depends on the `split_str` and the `
## Examples
include <parse_number.scad>;
echo(parse_number("10") + 1); // ECHO: 11
echo(parse_number("-1.1") + 1); // ECHO: -0.1

View File

@@ -13,17 +13,23 @@ Creates a polyline from a list of `x`, `y` coordinates. When the end points are
## Examples
include <polyline2d.scad>;
$fn = 24;
polyline2d(points = [[1, 2], [-5, -4], [-5, 3], [5, 5]], width = 1);
![polyline2d](images/lib-polyline2d-1.JPG)
include <polyline2d.scad>;
$fn = 24;
polyline2d(points = [[1, 2], [-5, -4], [-5, 3], [5, 5]], width = 1,
endingStyle = "CAP_ROUND");
![polyline2d](images/lib-polyline2d-2.JPG)
include <polyline2d.scad>;
$fn = 24;
polyline2d(points = [[1, 2], [-5, -4], [-5, 3], [5, 5]], width = 1,
startingStyle = "CAP_ROUND", endingStyle = "CAP_ROUND");

View File

@@ -12,6 +12,8 @@ Creates a polyline from a list of `[x, y, z]` coordinates. It depends on the `li
## Examples
include <polyline3d.scad>;
polyline3d(
points = [
[1, 2, 1],
@@ -25,6 +27,8 @@ Creates a polyline from a list of `[x, y, z]` coordinates. It depends on the `li
![polyline3d](images/lib-polyline3d-1.JPG)
include <polyline3d.scad>;
polyline3d(
points = [
[1, 2, 1],
@@ -39,6 +43,8 @@ Creates a polyline from a list of `[x, y, z]` coordinates. It depends on the `li
![polyline3d](images/lib-polyline3d-2.JPG)
include <polyline3d.scad>;
polyline3d(
points = [
[1, 2, 1],
@@ -54,6 +60,8 @@ Creates a polyline from a list of `[x, y, z]` coordinates. It depends on the `li
![polyline3d](images/lib-polyline3d-3.JPG)
include <polyline3d.scad>;
r = 20;
h = 5;
fa = 15;

View File

@@ -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.
include <rotate_p.scad>;
hull() {
sphere(1);
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.
include <rotate_p.scad>;
point = [20, 0, 0];
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.
include <rotate_p.scad>;
radius = 40;
step_angle = 10;
z_circles = 20;

View File

@@ -12,6 +12,8 @@ The 2D polygon should center at the origin and you have to determine the side le
## Examples
include <stereographic_extrude.scad>;
dimension = 100;
render() stereographic_extrude(shadow_side_leng = dimension)

View File

@@ -10,5 +10,7 @@ Returns a new string that is a substring of the given string.
## Examples
include <sub_str.scad>;
echo(sub_str("helloworld", 0, 5)); // ECHO: "hello"
echo(sub_str("helloworld", 5)); // ECHO: "world"