mirror of https://github.com/vitalif/openscad
Clifford Wolf:
Added == support for all value types git-svn-id: http://svn.clifford.at/openscad/trunk@286 b57f626f-c46c-0410-a088-ec61d464b74cstl_dim
parent
f1240de7f0
commit
b81d72acb0
|
@ -1,4 +1,11 @@
|
|||
|
||||
// To render the DXF file from the command line:
|
||||
// openscad -x example017.dxf -D'mode="parts"' example017.scad
|
||||
|
||||
// mode = "parts";
|
||||
// mode = "exploded";
|
||||
mode = "assembled";
|
||||
|
||||
thickness = 6;
|
||||
locklen1 = 15;
|
||||
locklen2 = 10;
|
||||
|
@ -139,6 +146,12 @@ module assembled()
|
|||
% translate([ 0, 0, thickness*2]) bottle();
|
||||
}
|
||||
|
||||
// parts();
|
||||
// exploded();
|
||||
assembled();
|
||||
if (mode == "parts")
|
||||
parts();
|
||||
|
||||
if (mode == "exploded")
|
||||
exploded();
|
||||
|
||||
if (mode == "assembled")
|
||||
assembled();
|
||||
|
||||
|
|
25
value.cc
25
value.cc
|
@ -203,18 +203,27 @@ Value Value::operator == (const Value &v) const
|
|||
if (type == NUMBER && v.type == NUMBER) {
|
||||
return Value(num == v.num);
|
||||
}
|
||||
return Value();
|
||||
if (type == RANGE && v.type == RANGE) {
|
||||
return Value(range_begin == v.range_begin && range_step == v.range_step && range_end == v.range_end);
|
||||
}
|
||||
if (type == VECTOR && v.type == VECTOR) {
|
||||
if (vec.size() != v.vec.size())
|
||||
return Value(false);
|
||||
for (int i=0; i<vec.size(); i++)
|
||||
if (!(*vec[i] == *v.vec[i]).b)
|
||||
return Value(false);
|
||||
return Value(true);
|
||||
}
|
||||
if (type == STRING && v.type == STRING) {
|
||||
return Value(text == v.text);
|
||||
}
|
||||
return Value(false);
|
||||
}
|
||||
|
||||
Value Value::operator != (const Value &v) const
|
||||
{
|
||||
if (type == BOOL && v.type == BOOL) {
|
||||
return Value(b != v.b);
|
||||
}
|
||||
if (type == NUMBER && v.type == NUMBER) {
|
||||
return Value(num != v.num);
|
||||
}
|
||||
return Value();
|
||||
Value eq = *this == v;
|
||||
return Value(!eq.b);
|
||||
}
|
||||
|
||||
Value Value::operator >= (const Value &v) const
|
||||
|
|
Loading…
Reference in New Issue