Resync
Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
This commit is contained in:
parent
85ceeaee95
commit
34fb5c964c
7 changed files with 23 additions and 10 deletions
1
base.scad
Normal file
1
base.scad
Normal file
|
|
@ -0,0 +1 @@
|
|||
function default(val,comp) = val != undef ? val : comp;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
use <./debug.scad>;
|
||||
module component_get(name) {
|
||||
component_display(name) children();
|
||||
}
|
||||
|
|
@ -9,5 +9,8 @@ module component_display(name) {
|
|||
}
|
||||
|
||||
module component(name) {
|
||||
if($scaddy_component == undef || $scaddy_component == name) children();
|
||||
if($scaddy_component == undef || $scaddy_component == name) {
|
||||
debug() echo(str("Displaying component ",name));
|
||||
children();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ module debug(force=false) {
|
|||
}
|
||||
|
||||
module _debug_mesh() {
|
||||
%color([255,0,0,0.4]) children();
|
||||
%color([1,0,0,0.4]) children();
|
||||
}
|
||||
|
||||
module debug_points(vector) {
|
||||
|
|
|
|||
|
|
@ -2,5 +2,4 @@ function circle_y(x,r,cx=0,cy=0) = (2*cy + sqrt(8*cx*x-4*cx*cx-4*(x)*(x)+4*r*r))
|
|||
|
||||
function curve_r(curve_h,curve_w)=(pow(curve_h,2)+pow(curve_w,2))/(2*abs(curve_w));
|
||||
|
||||
function pow2(x)=x*x;
|
||||
function pow3(x)=x*x*x;
|
||||
function mix(base,target,ratio) = base*(1-ratio)+target*ratio;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,6 @@ module polyhedron_layers(layers) {
|
|||
bottom_f,
|
||||
top_f,
|
||||
walls_f
|
||||
));
|
||||
),convexity = lc);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,23 @@
|
|||
module precondition(test,error) {
|
||||
use <./base.scad>;
|
||||
|
||||
ERROR_BEGIN="<font color='red'>";
|
||||
ERROR_END="</font>";
|
||||
|
||||
module precondition(test,error,m=undef) {
|
||||
if(!test) {
|
||||
echo(str("<font color='red'>",error,"<font>"));
|
||||
echo(str(ERROR_BEGIN,default(m,parent_module(1)),": ",error,ERROR_END));
|
||||
assert(false);
|
||||
} else children();
|
||||
}
|
||||
|
||||
module check_defined(val,error) {
|
||||
function precondition(test,value,error)=test ? value : echo(str(ERROR_BEGIN,error,ERROR_END)) assert(false);
|
||||
|
||||
module check_defined(val,error,m=undef) {
|
||||
precondition(val != undef,error) children();
|
||||
}
|
||||
|
||||
module check_parent(parent,statement,error) {
|
||||
function check_defined(value,error)=precondition(value != undef,error);
|
||||
|
||||
module check_parent(parent,statement,error,m=undef) {
|
||||
precondition(parent_module(3) == parent,str(statement,"(): ",error)) children();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
include <./base.scad>;
|
||||
include <./debug.scad>;
|
||||
include <./config.scad>;
|
||||
include <./preconditions.scad>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue