diff options
author | Don Bright <hugh.m.bright@gmail.com> | 2012-05-28 19:32:24 (GMT) |
---|---|---|
committer | Don Bright <hugh.m.bright@gmail.com> | 2012-05-28 19:32:24 (GMT) |
commit | e1e2fac61b6b00152b7b4cc2f9a3b6b52a827eff (patch) | |
tree | 5d3a3668c0c49af5092a96bc2192e2eb49cc2969 /src | |
parent | 45c86b5a5a227447bd58ee4484ab1b3dae1e8f01 (diff) |
enable linear_extrude to use first unnamed parameter as height, if number
Diffstat (limited to 'src')
-rw-r--r-- | src/linearextrude.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/linearextrude.cc b/src/linearextrude.cc index 4f5fd14..8b4d069 100644 --- a/src/linearextrude.cc +++ b/src/linearextrude.cc @@ -45,6 +45,8 @@ public: virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst) const; }; +#include <iostream> + AbstractNode *LinearExtrudeModule::evaluate(const Context *ctx, const ModuleInstantiation *inst) const { LinearExtrudeNode *node = new LinearExtrudeNode(inst); @@ -54,6 +56,10 @@ AbstractNode *LinearExtrudeModule::evaluate(const Context *ctx, const ModuleInst std::vector<Expression*> argexpr; Context c(ctx); + for ( int i = 0 ; i < inst->argnames.size() ; i++ ) { + std::cout << "n: " << inst->argnames[i] << "\n" ; + std::cout << "v: " << inst->argvalues[i] << "\n"; + } c.args(argnames, argexpr, inst->argnames, inst->argvalues); node->fn = c.lookup_variable("$fn").num; @@ -75,6 +81,12 @@ AbstractNode *LinearExtrudeModule::evaluate(const Context *ctx, const ModuleInst node->filename = c.getAbsolutePath(file.text); } + // if height not given, and first argument is a number, + // then assume it should be the height. + if ( c.lookup_variable("height").type == Value::UNDEFINED ) + if ( inst->argnames[0] == "" ) + height = inst->argvalues[0]; + node->layername = layer.text; node->height = height.num; node->convexity = (int)convexity.num; |