mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-09-02 19:22:48 +02:00
added along_with
This commit is contained in:
@@ -40,6 +40,7 @@ Some modules may depend on other modules. For example, the `polyline2d` module d
|
||||
- [function_grapher](https://openhome.cc/eGossip/OpenSCAD/lib-function_grapher.html)
|
||||
|
||||
- Transformation
|
||||
- [along_with](https://openhome.cc/eGossip/OpenSCAD/lib-along_with.html)
|
||||
- [hollow_out](https://openhome.cc/eGossip/OpenSCAD/lib-hollow_out.html)
|
||||
- [bend](https://openhome.cc/eGossip/OpenSCAD/lib-bend.html)
|
||||
|
||||
|
BIN
docs/images/lib-along_with-1.JPG
Normal file
BIN
docs/images/lib-along_with-1.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
BIN
docs/images/lib-along_with-2.JPG
Normal file
BIN
docs/images/lib-along_with-2.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
42
docs/lib-along_with.md
Normal file
42
docs/lib-along_with.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# along_with
|
||||
|
||||
Puts children along the given path. If there's only one child, it will put the child for each point.
|
||||
|
||||
## Parameters
|
||||
|
||||
- `points` : The points along the path.
|
||||
|
||||
## Examples
|
||||
|
||||
include <along_with.scad>;
|
||||
include <circle_path.scad>;
|
||||
|
||||
$fn = 24;
|
||||
|
||||
points = circle_path(radius = 50);
|
||||
|
||||
along_with(points)
|
||||
sphere(5, center = true);
|
||||
|
||||

|
||||
|
||||
include <along_with.scad>;
|
||||
include <circle_path.scad>;
|
||||
|
||||
$fn = 24;
|
||||
|
||||
points = circle_path(radius = 50);
|
||||
|
||||
along_with(points) {
|
||||
linear_extrude(10) text("A", valign = "center", halign = "center");
|
||||
linear_extrude(5) circle(2);
|
||||
sphere(1);
|
||||
cube(5);
|
||||
linear_extrude(10) text("A", valign = "center", halign = "center");
|
||||
linear_extrude(5) circle(2);
|
||||
sphere(1);
|
||||
cube(5);
|
||||
}
|
||||
|
||||

|
||||
|
26
src/along_with.scad
Normal file
26
src/along_with.scad
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* along_with.scad
|
||||
*
|
||||
* Puts children along the given path. If there's only one child,
|
||||
* it will put the child for each point.
|
||||
*
|
||||
* @copyright Justin Lin, 2017
|
||||
* @license https://opensource.org/licenses/lgpl-3.0.html
|
||||
*
|
||||
* @see https://openhome.cc/eGossip/OpenSCAD/lib-along_with.html
|
||||
*
|
||||
**/
|
||||
|
||||
module along_with(points) {
|
||||
if($children == 1) {
|
||||
for(i = [0:len(points) - 1]) {
|
||||
translate(points[i])
|
||||
children(0);
|
||||
}
|
||||
} else {
|
||||
for(i = [0:min(len(points), $children) - 1]) {
|
||||
translate(points[i])
|
||||
children(i);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user