From e1e2fac61b6b00152b7b4cc2f9a3b6b52a827eff Mon Sep 17 00:00:00 2001 From: Don Bright Date: Mon, 28 May 2012 14:32:24 -0500 Subject: enable linear_extrude to use first unnamed parameter as height, if number 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 + 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 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; -- cgit v0.10.1