1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-03-14 02:59:42 +01: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>;
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")
let(
idx = code - 32,

View File

@ -13,5 +13,8 @@ use <../util/sort.scad>;
use <../util/dedup.scad>;
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);

View File

@ -13,5 +13,8 @@ use <../util/sort.scad>;
use <../util/dedup.scad>;
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);

View File

@ -10,4 +10,8 @@
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>;
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);

View File

@ -10,4 +10,8 @@
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>;
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 :
let(
sortedXY = sort(contour, by = "vt"),

View File

@ -17,6 +17,7 @@ use <px_line.scad>;
function px_polyline(points) =
let(
_ = echo("<b><i>pixel/px_polyline</i> is deprecated: use <i>voxel/vx_polyline</i> instead.</b>"),
is_2d = len(points[0]) == 2,
pts = is_2d ? [for(pt = points) __to3d(pt)] : points,
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) =
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 ? [
for(z = range)
for(y = range)