Moved % modifier handling from node to nodedumper. This makes nodes with % operators use the existing cache instead of recalculating the object

export-menu
Marius Kintel 2014-02-04 23:49:10 -05:00
parent 6a1d91dc76
commit 716d8a7ab3
7 changed files with 16 additions and 16 deletions

View File

@ -97,8 +97,6 @@ void AbstractNode::progress_report() const
std::ostream &operator<<(std::ostream &stream, const AbstractNode &node)
{
// FIXME: Don't use deep access to modinst members
if (node.modinst->isBackground()) stream << "%";
stream << node.toString();
return stream;
}

View File

@ -1,5 +1,6 @@
#include "nodedumper.h"
#include "state.h"
#include "module.h"
#include <string>
#include <sstream>
@ -47,6 +48,7 @@ std::string NodeDumper::dumpChildren(const AbstractNode &node)
iter != this->visitedchildren[node.index()].end();
iter++) {
assert(isCached(**iter));
if ((*iter)->modinst->isBackground()) dump << "%";
dump << this->cache[**iter] << "\n";
}

View File

@ -1,12 +1,12 @@
group() {
difference() {
sphere($fn = 0, $fa = 12, $fs = 2, r = 10);
%cylinder($fn = 0, $fa = 12, $fs = 2, h = 30, r1 = 6, r2 = 6, center = true);
% cylinder($fn = 0, $fa = 12, $fs = 2, h = 30, r1 = 6, r2 = 6, center = true);
}
%group() {
% group() {
cube(size = [25, 6, 3], center = true);
}
%multmatrix([[1, 0, 0, 0], [0, 1, 0, -9], [0, 0, 1, 0], [0, 0, 0, 1]]) {
% multmatrix([[1, 0, 0, 0], [0, 1, 0, -9], [0, 0, 1, 0], [0, 0, 0, 1]]) {
difference() {
color([0, 0.501961, 0, 1]) {
cube(size = [10, 4, 10], center = true);
@ -20,7 +20,7 @@ group() {
}
multmatrix([[1, 0, 0, 25], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
minkowski(convexity = 0) {
%cube(size = [10, 10, 10], center = true);
% cube(size = [10, 10, 10], center = true);
cube(size = [5, 5, 5], center = true);
}
}

View File

@ -1,8 +1,8 @@
group() {
%linear_extrude(height = 22, center = true, convexity = 10, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) {
% linear_extrude(height = 22, center = true, convexity = 10, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) {
import(file = "example009.dxf", layer = "body", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
}
%group() {
% group() {
multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 12], [0, 0, 0, 1]]) {
linear_extrude(height = 2, center = true, convexity = 10, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) {
import(file = "example009.dxf", layer = "plate", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);

View File

@ -188,7 +188,7 @@ group() {
}
}
}
%multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 12], [0, 0, 0, 1]]) {
% multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 12], [0, 0, 0, 1]]) {
group() {
rotate_extrude(convexity = 2, $fn = 0, $fa = 12, $fs = 2) {
square(size = [25, 68], center = false);

View File

@ -17,7 +17,7 @@ group() {
}
}
}
%group() {
% group() {
difference() {
sphere($fn = 0, $fa = 30, $fs = 2, r = 25);
cylinder($fn = 0, $fa = 30, $fs = 2, h = 62.5, r1 = 12.5, r2 = 6.25, center = true);
@ -251,7 +251,7 @@ group() {
}
}
}
%group() {
% group() {
difference() {
sphere($fn = 0, $fa = 30, $fs = 2, r = 25);
cylinder($fn = 0, $fa = 30, $fs = 2, h = 62.5, r1 = 12.5, r2 = 6.25, center = true);

View File

@ -1,12 +1,12 @@
group() {
difference() {
sphere($fn = 0, $fa = 12, $fs = 2, r = 10);
%cylinder($fn = 0, $fa = 12, $fs = 2, h = 30, r1 = 6, r2 = 6, center = true);
%group() {
% cylinder($fn = 0, $fa = 12, $fs = 2, h = 30, r1 = 6, r2 = 6, center = true);
% group() {
cube(size = [25, 6, 3], center = true);
}
}
%multmatrix([[1, 0, 0, 0], [0, 1, 0, -9], [0, 0, 1, 0], [0, 0, 0, 1]]) {
% multmatrix([[1, 0, 0, 0], [0, 1, 0, -9], [0, 0, 1, 0], [0, 0, 0, 1]]) {
difference() {
color([0, 0.501961, 0, 1]) {
cube(size = [10, 4, 10], center = true);
@ -18,7 +18,7 @@ group() {
}
}
}
%multmatrix([[1, 0, 0, 13], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
% multmatrix([[1, 0, 0, 13], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
difference() {
sphere($fn = 0, $fa = 12, $fs = 2, r = 10);
cylinder($fn = 0, $fa = 12, $fs = 2, h = 30, r1 = 6, r2 = 6, center = true);
@ -47,7 +47,7 @@ group() {
cube(size = [25, 6, 3], center = true);
}
}
%multmatrix([[1, 0, 0, 0], [0, 1, 0, -9], [0, 0, 1, 0], [0, 0, 0, 1]]) {
% multmatrix([[1, 0, 0, 0], [0, 1, 0, -9], [0, 0, 1, 0], [0, 0, 0, 1]]) {
difference() {
color([0, 0.501961, 0, 1]) {
cube(size = [10, 4, 10], center = true);