summaryrefslogtreecommitdiff
path: root/src/rotateextrude.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2012-07-15 01:57:55 (GMT)
committerMarius Kintel <marius@kintel.net>2012-07-15 01:57:55 (GMT)
commit13557f1f9a44caccb0546717065ed72c27a210b3 (patch)
treed0ed7bd176d7c0b052431cb99efd358602d6b6bb /src/rotateextrude.cc
parent38a4585d1a9abe9c779c5d0677bfc81c407db371 (diff)
parent2495df6bab07f14f0eed7062dec17d24599aa838 (diff)
Merge branch 'timestamp-cache'
Diffstat (limited to 'src/rotateextrude.cc')
-rw-r--r--src/rotateextrude.cc29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/rotateextrude.cc b/src/rotateextrude.cc
index e279cf1..165d03b 100644
--- a/src/rotateextrude.cc
+++ b/src/rotateextrude.cc
@@ -38,6 +38,9 @@
#include <boost/assign/std/vector.hpp>
using namespace boost::assign; // bring 'operator+=()' into scope
+#include <boost/filesystem.hpp>
+namespace fs = boost::filesystem;
+
class RotateExtrudeModule : public AbstractModule
{
public:
@@ -56,9 +59,9 @@ AbstractNode *RotateExtrudeModule::evaluate(const Context *ctx, const ModuleInst
Context c(ctx);
c.args(argnames, argexpr, inst->argnames, inst->argvalues);
- node->fn = c.lookup_variable("$fn").num;
- node->fs = c.lookup_variable("$fs").num;
- node->fa = c.lookup_variable("$fa").num;
+ node->fn = c.lookup_variable("$fn").toDouble();
+ node->fs = c.lookup_variable("$fs").toDouble();
+ node->fa = c.lookup_variable("$fa").toDouble();
Value file = c.lookup_variable("file");
Value layer = c.lookup_variable("layer", true);
@@ -66,15 +69,15 @@ AbstractNode *RotateExtrudeModule::evaluate(const Context *ctx, const ModuleInst
Value origin = c.lookup_variable("origin", true);
Value scale = c.lookup_variable("scale", true);
- if (!file.text.empty()) {
+ if (!file.isUndefined()) {
PRINT("DEPRECATED: Support for reading files in rotate_extrude will be removed in future releases. Use a child import() instead.");
- node->filename = c.getAbsolutePath(file.text);
+ node->filename = c.getAbsolutePath(file.toString());
}
- node->layername = layer.text;
- node->convexity = (int)convexity.num;
- origin.getv2(node->origin_x, node->origin_y);
- node->scale = scale.num;
+ node->layername = layer.isUndefined() ? "" : layer.toString();
+ node->convexity = (int)convexity.toDouble();
+ origin.getVec2(node->origin_x, node->origin_y);
+ node->scale = scale.toDouble();
if (node->convexity <= 0)
node->convexity = 1;
@@ -112,11 +115,17 @@ std::string RotateExtrudeNode::toString() const
stream << this->name() << "(";
if (!this->filename.empty()) { // Ignore deprecated parameters if empty
+ fs::path path(this->filename);
stream <<
"file = " << this->filename << ", "
"layer = " << QuotedString(this->layername) << ", "
"origin = [" << std::dec << this->origin_x << ", " << this->origin_y << "], "
- "scale = " << this->scale << ", ";
+ "scale = " << this->scale << ", "
+#ifndef OPENSCAD_TESTING
+ // timestamp is needed for caching, but disturbs the test framework
+ << "timestamp = " << (fs::exists(path) ? fs::last_write_time(path) : 0) << ", "
+#endif
+ ;
}
stream <<
"convexity = " << this->convexity << ", "
contact: Jan Huwald // Impressum