mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-09-15 00:53:15 +02:00
Compare commits
22 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
dc5e063b25 | ||
|
aae8f688c0 | ||
|
60931ec8b9 | ||
|
6bb3b445b4 | ||
|
b7d8d3e87c | ||
|
ac1167eacc | ||
|
0c6744c62d | ||
|
d1bd586bee | ||
|
dfe76bff78 | ||
|
8ceae06645 | ||
|
299b3869fd | ||
|
80fb650df4 | ||
|
919ae2f158 | ||
|
a851ee6bb7 | ||
|
5b21cc10d7 | ||
|
f4696f231e | ||
|
6f83a6192a | ||
|
85f8acdbee | ||
|
c75bf8bfee | ||
|
e2771ca01c | ||
|
26db1cf25b | ||
|
ad7819f1eb |
@@ -27,6 +27,8 @@ If OpenSCAD generates "WARNING: Ignoring unknown xxx function" or "WARNING: Igno
|
||||
|
||||
Too many dependencies? Because OpenSCAD doesn't provide namespace management, I personally think that exposing dependencies is better than hiding them. In this way, users can have their own way to manage dependencies. How to categorize dependencies is up to you. For example, you can include your commonly-used modules and functions in "commonly_used.scad" and then `include <commonly_used.scad>;` in the ".scad" file of your project.
|
||||
|
||||
If you really don't want to care about dependencies, `include <dotSCAD.scad>;` or `use <dotSCAD.scad>;` come to save you.
|
||||
|
||||
## Documentation
|
||||
|
||||
- 2D
|
||||
|
17
RELEASE.md
17
RELEASE.md
@@ -1,5 +1,22 @@
|
||||
> Version numbers are based on [Semantic Versioning](https://semver.org/).
|
||||
|
||||
# v1.3.3
|
||||
- Bugfixes
|
||||
- `in_shape`: Wrong variable name.
|
||||
|
||||
# v1.3.2
|
||||
- All-in-one source file.
|
||||
- You can use `include <dotSCAD.scad>;` or `use <dotSCAD.scad>;` if you really don't want to care about dependencies.
|
||||
|
||||
- Bugfixes
|
||||
- `along_with`: Wrong variable scope.
|
||||
|
||||
# v1.3.1
|
||||
- Bugfixes
|
||||
- `in_polyline`: Wrong parameter name.
|
||||
- `in_shape`: Missing dependency.
|
||||
- `along_with`: Avoid warning when using 2D points.
|
||||
|
||||
# v1.3
|
||||
- New modules:
|
||||
- [bend_extrude](https://openhome.cc/eGossip/OpenSCAD/lib-bend_extrude.html)
|
||||
|
79
all/dotSCAD.scad
Normal file
79
all/dotSCAD.scad
Normal file
@@ -0,0 +1,79 @@
|
||||
include <along_with.scad>;
|
||||
include <arc.scad>;
|
||||
include <arc_path.scad>;
|
||||
include <archimedean_spiral.scad>;
|
||||
include <archimedean_spiral_extrude.scad>;
|
||||
include <bend.scad>;
|
||||
include <bend_extrude.scad>;
|
||||
include <bezier_curve.scad>;
|
||||
include <bezier_smooth.scad>;
|
||||
include <bezier_surface.scad>;
|
||||
include <bijection_offset.scad>;
|
||||
include <box_extrude.scad>;
|
||||
include <circle_path.scad>;
|
||||
include <cross_sections.scad>;
|
||||
include <crystal_ball.scad>;
|
||||
include <ellipse_extrude.scad>;
|
||||
include <function_grapher.scad>;
|
||||
include <golden_spiral.scad>;
|
||||
include <golden_spiral_extrude.scad>;
|
||||
include <helix.scad>;
|
||||
include <helix_extrude.scad>;
|
||||
include <hexagons.scad>;
|
||||
include <hollow_out.scad>;
|
||||
include <hull_polyline2d.scad>;
|
||||
include <hull_polyline3d.scad>;
|
||||
include <in_polyline.scad>;
|
||||
include <in_shape.scad>;
|
||||
include <line2d.scad>;
|
||||
include <line3d.scad>;
|
||||
include <log.scad>;
|
||||
include <m_cumulate.scad>;
|
||||
include <m_mirror.scad>;
|
||||
include <m_rotation.scad>;
|
||||
include <m_scaling.scad>;
|
||||
include <m_shearing.scad>;
|
||||
include <m_translation.scad>;
|
||||
include <midpt_smooth.scad>;
|
||||
include <multi_line_text.scad>;
|
||||
include <parse_number.scad>;
|
||||
include <path_extrude.scad>;
|
||||
include <path_scaling_sections.scad>;
|
||||
include <paths2sections.scad>;
|
||||
include <pie.scad>;
|
||||
include <polyline2d.scad>;
|
||||
include <polyline3d.scad>;
|
||||
include <polysections.scad>;
|
||||
include <polytransversals.scad>;
|
||||
include <ring_extrude.scad>;
|
||||
include <rotate_p.scad>;
|
||||
include <rounded_cube.scad>;
|
||||
include <rounded_cylinder.scad>;
|
||||
include <rounded_extrude.scad>;
|
||||
include <rounded_square.scad>;
|
||||
include <shape_arc.scad>;
|
||||
include <shape_cyclicpolygon.scad>;
|
||||
include <shape_ellipse.scad>;
|
||||
include <shape_glued2circles.scad>;
|
||||
include <shape_path_extend.scad>;
|
||||
include <shape_pentagram.scad>;
|
||||
include <shape_pie.scad>;
|
||||
include <shape_square.scad>;
|
||||
include <shape_starburst.scad>;
|
||||
include <shape_superformula.scad>;
|
||||
include <shape_taiwan.scad>;
|
||||
include <shape_trapezium.scad>;
|
||||
include <shear.scad>;
|
||||
include <sphere_spiral.scad>;
|
||||
include <sphere_spiral_extrude.scad>;
|
||||
include <split_str.scad>;
|
||||
include <starburst.scad>;
|
||||
include <stereographic_extrude.scad>;
|
||||
include <sub_str.scad>;
|
||||
include <torus_knot.scad>;
|
||||
include <triangulate.scad>;
|
||||
include <trim_shape.scad>;
|
||||
include <turtle2d.scad>;
|
||||
include <turtle3d.scad>;
|
||||
include <voronoi2d.scad>;
|
||||
include <voronoi3d.scad>;
|
@@ -20,7 +20,7 @@ Puts children along the given path. If there's only one child, it will put the c
|
||||
points = circle_path(radius = 50);
|
||||
|
||||
along_with(points)
|
||||
sphere(5, center = true);
|
||||
sphere(5);
|
||||
|
||||

|
||||
|
||||
|
@@ -6,6 +6,7 @@ Creates an arc. You can pass a 2 element vector to define the central angle. Its
|
||||
|
||||
- `radius` : The radius of the circle.
|
||||
- `angle` : A single value or 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` : The width of the arc.
|
||||
- `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.
|
||||
|
||||
|
23
docs/lib-m_mirror.md
Normal file
23
docs/lib-m_mirror.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# m_mirror
|
||||
|
||||
Generate a 4x4 transformation matrix which can pass into `multmatrix` to mirror the child element on a plane through the origin.
|
||||
|
||||
**Since:** 1.1
|
||||
|
||||
## Parameters
|
||||
|
||||
- `v` : The normal vector of a plane intersecting the origin through which to mirror the object.
|
||||
|
||||
## Examples
|
||||
|
||||
include <m_mirror.scad>;
|
||||
|
||||
rotate([0, 0, 10])
|
||||
cube([3, 2, 1]);
|
||||
|
||||
multmatrix(m_mirror([1, 1, 0]))
|
||||
rotate([0, 0, 10])
|
||||
cube([3, 2, 1]);
|
||||
|
||||

|
||||
|
@@ -1,25 +0,0 @@
|
||||
# m_multiply
|
||||
|
||||
Multiply two 4x4 transformation matrice.
|
||||
|
||||
**Since:** 1.1
|
||||
|
||||
## Parameters
|
||||
|
||||
- `ma`, `mb` : Two 4x4 transformation matrice.
|
||||
|
||||
## Examples
|
||||
|
||||
include <m_multiply.scad>;
|
||||
include <m_scaling.scad>;
|
||||
include <m_rotation.scad>;
|
||||
|
||||
ma = m_scaling([0.5, 1, 2]);
|
||||
mb = m_rotation([0, 0, 90]);
|
||||
|
||||
cube(10);
|
||||
multmatrix(m_multiply(ma, mb))
|
||||
translate([15, 0, 0]) cube(10);
|
||||
|
||||

|
||||
|
@@ -14,7 +14,7 @@ Generate a 4x4 transformation matrix which can pass into `multmatrix` to transla
|
||||
|
||||
cube(2, center = true);
|
||||
multmatrix(m_translation([5, 0, 0]))
|
||||
sphere(1,center = true);
|
||||
sphere(1);
|
||||
|
||||

|
||||
|
||||
|
@@ -100,7 +100,8 @@ module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE")
|
||||
}
|
||||
|
||||
module axis_angle_align_with_pts_init(a, s) {
|
||||
angleyz = __angy_angz(points[0], points[1]);
|
||||
angleyz = __angy_angz(__to3d(points[0]), __to3d(points[1]));
|
||||
|
||||
rotate([0, -angleyz[0], angleyz[1]])
|
||||
rotate([90, 0, -90])
|
||||
rotate(a)
|
||||
@@ -193,9 +194,9 @@ module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE")
|
||||
}
|
||||
}
|
||||
else if(method == "EULER_ANGLE") {
|
||||
angs = angles_defined ? angles : euler_angle_path_angles($children);
|
||||
|
||||
if($children == 1) {
|
||||
angs = angles_defined ? angles : euler_angle_path_angles($children);
|
||||
|
||||
for(i = [0:leng_points_minus_one]) {
|
||||
euler_angle_align(i, angs) children(0);
|
||||
}
|
||||
@@ -204,8 +205,6 @@ module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE")
|
||||
for(i = [0:min(leng_points, $children) - 1]) {
|
||||
euler_angle_align(i, angs) children(i);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
4419
src/dotSCAD.scad
Normal file
4419
src/dotSCAD.scad
Normal file
File diff suppressed because one or more lines are too long
@@ -18,5 +18,5 @@ function _in_polyline_sub(pts, pt, epsilon, iend, i = 0) =
|
||||
);
|
||||
|
||||
function in_polyline(line_pts, pt, epsilon = 0.0001) =
|
||||
_in_polyline_sub(line_pts, pt, epsilon, len(pts) - 1);
|
||||
_in_polyline_sub(line_pts, pt, epsilon, len(line_pts) - 1);
|
||||
|
@@ -8,6 +8,7 @@
|
||||
*
|
||||
**/
|
||||
|
||||
include <__private__/__to3d.scad>;
|
||||
include <__private__/__lines_from.scad>;
|
||||
include <__private__/__in_line.scad>;
|
||||
|
||||
@@ -49,7 +50,7 @@ function _in_shape_sub(shapt_pts, leng, pt, cond, i, j) =
|
||||
function in_shape(shapt_pts, pt, include_edge = false, epsilon = 0.0001) =
|
||||
let(
|
||||
leng = len(shapt_pts),
|
||||
edges = __lines_from(points, true)
|
||||
edges = __lines_from(shapt_pts, true)
|
||||
)
|
||||
_in_shape_in_any_edges(edges, pt, epsilon) ? include_edge :
|
||||
_in_shape_sub(shapt_pts, leng, pt, false, leng - 1, 0);
|
@@ -4,14 +4,15 @@
|
||||
* @copyright Justin Lin, 2017
|
||||
* @license https://opensource.org/licenses/lgpl-3.0.html
|
||||
*
|
||||
* @see https://openhome.cc/eGossip/OpenSCAD/lib-parse_number.html
|
||||
* @see https://openhome.cc/eGossip/OpenSCAD/lib2-parse_number.html
|
||||
*
|
||||
**/
|
||||
|
||||
function _str_to_int(t, i = 0, mapper = [["0", 0], ["1", 1], ["2", 2], ["3", 3], ["4", 4], ["5", 5], ["6", 6], ["7", 7], ["8", 8], ["9", 9]]) =
|
||||
i == len(mapper) ? -1 : (
|
||||
mapper[i][0] == t ? mapper[i][1] : _str_to_int(t, i + 1)
|
||||
);
|
||||
function _str_to_int(t) =
|
||||
let(
|
||||
dict = [["0", 0], ["1", 1], ["2", 2], ["3", 3], ["4", 4], ["5", 5], ["6", 6], ["7", 7], ["8", 8], ["9", 9]],
|
||||
n = dict[search(t, dict)[0]][1]
|
||||
) n;
|
||||
|
||||
function _parse_positive_int(t, value = 0, i = 0) =
|
||||
i == len(t) ? value : _parse_positive_int(t, value * pow(10, i) + _str_to_int(t[i]), i + 1);
|
||||
|
@@ -8,8 +8,9 @@
|
||||
*
|
||||
**/
|
||||
|
||||
function sub_str(t, begin, end, result = "") =
|
||||
end == undef ? sub_str(t, begin, len(t)) : (
|
||||
begin == end ? result : sub_str(t, begin + 1, end, str(result, t[begin]))
|
||||
);
|
||||
function _sub_str(t, begin, end) =
|
||||
begin == end ? "" : str(t[begin], sub_str(t, begin + 1, end));
|
||||
|
||||
function sub_str(t, begin, end) =
|
||||
end == undef ? _sub_str(t, begin, len(t)) : _sub_str(t, begin, end);
|
||||
|
Reference in New Issue
Block a user