1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-13 18:24:28 +02:00

add deprecated msg

This commit is contained in:
Justin Lin
2020-08-06 08:25:56 +08:00
parent 25afc1f647
commit 29b5c22766
9 changed files with 34 additions and 7 deletions

View File

@@ -11,7 +11,10 @@
use <px_from.scad>; use <px_from.scad>;
function px_ascii(char, center = false, invert = false) = function px_ascii(char, center = false, invert = false) =
let(code = ord(char)) let(
_ = echo("<b><i>pixel/px_ascii</i> is deprecated: use <i>voxel/vx_ascii</i> instead.</b>"),
code = ord(char)
)
assert(code > 31 && code < 127, "not printable character") assert(code > 31 && code < 127, "not printable character")
let( let(
idx = code - 32, idx = code - 32,

View File

@@ -13,5 +13,8 @@ use <../util/sort.scad>;
use <../util/dedup.scad>; use <../util/dedup.scad>;
function px_circle(radius, filled = false) = function px_circle(radius, filled = false) =
let(all = _px_circle_impl(radius, filled)) let(
_ = echo("<b><i>pixel/px_circle</i> is deprecated: use <i>voxel/vx_circle</i> instead.</b>"),
all = _px_circle_impl(radius, filled)
)
dedup(sort(all, by = "vt"), sorted = true); dedup(sort(all, by = "vt"), sorted = true);

View File

@@ -13,5 +13,8 @@ use <../util/sort.scad>;
use <../util/dedup.scad>; use <../util/dedup.scad>;
function px_cylinder(r, h, filled = false, thickness = 1) = function px_cylinder(r, h, filled = false, thickness = 1) =
let(all = _px_cylinder_impl(r, h, filled, thickness)) let(
_ = echo("<b><i>pixel/px_cylinder</i> is deprecated: use <i>voxel/vx_cylinder</i> instead.</b>"),
all = _px_cylinder_impl(r, h, filled, thickness)
)
dedup(sort(all, by = "vt"), sorted = true); dedup(sort(all, by = "vt"), sorted = true);

View File

@@ -10,4 +10,8 @@
use <_impl/_px_from_impl.scad>; use <_impl/_px_from_impl.scad>;
function px_from(binaries, center = false, invert = false) = _px_from_impl(binaries, center, invert); function px_from(binaries, center = false, invert = false) =
let(
_ = echo("<b><i>pixel/px_from</i> is deprecated: use <i>voxel/vx_from</i> instead.</b>")
)
_px_from_impl(binaries, center, invert);

View File

@@ -11,4 +11,7 @@
use <_impl/_px_gray_impl.scad>; use <_impl/_px_gray_impl.scad>;
function px_gray(levels, center = false, invert = false, normalize = false) = function px_gray(levels, center = false, invert = false, normalize = false) =
let(
_ = echo("<b><i>pixel/px_gray</i> is deprecated: use <i>voxel/vx_gray</i> instead.</b>")
)
_px_gray_impl(levels, center, invert, normalize); _px_gray_impl(levels, center, invert, normalize);

View File

@@ -10,4 +10,8 @@
use <_impl/_px_line_impl.scad>; use <_impl/_px_line_impl.scad>;
function px_line(p1, p2) = _px_line_impl(p1, p2); function px_line(p1, p2) =
let(
_ = echo("<b><i>pixel/px_line</i> is deprecated: use <i>voxel/vx_line</i> instead.</b>")
)
_px_line_impl(p1, p2);

View File

@@ -4,7 +4,10 @@ use <../util/dedup.scad>;
use <px_polyline.scad>; use <px_polyline.scad>;
function px_polygon(points, filled = false) = function px_polygon(points, filled = false) =
let(contour = px_polyline(concat(points, [points[0]]))) let(
_ = echo("<b><i>pixel/px_polygon</i> is deprecated: use <i>voxel/vx_polygon</i> instead.</b>"),
contour = px_polyline(concat(points, [points[0]]))
)
!filled ? contour : !filled ? contour :
let( let(
sortedXY = sort(contour, by = "vt"), sortedXY = sort(contour, by = "vt"),

View File

@@ -17,6 +17,7 @@ use <px_line.scad>;
function px_polyline(points) = function px_polyline(points) =
let( let(
_ = echo("<b><i>pixel/px_polyline</i> is deprecated: use <i>voxel/vx_polyline</i> instead.</b>"),
is_2d = len(points[0]) == 2, is_2d = len(points[0]) == 2,
pts = is_2d ? [for(pt = points) __to3d(pt)] : points, pts = is_2d ? [for(pt = points) __to3d(pt)] : points,
polyline = [for(line = __lines_from(pts)) each px_line(line[0], line[1])] polyline = [for(line = __lines_from(pts)) each px_line(line[0], line[1])]

View File

@@ -9,7 +9,10 @@
**/ **/
function px_sphere(radius, filled = false, thickness = 1) = function px_sphere(radius, filled = false, thickness = 1) =
let(range = [-radius: radius - 1]) let(
_ = echo("<b><i>pixel/px_sphere</i> is deprecated: use <i>voxel/vx_sphere</i> instead.</b>"),
range = [-radius: radius - 1]
)
filled ? [ filled ? [
for(z = range) for(z = range)
for(y = range) for(y = range)