From e324f76e24d1f64b1a272b7942193f06966350f9 Mon Sep 17 00:00:00 2001 From: Rock Storm Date: Fri, 28 Sep 2018 20:16:05 +0100 Subject: [PATCH 1/3] shapes: Add deprecation warning --- shapes.scad | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/shapes.scad b/shapes.scad index 51ea76f..e56dad0 100644 --- a/shapes.scad +++ b/shapes.scad @@ -28,13 +28,23 @@ //---------------------- +echoDeprecation(); + +module echoDeprecation () { + echo(" + WARNING: 'shapes' library is now deprecated + please use 'reg_shapes' instead"); +} + // size is a vector [w, h, d] module box(width, height, depth) { + echoDeprecation(); cube([width, height, depth], true); } // size is a vector [w, h, d] module roundedBox(width, height, depth, radius) { + echoDeprecation(); size=[width, height, depth]; cube(size - [2*radius,0,0], true); cube(size - [0,2*radius,0], true); @@ -45,19 +55,23 @@ module roundedBox(width, height, depth, radius) { } module cone(height, radius, center = false) { + echoDeprecation(); cylinder(height, radius, 0, center); } module ellipticalCylinder(w,h, height, center = false) { + echoDeprecation(); scale([1, h/w, 1]) cylinder(h=height, r=w, center=center); } module ellipsoid(w, h, center = false) { + echoDeprecation(); scale([1, h/w, 1]) sphere(r=w/2, center=center); } // wall is wall thickness module tube(height, radius, wall, center = false) { + echoDeprecation(); difference() { cylinder(h=height, r=radius, center=center); cylinder(h=height, r=radius-wall, center=center); @@ -66,6 +80,7 @@ module tube(height, radius, wall, center = false) { // wall is wall thickness module tube2(height, ID, OD, center = false) { + echoDeprecation(); difference() { cylinder(h=height, r=OD/2, center=center); cylinder(h=height, r=ID/2, center=center); @@ -74,6 +89,7 @@ module tube2(height, ID, OD, center = false) { // wall is wall thickness module ovalTube(height, rx, ry, wall, center = false) { + echoDeprecation(); difference() { scale([1, ry/rx, 1]) cylinder(h=height, r=rx, center=center); scale([(rx-wall)/rx, (ry-wall)/rx, 1]) cylinder(h=height, r=rx, center=center); @@ -82,12 +98,14 @@ module ovalTube(height, rx, ry, wall, center = false) { // size is the XY plane size, height in Z module hexagon(size, height) { + echoDeprecation(); boxWidth = size/1.75; for (r = [-60, 0, 60]) rotate([0,0,r]) cube([boxWidth, size, height], true); } // size is the XY plane size, height in Z module octagon(size, height) { + echoDeprecation(); intersection() { cube([size, size, height], true); rotate([0,0,45]) cube([size, size, height], true); @@ -96,6 +114,7 @@ module octagon(size, height) { // size is the XY plane size, height in Z module dodecagon(size, height) { + echoDeprecation(); intersection() { hexagon(size, height); rotate([0,0,90]) hexagon(size, height); @@ -104,6 +123,7 @@ module dodecagon(size, height) { // size is the XY plane size, height in Z module hexagram(size, height) { + echoDeprecation(); boxWidth=size/1.75; for (v = [[0,1],[0,-1],[1,-1]]) { intersection() { @@ -114,6 +134,7 @@ module hexagram(size, height) { } module rightTriangle(adjacent, opposite, height) { + echoDeprecation(); difference() { translate([-adjacent/2,opposite/2,0]) cube([adjacent, opposite, height], true); translate([-adjacent,0,0]) { @@ -123,6 +144,7 @@ module rightTriangle(adjacent, opposite, height) { } module equiTriangle(side, height) { + echoDeprecation(); difference() { translate([-side/2,side/2,0]) cube([side, side, height], true); rotate([0,0,30]) dislocateBox(side*2, side, height); @@ -133,6 +155,7 @@ module equiTriangle(side, height) { } module 12ptStar(size, height) { + echoDeprecation(); starNum = 3; starAngle = 360/starNum; for (s = [1:starNum]) { From b7ee9ac16f33cfe1374fe8f7ca738c4481fec4e7 Mon Sep 17 00:00:00 2001 From: Rock Storm Date: Thu, 4 Oct 2018 19:04:09 +0100 Subject: [PATCH 2/3] shapes: use 'DEPRECATED' instead of 'WARNING' --- shapes.scad | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shapes.scad b/shapes.scad index e56dad0..b506d0b 100644 --- a/shapes.scad +++ b/shapes.scad @@ -32,8 +32,8 @@ echoDeprecation(); module echoDeprecation () { echo(" - WARNING: 'shapes' library is now deprecated - please use 'reg_shapes' instead"); + DEPRECATED: 'shapes' library is now deprecated + please use 'regular_shapes' instead"); } // size is a vector [w, h, d] From 852e53bef5a1f1362eedf4f760eff9709a237cd7 Mon Sep 17 00:00:00 2001 From: Rock Storm Date: Sun, 7 Oct 2018 17:40:26 +0100 Subject: [PATCH 3/3] shapes: Make deprecation module name less generic --- shapes.scad | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/shapes.scad b/shapes.scad index b506d0b..37af473 100644 --- a/shapes.scad +++ b/shapes.scad @@ -28,9 +28,9 @@ //---------------------- -echoDeprecation(); +echo_deprecated_shapes_library(); -module echoDeprecation () { +module echo_deprecated_shapes_library() { echo(" DEPRECATED: 'shapes' library is now deprecated please use 'regular_shapes' instead"); @@ -38,13 +38,13 @@ module echoDeprecation () { // size is a vector [w, h, d] module box(width, height, depth) { - echoDeprecation(); + echo_deprecated_shapes_library(); cube([width, height, depth], true); } // size is a vector [w, h, d] module roundedBox(width, height, depth, radius) { - echoDeprecation(); + echo_deprecated_shapes_library(); size=[width, height, depth]; cube(size - [2*radius,0,0], true); cube(size - [0,2*radius,0], true); @@ -55,23 +55,23 @@ module roundedBox(width, height, depth, radius) { } module cone(height, radius, center = false) { - echoDeprecation(); + echo_deprecated_shapes_library(); cylinder(height, radius, 0, center); } module ellipticalCylinder(w,h, height, center = false) { - echoDeprecation(); + echo_deprecated_shapes_library(); scale([1, h/w, 1]) cylinder(h=height, r=w, center=center); } module ellipsoid(w, h, center = false) { - echoDeprecation(); + echo_deprecated_shapes_library(); scale([1, h/w, 1]) sphere(r=w/2, center=center); } // wall is wall thickness module tube(height, radius, wall, center = false) { - echoDeprecation(); + echo_deprecated_shapes_library(); difference() { cylinder(h=height, r=radius, center=center); cylinder(h=height, r=radius-wall, center=center); @@ -80,7 +80,7 @@ module tube(height, radius, wall, center = false) { // wall is wall thickness module tube2(height, ID, OD, center = false) { - echoDeprecation(); + echo_deprecated_shapes_library(); difference() { cylinder(h=height, r=OD/2, center=center); cylinder(h=height, r=ID/2, center=center); @@ -89,7 +89,7 @@ module tube2(height, ID, OD, center = false) { // wall is wall thickness module ovalTube(height, rx, ry, wall, center = false) { - echoDeprecation(); + echo_deprecated_shapes_library(); difference() { scale([1, ry/rx, 1]) cylinder(h=height, r=rx, center=center); scale([(rx-wall)/rx, (ry-wall)/rx, 1]) cylinder(h=height, r=rx, center=center); @@ -98,14 +98,14 @@ module ovalTube(height, rx, ry, wall, center = false) { // size is the XY plane size, height in Z module hexagon(size, height) { - echoDeprecation(); + echo_deprecated_shapes_library(); boxWidth = size/1.75; for (r = [-60, 0, 60]) rotate([0,0,r]) cube([boxWidth, size, height], true); } // size is the XY plane size, height in Z module octagon(size, height) { - echoDeprecation(); + echo_deprecated_shapes_library(); intersection() { cube([size, size, height], true); rotate([0,0,45]) cube([size, size, height], true); @@ -114,7 +114,7 @@ module octagon(size, height) { // size is the XY plane size, height in Z module dodecagon(size, height) { - echoDeprecation(); + echo_deprecated_shapes_library(); intersection() { hexagon(size, height); rotate([0,0,90]) hexagon(size, height); @@ -123,7 +123,7 @@ module dodecagon(size, height) { // size is the XY plane size, height in Z module hexagram(size, height) { - echoDeprecation(); + echo_deprecated_shapes_library(); boxWidth=size/1.75; for (v = [[0,1],[0,-1],[1,-1]]) { intersection() { @@ -134,7 +134,7 @@ module hexagram(size, height) { } module rightTriangle(adjacent, opposite, height) { - echoDeprecation(); + echo_deprecated_shapes_library(); difference() { translate([-adjacent/2,opposite/2,0]) cube([adjacent, opposite, height], true); translate([-adjacent,0,0]) { @@ -144,7 +144,7 @@ module rightTriangle(adjacent, opposite, height) { } module equiTriangle(side, height) { - echoDeprecation(); + echo_deprecated_shapes_library(); difference() { translate([-side/2,side/2,0]) cube([side, side, height], true); rotate([0,0,30]) dislocateBox(side*2, side, height); @@ -155,7 +155,7 @@ module equiTriangle(side, height) { } module 12ptStar(size, height) { - echoDeprecation(); + echo_deprecated_shapes_library(); starNum = 3; starAngle = 360/starNum; for (s = [1:starNum]) {