mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-07 23:37:13 +02:00
update to 3.0
This commit is contained in:
@@ -58,7 +58,7 @@ These examples incubate dotSCAD and dotSCAD refactors these examples. See [examp
|
|||||||
- [crystal_ball](https://openhome.cc/eGossip/OpenSCAD/lib3x-crystal_ball.html)
|
- [crystal_ball](https://openhome.cc/eGossip/OpenSCAD/lib3x-crystal_ball.html)
|
||||||
- [function_grapher](https://openhome.cc/eGossip/OpenSCAD/lib3x-function_grapher.html)
|
- [function_grapher](https://openhome.cc/eGossip/OpenSCAD/lib3x-function_grapher.html)
|
||||||
- [hull_polyline3d](https://openhome.cc/eGossip/OpenSCAD/lib3x-hull_polyline3d.html)
|
- [hull_polyline3d](https://openhome.cc/eGossip/OpenSCAD/lib3x-hull_polyline3d.html)
|
||||||
- [line3d](https://openhome.cc/eGossip/OpenSCAD/lib2x-line3d.html)
|
- [line3d](https://openhome.cc/eGossip/OpenSCAD/lib3x-line3d.html)
|
||||||
- [loft](https://openhome.cc/eGossip/OpenSCAD/lib2x-loft.html)
|
- [loft](https://openhome.cc/eGossip/OpenSCAD/lib2x-loft.html)
|
||||||
- [polyhedron_hull](https://openhome.cc/eGossip/OpenSCAD/lib2x-polyhedron_hull.html)
|
- [polyhedron_hull](https://openhome.cc/eGossip/OpenSCAD/lib2x-polyhedron_hull.html)
|
||||||
- [polyline3d](https://openhome.cc/eGossip/OpenSCAD/lib2x-polyline3d.html)
|
- [polyline3d](https://openhome.cc/eGossip/OpenSCAD/lib2x-polyline3d.html)
|
||||||
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
@@ -6,7 +6,7 @@ Creates a 3D line from two points.
|
|||||||
|
|
||||||
- `p1` : 3 element vector `[x, y, z]`.
|
- `p1` : 3 element vector `[x, y, z]`.
|
||||||
- `p2` : 3 element vector `[x, y, z]`.
|
- `p2` : 3 element vector `[x, y, z]`.
|
||||||
- `thickness` : The line thickness.
|
- `diameter` : The line diameter. Default to 1.
|
||||||
- `p1Style` : The end-cap style of the point `p1`. The value must be `"CAP_BUTT"`, `"CAP_CIRCLE"` or `"CAP_SPHERE"`. The default value is `"CAP_CIRCLE"`.
|
- `p1Style` : The end-cap style of the point `p1`. The value must be `"CAP_BUTT"`, `"CAP_CIRCLE"` or `"CAP_SPHERE"`. The default value is `"CAP_CIRCLE"`.
|
||||||
- `p2Style` : The end-cap style of the point `p2`. The value must be `"CAP_BUTT"`, `"CAP_CIRCLE"` or `"CAP_SPHERE"`. The default value is `"CAP_CIRCLE"`.
|
- `p2Style` : The end-cap style of the point `p2`. The value must be `"CAP_BUTT"`, `"CAP_CIRCLE"` or `"CAP_SPHERE"`. The default value is `"CAP_CIRCLE"`.
|
||||||
- `$fa`, `$fs`, `$fn` : Used by the `circle` or `sphere` module internally. Check [the circle module](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#circle) or [the sphere module](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Primitive_Solids#sphere) for more details. The final fragments of a circle will be a multiple of 4 to fit edges.
|
- `$fa`, `$fs`, `$fn` : Used by the `circle` or `sphere` module internally. Check [the circle module](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#circle) or [the sphere module](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Primitive_Solids#sphere) for more details. The final fragments of a circle will be a multiple of 4 to fit edges.
|
||||||
@@ -18,34 +18,34 @@ Creates a 3D line from two points.
|
|||||||
line3d(
|
line3d(
|
||||||
p1 = [0, 0, 0],
|
p1 = [0, 0, 0],
|
||||||
p2 = [10, 2, 10],
|
p2 = [10, 2, 10],
|
||||||
thickness = 1,
|
diameter = 1,
|
||||||
$fn = 24
|
$fn = 24
|
||||||
);
|
);
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
use <line3d.scad>;
|
use <line3d.scad>;
|
||||||
|
|
||||||
line3d(
|
line3d(
|
||||||
p1 = [0, 0, 0],
|
p1 = [0, 0, 0],
|
||||||
p2 = [10, 2, 10],
|
p2 = [10, 2, 10],
|
||||||
thickness = 1,
|
diameter = 1,
|
||||||
p1Style = "CAP_BUTT",
|
p1Style = "CAP_BUTT",
|
||||||
p2Style = "CAP_BUTT",
|
p2Style = "CAP_BUTT",
|
||||||
$fn = 24
|
$fn = 24
|
||||||
);
|
);
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
use <line3d.scad>;
|
use <line3d.scad>;
|
||||||
|
|
||||||
line3d(
|
line3d(
|
||||||
p1 = [0, 0, 0],
|
p1 = [0, 0, 0],
|
||||||
p2 = [10, 2, 10],
|
p2 = [10, 2, 10],
|
||||||
thickness = 1,
|
diameter = 1,
|
||||||
p1Style = "CAP_SPHERE",
|
p1Style = "CAP_SPHERE",
|
||||||
p2Style = "CAP_SPHERE",
|
p2Style = "CAP_SPHERE",
|
||||||
$fn = 24
|
$fn = 24
|
||||||
);
|
);
|
||||||
|
|
||||||

|

|
@@ -2,25 +2,25 @@ use <line3d.scad>;
|
|||||||
use <turtle/t3d.scad>;
|
use <turtle/t3d.scad>;
|
||||||
|
|
||||||
module tree(t, leng, leng_scale1, leng_scale2, leng_limit,
|
module tree(t, leng, leng_scale1, leng_scale2, leng_limit,
|
||||||
angleZ, angleX, width) {
|
angleZ, angleX, diameter) {
|
||||||
if(leng > leng_limit) {
|
if(leng > leng_limit) {
|
||||||
t2 = t3d(t, "xforward", leng = leng);
|
t2 = t3d(t, "xforward", leng = leng);
|
||||||
|
|
||||||
line3d(
|
line3d(
|
||||||
t3d(t, "point"), t3d(t2, "point"),
|
t3d(t, "point"), t3d(t2, "point"),
|
||||||
width);
|
diameter);
|
||||||
|
|
||||||
tree(
|
tree(
|
||||||
t3d(t2, "zturn", angle = angleZ),
|
t3d(t2, "zturn", angle = angleZ),
|
||||||
leng * leng_scale1, leng_scale1, leng_scale2, leng_limit,
|
leng * leng_scale1, leng_scale1, leng_scale2, leng_limit,
|
||||||
angleZ, angleX,
|
angleZ, angleX,
|
||||||
width);
|
diameter);
|
||||||
|
|
||||||
tree(
|
tree(
|
||||||
t3d(t2, "xturn", angle = angleX),
|
t3d(t2, "xturn", angle = angleX),
|
||||||
leng * leng_scale2, leng_scale1, leng_scale2, leng_limit,
|
leng * leng_scale2, leng_scale1, leng_scale2, leng_limit,
|
||||||
angleZ, angleX,
|
angleZ, angleX,
|
||||||
width);
|
diameter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,9 +30,9 @@ leng_scale1 = 0.4;
|
|||||||
leng_scale2 = 0.9;
|
leng_scale2 = 0.9;
|
||||||
angleZ = 60;
|
angleZ = 60;
|
||||||
angleX = 135;
|
angleX = 135;
|
||||||
width = 2;
|
diameter = 2;
|
||||||
|
|
||||||
t = t3d(point = [0, 0, 0]);
|
t = t3d(point = [0, 0, 0]);
|
||||||
|
|
||||||
tree(t, leng, leng_scale1, leng_scale2, leng_limit,
|
tree(t, leng, leng_scale1, leng_scale2, leng_limit,
|
||||||
angleZ, angleX, width);
|
angleZ, angleX, diameter);
|
@@ -4,15 +4,15 @@
|
|||||||
* @copyright Justin Lin, 2017
|
* @copyright Justin Lin, 2017
|
||||||
* @license https://opensource.org/licenses/lgpl-3.0.html
|
* @license https://opensource.org/licenses/lgpl-3.0.html
|
||||||
*
|
*
|
||||||
* @see https://openhome.cc/eGossip/OpenSCAD/lib2x-line3d.html
|
* @see https://openhome.cc/eGossip/OpenSCAD/lib3x-line3d.html
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
use <__comm__/__frags.scad>;
|
use <__comm__/__frags.scad>;
|
||||||
use <__comm__/__nearest_multiple_of_4.scad>;
|
use <__comm__/__nearest_multiple_of_4.scad>;
|
||||||
|
|
||||||
module line3d(p1, p2, thickness, p1Style = "CAP_CIRCLE", p2Style = "CAP_CIRCLE") {
|
module line3d(p1, p2, diameter = 1, p1Style = "CAP_CIRCLE", p2Style = "CAP_CIRCLE") {
|
||||||
r = thickness / 2;
|
r = diameter / 2;
|
||||||
|
|
||||||
frags = __nearest_multiple_of_4(__frags(r));
|
frags = __nearest_multiple_of_4(__frags(r));
|
||||||
half_fa = 180 / frags;
|
half_fa = 180 / frags;
|
||||||
|
Reference in New Issue
Block a user