diff options
164 files changed, 4341 insertions, 701 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3d0c520 --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +*.scad +*.dmg +*.tar* +Makefile +objects +*.stl +*.dxf +lexer_lex.cpp +parser_yacc.cpp +parser_yacc.h +tmp +OpenSCAD.app
\ No newline at end of file diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 3e10eec..d67766c 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -14,6 +14,7 @@ o The version() function will return the OpenSCAD version as a vector, e.g. [201 o The version_num() function will return the OpenSCAD version as a number, e.g. 20110923 o Added PI constant. o Now uses standard shortcuts for save and reload on Linux and Windows. F2/F3 will still work but is deprecated. +o Number literals in scientific notation are now accepted by the parser Bugfixes: o square() crashed if any of the dimensions were zero @@ -21,6 +22,7 @@ o Flush Caches didn't flush cached USE'd modules o STL export should be a bit more robust o Dropping a file into the editor under Windows didn't work (double C:/C:/ problem) o On some platforms it was possible to insertion rich text in the editor, causing confusion. +o Less crashes due to CGAL assertions Deprecations: o dxf_linear_extrude() and dxf_rotate_extrude() are now deprecated. @@ -28,7 +30,7 @@ o dxf_linear_extrude() and dxf_rotate_extrude() are now deprecated. o The file, layer, origin and scale parameters to linear_extrude() and rotate_extrude() are now deprecated. Use an import() child instead. o import_dxf(), import_stl() and import_off() are now deprecated. Use import() instead. -o When exporting geometry from the cmd-line, use the universal -o option. It will export to the correct file format based on the given suffix (dxf, stl, off). +o When exporting geometry from the cmd-line, use the universal -o option. It will export to the correct file format based on the given suffix (dxf, stl, off). The -x and -s parameters are still working but deprecated. o F2 and F3 for Save and Reload is now deprecated OpenSCAD 2011.06 diff --git a/doc/TODO.txt b/doc/TODO.txt index 26dd6c8..7df6a4d 100644 --- a/doc/TODO.txt +++ b/doc/TODO.txt @@ -52,6 +52,7 @@ o Preferences - OpenGL params - Default language feature settings - Make the library search path configurable? + - Turn on/off caching (advanced) o MDI - Think about how to do MDI the right way - Ctrl-W should close the current dialog, not the current main window @@ -117,6 +118,7 @@ o Misc - If trying to export STL/DXF but source is newer than the CGAL rendering, ask for confirmation. - Go through keyboard shortcuts and make them more conformant to platform standards + - Show design info/stats (sizes, caches etc.) o Cmd-line - Add verbose option (PRINT command from mainwin.cc and progress output) @@ -230,7 +232,5 @@ o Use a logging framework to get debugging/info output more under control? MISC ---- -o Streamline the cmd-line interface a bit - - Implicit output file format o Write checklists for typical extension work (add new module, add new function) -> make sure new test files are added diff --git a/doc/openscad.1 b/doc/openscad.1 new file mode 100644 index 0000000..a4c03dd --- /dev/null +++ b/doc/openscad.1 @@ -0,0 +1,47 @@ +.TH OPENSCAD 1 "2011-11-03" +.\" Please adjust this date whenever revising the manpage. +.SH NAME +openscad \- script file based graphical CAD environment +.SH SYNOPSIS +.B openscad +.RI [ options ] +.RI [ file ] +.SH DESCRIPTION +This manual page documents briefly the \fBopenscad\fP command. +.PP +\fBopenscad\fP is a software for creating solid 3D CAD objects. It focuses on +CAD aspects rather than artistic ones. + +OpenSCAD will start as a graphical program unless export options are given (see +below). For the usage of the GUI and a description of the OpenSCAD language see +the OpenSCAD user manual at http://en.wikibooks.org/wiki/OpenSCAD_User_Manual. +.SH OPTIONS + +.TP +\fB-o\fP \fIoutputfile\fP +Export the given file to \fIoutputfile\fP in STL, OFF, DXF or CSG format, +depending on file extension of \fIoutputfile\fP (which has to be lower case). +If this option is given, the GUI will not be started. +.TP +\fB\-d\fP \fIfile.deps\fP +If the \fB-d\fP option is given, all files accessed while exporting are written +to the given deps file in the syntax of a Makefile. +.TP +\fB-m\fP \fImake_command\fP +If a nonexisting file is accessed during OpenSCAD's operation, it will try to +invoke \fImake_command missing_file\fP to create the missing file, and then +read it again. +.TP +\fB-D\fP \fIvar=val\fP +This option can be used to assign constant values to OpenSCAD variables. The +variable's value is an expression, so if this mechanism is used to assign +strings, care has to be taken that the shell does not consume quotation marks. +More than one \fB-D\fP options can be given. +.TP +.B \-v, \-\-version +Show version of program. +.SH AUTHOR +OpenSCAD was written by Clifford Wolf, Marius Kintel, and others. +.PP +This manual page was written by chrysn <chrysn@fsfe.org>, +for the Debian project (and may be used by others). diff --git a/examples/example012.scad b/examples/example012.scad index 677154a..78ff058 100644 --- a/examples/example012.scad +++ b/examples/example012.scad @@ -8,5 +8,5 @@ difference() sphere(20); translate([ -2.92, 0.5, +20 ]) rotate([180, 0, 180]) - import_stl("example012.stl", convexity = 5); + import("example012.stl", convexity = 5); } diff --git a/examples/example015.scad b/examples/example015.scad index b123496..e8ac3a6 100644 --- a/examples/example015.scad +++ b/examples/example015.scad @@ -19,7 +19,7 @@ module shape() rotate(-45) scale([ 0.7, 1.3 ]) circle(5); } - import_dxf(file = "example009.dxf", layer = "body", + import(file = "example009.dxf", layer = "body", convexity = 6, scale=2); } diff --git a/examples/example016.scad b/examples/example016.scad index d75fafb..4ea9655 100644 --- a/examples/example016.scad +++ b/examples/example016.scad @@ -21,7 +21,7 @@ module blk2() { module chop() { translate([ -14, 0, 0 ]) - import_stl(file = "example016.stl", convexity = 12); + import(file = "example016.stl", convexity = 12); } difference() { diff --git a/openscad.pro b/openscad.pro index c507ab9..f08cecc 100644 --- a/openscad.pro +++ b/openscad.pro @@ -218,6 +218,7 @@ SOURCES += src/openscad.cc \ src/func.cc \ src/module.cc \ src/node.cc \ + src/builtin.cc \ src/context.cc \ src/csgterm.cc \ src/polyset.cc \ @@ -279,13 +280,15 @@ macx { SOURCES += src/AppleEvents.cc } -target.path = /usr/local/bin/ +isEmpty(PREFIX):PREFIX = /usr/local + +target.path = $$PREFIX/bin/ INSTALLS += target -examples.path = /usr/local/share/openscad/examples/ +examples.path = $$PREFIX/share/openscad/examples/ examples.files = examples/* INSTALLS += examples -libraries.path = /usr/local/share/openscad/libraries/ +libraries.path = $$PREFIX/share/openscad/libraries/ libraries.files = libraries/* INSTALLS += libraries diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc index 550f300..797434f 100644 --- a/src/CGALEvaluator.cc +++ b/src/CGALEvaluator.cc @@ -56,20 +56,29 @@ void CGALEvaluator::process(CGAL_Nef_polyhedron &target, const CGAL_Nef_polyhedr if (src.empty()) return; // Empty polyhedron. This can happen for e.g. square([0,0]) if (target.dim != src.dim) return; // If someone tries to e.g. union 2d and 3d objects - switch (op) { - case CGE_UNION: - target += src; - break; - case CGE_INTERSECTION: - target *= src; - break; - case CGE_DIFFERENCE: - target -= src; - break; - case CGE_MINKOWSKI: - target.minkowski(src); - break; + CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION); + try { + switch (op) { + case CGE_UNION: + target += src; + break; + case CGE_INTERSECTION: + target *= src; + break; + case CGE_DIFFERENCE: + target -= src; + break; + case CGE_MINKOWSKI: + target.minkowski(src); + break; + } + } + catch (CGAL::Assertion_exception e) { + // union && difference assert triggered by testdata/scad/bugs/rotate-diff-nonmanifold-crash.scad + std::string opstr = op == CGE_UNION ? "union" : op == CGE_INTERSECTION ? "intersection" : op == CGE_DIFFERENCE ? "difference" : op == CGE_MINKOWSKI ? "minkowski" : "UNKNOWN"; + PRINTF("CGAL error in CGAL_Nef_polyhedron's %s operator: %s", opstr.c_str(), e.what()); } + CGAL::set_error_behaviour(old_behaviour); } /*! diff --git a/src/CGAL_Nef_polyhedron.cc b/src/CGAL_Nef_polyhedron.cc index 975c9a4..2538b64 100644 --- a/src/CGAL_Nef_polyhedron.cc +++ b/src/CGAL_Nef_polyhedron.cc @@ -6,8 +6,6 @@ #include "dxfdata.h" #include "dxftess.h" #include <CGAL/minkowski_sum_3.h> -#include <CGAL/assertions_behaviour.h> -#include <CGAL/exceptions.h> CGAL_Nef_polyhedron& CGAL_Nef_polyhedron::operator+=(const CGAL_Nef_polyhedron &other) { @@ -34,15 +32,8 @@ extern CGAL_Nef_polyhedron2 minkowski2(const CGAL_Nef_polyhedron2 &a, const CGAL CGAL_Nef_polyhedron &CGAL_Nef_polyhedron::minkowski(const CGAL_Nef_polyhedron &other) { - CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION); - try { - if (this->dim == 2) (*this->p2) = minkowski2(*this->p2, *other.p2); - else if (this->dim == 3) (*this->p3) = CGAL::minkowski_sum_3(*this->p3, *other.p3); - } - catch (CGAL::Assertion_exception e) { - PRINTF("CGAL error in minkowski %s", e.what()); - CGAL::set_error_behaviour(old_behaviour); - } + if (this->dim == 2) (*this->p2) = minkowski2(*this->p2, *other.p2); + else if (this->dim == 3) (*this->p3) = CGAL::minkowski_sum_3(*this->p3, *other.p3); return *this; } diff --git a/src/CGAL_Nef_polyhedron.h b/src/CGAL_Nef_polyhedron.h index 79d36b7..fda4bc5 100644 --- a/src/CGAL_Nef_polyhedron.h +++ b/src/CGAL_Nef_polyhedron.h @@ -1,8 +1,6 @@ #ifndef CGAL_NEF_POLYHEDRON_H_ #define CGAL_NEF_POLYHEDRON_H_ -#ifdef ENABLE_CGAL - #include "cgalfwd.h" #include "memory.h" @@ -29,6 +27,4 @@ public: shared_ptr<CGAL_Nef_polyhedron3> p3; }; -#endif /* ENABLE_CGAL */ - #endif diff --git a/src/PolySetCGALEvaluator.cc b/src/PolySetCGALEvaluator.cc index 190d75a..ddb9771 100644 --- a/src/PolySetCGALEvaluator.cc +++ b/src/PolySetCGALEvaluator.cc @@ -262,7 +262,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const LinearExtrudeNode &node) if (v->modinst->tag_background) continue; CGAL_Nef_polyhedron N = this->cgalevaluator.evaluateCGALMesh(*v); if (N.dim != 2) { - PRINT("ERROR: rotate_extrude() is not defined for 3D child objects!"); + PRINT("ERROR: linear_extrude() is not defined for 3D child objects!"); } else { if (sum.empty()) sum = N.copy(); diff --git a/src/builtin.cc b/src/builtin.cc new file mode 100644 index 0000000..6eb32b6 --- /dev/null +++ b/src/builtin.cc @@ -0,0 +1,86 @@ +#include "builtin.h" +#include "function.h" +#include "module.h" +#include <boost/foreach.hpp> + +Builtins *Builtins::instance(bool erase) +{ + static Builtins *s_builtins = new Builtins; + if (erase) { + delete s_builtins; + s_builtins = NULL; + } + return s_builtins; +} + +void Builtins::init(const char *name, class AbstractModule *module) +{ + Builtins::instance()->builtinmodules[name] = module; +} + +void Builtins::init(const char *name, class AbstractFunction *function) +{ + Builtins::instance()->builtinfunctions[name] = function; +} + +extern void register_builtin_functions(); +extern void register_builtin_csgops(); +extern void register_builtin_transform(); +extern void register_builtin_color(); +extern void register_builtin_primitives(); +extern void register_builtin_surface(); +extern void register_builtin_control(); +extern void register_builtin_render(); +extern void register_builtin_import(); +extern void register_builtin_projection(); +extern void register_builtin_cgaladv(); +extern void register_builtin_dxf_linear_extrude(); +extern void register_builtin_dxf_rotate_extrude(); +extern void initialize_builtin_dxf_dim(); + +/*! + Registers all builtin functions. + Call once for the whole app. +*/ +void Builtins::initialize() +{ + register_builtin_functions(); + initialize_builtin_dxf_dim(); + + init("group", new AbstractModule()); + + register_builtin_csgops(); + register_builtin_transform(); + register_builtin_color(); + register_builtin_primitives(); + register_builtin_surface(); + register_builtin_control(); + register_builtin_render(); + register_builtin_import(); + register_builtin_projection(); + register_builtin_cgaladv(); + register_builtin_dxf_linear_extrude(); + register_builtin_dxf_rotate_extrude(); + + this->deprecations["dxf_linear_extrude"] = "linear_extrude"; + this->deprecations["dxf_rotate_extrude"] = "rotate_extrude"; + this->deprecations["import_stl"] = "import"; + this->deprecations["import_dxf"] = "import"; + this->deprecations["import_off"] = "import"; +} + +std::string Builtins::isDeprecated(const std::string &name) +{ + if (this->deprecations.find(name) != this->deprecations.end()) { + return this->deprecations[name]; + } + return std::string(); +} + +Builtins::~Builtins() +{ + BOOST_FOREACH(FunctionContainer::value_type &f, this->builtinfunctions) delete f.second; + this->builtinfunctions.clear(); + BOOST_FOREACH(ModuleContainer::value_type &m, this->builtinmodules) delete m.second; + this->builtinmodules.clear(); +} diff --git a/src/builtin.h b/src/builtin.h index ae526f2..bc096e5 100644 --- a/src/builtin.h +++ b/src/builtin.h @@ -4,26 +4,31 @@ #include <string> #include <boost/unordered_map.hpp> -extern boost::unordered_map<std::string, class AbstractFunction*> builtin_functions; -extern void initialize_builtin_functions(); -extern void destroy_builtin_functions(); - -extern boost::unordered_map<std::string, class AbstractModule*> builtin_modules; -extern void initialize_builtin_modules(); -extern void destroy_builtin_modules(); - -extern void register_builtin_csgops(); -extern void register_builtin_transform(); -extern void register_builtin_color(); -extern void register_builtin_primitives(); -extern void register_builtin_surface(); -extern void register_builtin_control(); -extern void register_builtin_render(); -extern void register_builtin_import(); -extern void register_builtin_projection(); -extern void register_builtin_cgaladv(); -extern void register_builtin_dxf_linear_extrude(); -extern void register_builtin_dxf_rotate_extrude(); -extern void initialize_builtin_dxf_dim(); +class Builtins +{ +public: + typedef boost::unordered_map<std::string, class AbstractFunction*> FunctionContainer; + typedef boost::unordered_map<std::string, class AbstractModule*> ModuleContainer; + + static Builtins *instance(bool erase = false); + static void init(const char *name, class AbstractModule *module); + static void init(const char *name, class AbstractFunction *function); + void initialize(); + std::string isDeprecated(const std::string &name); + + const FunctionContainer &functions() { return this->builtinfunctions; } + const ModuleContainer &modules() { return this->builtinmodules; } + +private: + Builtins() { } + ~Builtins(); + + FunctionContainer builtinfunctions; + ModuleContainer builtinmodules; + + boost::unordered_map<std::string, std::string> deprecations; +}; + +extern void register_builtin(class Context &ctx); #endif diff --git a/src/cgaladv.cc b/src/cgaladv.cc index c83e18b..9abf87c 100644 --- a/src/cgaladv.cc +++ b/src/cgaladv.cc @@ -97,14 +97,6 @@ PolySet *CgaladvNode::evaluate_polyset(PolySetEvaluator *ps) const return ps->evaluatePolySet(*this); } -void register_builtin_cgaladv() -{ - builtin_modules["minkowski"] = new CgaladvModule(MINKOWSKI); - builtin_modules["glide"] = new CgaladvModule(GLIDE); - builtin_modules["subdiv"] = new CgaladvModule(SUBDIV); - builtin_modules["hull"] = new CgaladvModule(HULL); -} - std::string CgaladvNode::name() const { switch (this->type) { @@ -149,3 +141,11 @@ std::string CgaladvNode::toString() const return stream.str(); } + +void register_builtin_cgaladv() +{ + Builtins::init("minkowski", new CgaladvModule(MINKOWSKI)); + Builtins::init("glide", new CgaladvModule(GLIDE)); + Builtins::init("subdiv", new CgaladvModule(SUBDIV)); + Builtins::init("hull", new CgaladvModule(HULL)); +} diff --git a/src/color.cc b/src/color.cc index 3c6942c..304ccc1 100644 --- a/src/color.cc +++ b/src/color.cc @@ -101,5 +101,5 @@ std::string ColorNode::name() const void register_builtin_color() { - builtin_modules["color"] = new ColorModule(); + Builtins::init("color", new ColorModule()); } diff --git a/src/context.cc b/src/context.cc index b4983f6..bd97f8f 100644 --- a/src/context.cc +++ b/src/context.cc @@ -150,20 +150,9 @@ AbstractNode *Context::evaluate_module(const ModuleInstantiation &inst) const { if (this->modules_p && this->modules_p->find(inst.modname) != this->modules_p->end()) { AbstractModule *m = this->modules_p->find(inst.modname)->second; - if (m == builtin_modules["dxf_linear_extrude"]) { - PRINTF("DEPRECATED: The dxf_linear_extrude() module will be removed in future releases. Use a linear_extrude() instead."); - } - else if (m == builtin_modules["dxf_rotate_extrude"]) { - PRINTF("DEPRECATED: The dxf_rotate_extrude() module will be removed in future releases. Use a rotate_extrude() instead."); - } - else if (m == builtin_modules["import_stl"]) { - PRINTF("DEPRECATED: The import_stl() module will be removed in future releases. Use import() instead."); - } - else if (m == builtin_modules["import_dxf"]) { - PRINTF("DEPRECATED: The import_dxf() module will be removed in future releases. Use import() instead."); - } - else if (m == builtin_modules["import_off"]) { - PRINTF("DEPRECATED: The import_off() module will be removed in future releases. Use import() instead."); + std::string replacement = Builtins::instance()->isDeprecated(inst.modname); + if (!replacement.empty()) { + PRINTF("DEPRECATED: The %s() module will be removed in future releases. Use %s() instead.", inst.modname.c_str(), replacement.c_str()); } return m->evaluate(this, &inst); } @@ -193,3 +182,23 @@ std::string Context::getAbsolutePath(const std::string &filename) const return filename; } } + +void register_builtin(Context &ctx) +{ + ctx.functions_p = &Builtins::instance()->functions(); + ctx.modules_p = &Builtins::instance()->modules(); + ctx.set_variable("$fn", Value(0.0)); + ctx.set_variable("$fs", Value(1.0)); + ctx.set_variable("$fa", Value(12.0)); + ctx.set_variable("$t", Value(0.0)); + + Value zero3; + zero3.type = Value::VECTOR; + zero3.append(new Value(0.0)); + zero3.append(new Value(0.0)); + zero3.append(new Value(0.0)); + ctx.set_variable("$vpt", zero3); + ctx.set_variable("$vpr", zero3); + + ctx.set_constant("PI",Value(M_PI)); +} diff --git a/src/control.cc b/src/control.cc index 1f79254..2275c79 100644 --- a/src/control.cc +++ b/src/control.cc @@ -169,11 +169,10 @@ AbstractNode *ControlModule::evaluate(const Context*, const ModuleInstantiation void register_builtin_control() { - builtin_modules["child"] = new ControlModule(CHILD); - builtin_modules["echo"] = new ControlModule(ECHO); - builtin_modules["assign"] = new ControlModule(ASSIGN); - builtin_modules["for"] = new ControlModule(FOR); - builtin_modules["intersection_for"] = new ControlModule(INT_FOR); - builtin_modules["if"] = new ControlModule(IF); + Builtins::init("child", new ControlModule(CHILD)); + Builtins::init("echo", new ControlModule(ECHO)); + Builtins::init("assign", new ControlModule(ASSIGN)); + Builtins::init("for", new ControlModule(FOR)); + Builtins::init("intersection_for", new ControlModule(INT_FOR)); + Builtins::init("if", new ControlModule(IF)); } - diff --git a/src/csgops.cc b/src/csgops.cc index 7b363f0..7524559 100644 --- a/src/csgops.cc +++ b/src/csgops.cc @@ -72,8 +72,8 @@ std::string CsgNode::name() const void register_builtin_csgops() { - builtin_modules["union"] = new CsgModule(CSG_TYPE_UNION); - builtin_modules["difference"] = new CsgModule(CSG_TYPE_DIFFERENCE); - builtin_modules["intersection"] = new CsgModule(CSG_TYPE_INTERSECTION); + Builtins::init("union", new CsgModule(CSG_TYPE_UNION)); + Builtins::init("difference", new CsgModule(CSG_TYPE_DIFFERENCE)); + Builtins::init("intersection", new CsgModule(CSG_TYPE_INTERSECTION)); } diff --git a/src/dxfdim.cc b/src/dxfdim.cc index 7b016f1..c696226 100644 --- a/src/dxfdim.cc +++ b/src/dxfdim.cc @@ -194,7 +194,6 @@ Value builtin_dxf_cross(const Context *ctx, const std::vector<std::string> &argn void initialize_builtin_dxf_dim() { - builtin_functions["dxf_dim"] = new BuiltinFunction(&builtin_dxf_dim); - builtin_functions["dxf_cross"] = new BuiltinFunction(&builtin_dxf_cross); + Builtins::init("dxf_dim", new BuiltinFunction(&builtin_dxf_dim)); + Builtins::init("dxf_cross", new BuiltinFunction(&builtin_dxf_cross)); } - diff --git a/src/func.cc b/src/func.cc index b011a27..a9d5948 100644 --- a/src/func.cc +++ b/src/func.cc @@ -33,7 +33,6 @@ #include "mathc99.h" #include <algorithm> #include "stl-utils.h" -#include <boost/foreach.hpp> AbstractFunction::~AbstractFunction() { @@ -81,9 +80,6 @@ std::string Function::dump(const std::string &indent, const std::string &name) c return dump.str(); } -typedef boost::unordered_map<std::string, AbstractFunction*> BuiltinContainer; -BuiltinContainer builtin_functions; - BuiltinFunction::~BuiltinFunction() { } @@ -375,38 +371,30 @@ Value builtin_version_num(const Context *ctx, const std::vector<std::string>& ca return Value(y * 10000 + m * 100 + d); } -void initialize_builtin_functions() -{ - builtin_functions["abs"] = new BuiltinFunction(&builtin_abs); - builtin_functions["sign"] = new BuiltinFunction(&builtin_sign); - builtin_functions["rands"] = new BuiltinFunction(&builtin_rands); - builtin_functions["min"] = new BuiltinFunction(&builtin_min); - builtin_functions["max"] = new BuiltinFunction(&builtin_max); - builtin_functions["sin"] = new BuiltinFunction(&builtin_sin); - builtin_functions["cos"] = new BuiltinFunction(&builtin_cos); - builtin_functions["asin"] = new BuiltinFunction(&builtin_asin); - builtin_functions["acos"] = new BuiltinFunction(&builtin_acos); - builtin_functions["tan"] = new BuiltinFunction(&builtin_tan); - builtin_functions["atan"] = new BuiltinFunction(&builtin_atan); - builtin_functions["atan2"] = new BuiltinFunction(&builtin_atan2); - builtin_functions["round"] = new BuiltinFunction(&builtin_round); - builtin_functions["ceil"] = new BuiltinFunction(&builtin_ceil); - builtin_functions["floor"] = new BuiltinFunction(&builtin_floor); - builtin_functions["pow"] = new BuiltinFunction(&builtin_pow); - builtin_functions["sqrt"] = new BuiltinFunction(&builtin_sqrt); - builtin_functions["exp"] = new BuiltinFunction(&builtin_exp); - builtin_functions["log"] = new BuiltinFunction(&builtin_log); - builtin_functions["ln"] = new BuiltinFunction(&builtin_ln); - builtin_functions["str"] = new BuiltinFunction(&builtin_str); - builtin_functions["lookup"] = new BuiltinFunction(&builtin_lookup); - builtin_functions["version"] = new BuiltinFunction(&builtin_version); - builtin_functions["version_num"] = new BuiltinFunction(&builtin_version_num); - initialize_builtin_dxf_dim(); -} - -void destroy_builtin_functions() -{ - BOOST_FOREACH(BuiltinContainer::value_type &f, builtin_functions) delete f.second; -//std::for_each(builtin_functions.begin(), builtin_functions.end(), del_fun<AbstractFunction>()); - builtin_functions.clear(); +void register_builtin_functions() +{ + Builtins::init("abs", new BuiltinFunction(&builtin_abs)); + Builtins::init("sign", new BuiltinFunction(&builtin_sign)); + Builtins::init("rands", new BuiltinFunction(&builtin_rands)); + Builtins::init("min", new BuiltinFunction(&builtin_min)); + Builtins::init("max", new BuiltinFunction(&builtin_max)); + Builtins::init("sin", new BuiltinFunction(&builtin_sin)); + Builtins::init("cos", new BuiltinFunction(&builtin_cos)); + Builtins::init("asin", new BuiltinFunction(&builtin_asin)); + Builtins::init("acos", new BuiltinFunction(&builtin_acos)); + Builtins::init("tan", new BuiltinFunction(&builtin_tan)); + Builtins::init("atan", new BuiltinFunction(&builtin_atan)); + Builtins::init("atan2", new BuiltinFunction(&builtin_atan2)); + Builtins::init("round", new BuiltinFunction(&builtin_round)); + Builtins::init("ceil", new BuiltinFunction(&builtin_ceil)); + Builtins::init("floor", new BuiltinFunction(&builtin_floor)); + Builtins::init("pow", new BuiltinFunction(&builtin_pow)); + Builtins::init("sqrt", new BuiltinFunction(&builtin_sqrt)); + Builtins::init("exp", new BuiltinFunction(&builtin_exp)); + Builtins::init("log", new BuiltinFunction(&builtin_log)); + Builtins::init("ln", new BuiltinFunction(&builtin_ln)); + Builtins::init("str", new BuiltinFunction(&builtin_str)); + Builtins::init("lookup", new BuiltinFunction(&builtin_lookup)); + Builtins::init("version", new BuiltinFunction(&builtin_version)); + Builtins::init("version_num", new BuiltinFunction(&builtin_version_num)); } diff --git a/src/import.cc b/src/import.cc index d86a60d..880823d 100644 --- a/src/import.cc +++ b/src/import.cc @@ -236,7 +236,7 @@ std::string ImportNode::toString() const stream << "(file = \"" << this->filename << "\", " "cache = \"" << std::hex << (int)st.st_mtime << "." << (int)st.st_size << "\", " "layer = \"" << this->layername << "\", " - "origin = [ " << std::dec << this->origin_x << " " << this->origin_y << " ], " + "origin = [" << std::dec << this->origin_x << ", " << this->origin_y << "], " "scale = " << this->scale << ", " "convexity = " << this->convexity << ", " "$fn = " << this->fn << ", $fa = " << this->fa << ", $fs = " << this->fs << ")"; @@ -251,9 +251,8 @@ std::string ImportNode::name() const void register_builtin_import() { - builtin_modules["import_stl"] = new ImportModule(TYPE_STL); - builtin_modules["import_off"] = new ImportModule(TYPE_OFF); - builtin_modules["import_dxf"] = new ImportModule(TYPE_DXF); - builtin_modules["import"] = new ImportModule(); + Builtins::init("import_stl", new ImportModule(TYPE_STL)); + Builtins::init("import_off", new ImportModule(TYPE_OFF)); + Builtins::init("import_dxf", new ImportModule(TYPE_DXF)); + Builtins::init("import", new ImportModule()); } - diff --git a/src/lexer.l b/src/lexer.l index d9ccd76..2760b07 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -88,7 +88,8 @@ QString filepath; %x comment string %x include -DIGIT [0-9] +D [0-9] +E [Ee][+-]?{D}+ %% @@ -155,8 +156,10 @@ use[ \t\r\n>]*"<"[^\t\r\n>]+">" { "false" return TOK_FALSE; "undef" return TOK_UNDEF; -{DIGIT}+|{DIGIT}*\.{DIGIT}+|{DIGIT}+\.{DIGIT}* { parserlval.number = QString(yytext).toDouble(); return TOK_NUMBER; } -"$"?[a-zA-Z0-9_]+ { parserlval.text = strdup(yytext); return TOK_ID; } +{D}+{E}? | +{D}*\.{D}+{E}? | +{D}+\.{D}*{E}? { parserlval.number = QString(yytext).toDouble(); return TOK_NUMBER; } +"$"?[a-zA-Z0-9_]+ { parserlval.text = strdup(yytext); return TOK_ID; } \" { BEGIN(string); stringcontents = new QString(); } <string>{ diff --git a/src/linearextrude.cc b/src/linearextrude.cc index 9c3557b..d1d2841 100644 --- a/src/linearextrude.cc +++ b/src/linearextrude.cc @@ -114,12 +114,6 @@ AbstractNode *LinearExtrudeModule::evaluate(const Context *ctx, const ModuleInst return node; } -void register_builtin_dxf_linear_extrude() -{ - builtin_modules["dxf_linear_extrude"] = new LinearExtrudeModule(); - builtin_modules["linear_extrude"] = new LinearExtrudeModule(); -} - class PolySet *LinearExtrudeNode::evaluate_polyset(PolySetEvaluator *evaluator) const { if (!evaluator) { @@ -146,7 +140,7 @@ std::string LinearExtrudeNode::toString() const "file = \"" << this->filename << "\", " "cache = \"" << QFileInfo(QString::fromStdString(this->filename)) << "\", " "layer = \"" << this->layername << "\", " - "origin = [ " << this->origin_x << " " << this->origin_y << " ], " + "origin = [" << this->origin_x << ", " << this->origin_y << "], " "scale = " << this->scale << ", "; } stream << @@ -161,3 +155,9 @@ std::string LinearExtrudeNode::toString() const return stream.str(); } + +void register_builtin_dxf_linear_extrude() +{ + Builtins::init("dxf_linear_extrude", new LinearExtrudeModule()); + Builtins::init("linear_extrude", new LinearExtrudeModule()); +} diff --git a/src/mainwin.cc b/src/mainwin.cc index 9944f67..a6f5be6 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -143,22 +143,7 @@ MainWindow::MainWindow(const QString &filename) { setupUi(this); - root_ctx.functions_p = &builtin_functions; - root_ctx.modules_p = &builtin_modules; - root_ctx.set_variable("$fn", Value(0.0)); - root_ctx.set_variable("$fs", Value(1.0)); - root_ctx.set_variable("$fa", Value(12.0)); - root_ctx.set_variable("$t", Value(0.0)); - - root_ctx.set_constant("PI",Value(M_PI)); - - Value zero3; - zero3.type = Value::VECTOR; - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - root_ctx.set_variable("$vpt", zero3); - root_ctx.set_variable("$vpr", zero3); + register_builtin(root_ctx); root_module = NULL; absolute_root_node = NULL; diff --git a/src/module.cc b/src/module.cc index 0b17ff7..269e128 100644 --- a/src/module.cc +++ b/src/module.cc @@ -29,7 +29,6 @@ #include "context.h" #include "expression.h" #include "function.h" -#include "builtin.h" #include "printutils.h" #include <boost/foreach.hpp> #include <sstream> @@ -201,31 +200,3 @@ std::string Module::dump(const std::string &indent, const std::string &name) con } return dump.str(); } - -Module::AbstractModuleContainer builtin_modules; - -void initialize_builtin_modules() -{ - builtin_modules["group"] = new AbstractModule(); - - register_builtin_csgops(); - register_builtin_transform(); - register_builtin_color(); - register_builtin_primitives(); - register_builtin_surface(); - register_builtin_control(); - register_builtin_render(); - register_builtin_import(); - register_builtin_projection(); - register_builtin_cgaladv(); - register_builtin_dxf_linear_extrude(); - register_builtin_dxf_rotate_extrude(); -} - -void destroy_builtin_modules() -{ - BOOST_FOREACH(Module::AbstractModuleContainer::value_type &m, builtin_modules) { - delete m.second; - } - builtin_modules.clear(); -} diff --git a/src/node.cc b/src/node.cc index 12a7ca4..a4d70be 100644 --- a/src/node.cc +++ b/src/node.cc @@ -78,7 +78,9 @@ std::string AbstractIntersectionNode::toString() const std::string AbstractIntersectionNode::name() const { - return "intersection_for"; + // We write intersection here since the module will have to be evaluated + // before we get here and it will not longer retain the intersection_for parameters + return "intersection"; } void AbstractNode::progress_prepare() @@ -38,7 +38,6 @@ public: /*! Should return a PolySet of the given geometry. Returns NULL if smth. goes wrong */ virtual class PolySet *evaluate_polyset(class PolySetEvaluator *) const { return NULL; } - // FIXME: Make return value a reference const std::vector<AbstractNode*> &getChildren() const { return this->children; } diff --git a/src/openscad.cc b/src/openscad.cc index 4ff250d..d708a8e 100644 --- a/src/openscad.cc +++ b/src/openscad.cc @@ -70,7 +70,7 @@ namespace po = boost::program_options; static void help(const char *progname) { - fprintf(stderr, "Usage: %s [ { -o output_file } [ -d deps_file ] ]\\\n" + fprintf(stderr, "Usage: %s [ -o output_file [ -d deps_file ] ]\\\n" "%*s[ -m make_command ] [ -D var=val [..] ] filename\n", progname, int(strlen(progname))+8, ""); exit(1); @@ -101,8 +101,7 @@ int main(int argc, char **argv) // (which we don't catch). This gives us stack traces without rerunning in gdb. CGAL::set_error_behaviour(CGAL::ABORT); #endif - initialize_builtin_functions(); - initialize_builtin_modules(); + Builtins::instance()->initialize(); #ifdef Q_WS_X11 // see <http://qt.nokia.com/doc/4.5/qapplication.html#QApplication-2>: @@ -124,6 +123,7 @@ int main(int argc, char **argv) QCoreApplication::setOrganizationName("OpenSCAD"); QCoreApplication::setOrganizationDomain("openscad.org"); QCoreApplication::setApplicationName("OpenSCAD"); + QCoreApplication::setApplicationVersion(TOSTRING(OPENSCAD_VERSION)); const char *filename = NULL; const char *output_file = NULL; @@ -134,6 +134,8 @@ int main(int argc, char **argv) ("help,h", "help message") ("version,v", "print the version") ("o,o", po::value<string>(), "out-file") + ("s,s", po::value<string>(), "stl-file") + ("x,x", po::value<string>(), "dxf-file") ("d,d", po::value<string>(), "deps-file") ("m,m", po::value<string>(), "makefile") ("D,D", po::value<vector<string> >(), "var=val"); @@ -160,6 +162,16 @@ int main(int argc, char **argv) if (output_file) help(argv[0]); output_file = vm["o"].as<string>().c_str(); } + if (vm.count("s")) { + fprintf(stderr, "DEPRECATED: The -s option is deprecated. Use -o instead.\n"); + if (output_file) help(argv[0]); + output_file = vm["s"].as<string>().c_str(); + } + if (vm.count("x")) { + fprintf(stderr, "DEPRECATED: The -x option is deprecated. Use -o instead.\n"); + if (output_file) help(argv[0]); + output_file = vm["x"].as<string>().c_str(); + } if (vm.count("d")) { if (deps_output_file) help(argv[0]); @@ -260,21 +272,7 @@ int main(int argc, char **argv) #ifdef ENABLE_CGAL Context root_ctx; - root_ctx.functions_p = &builtin_functions; - root_ctx.modules_p = &builtin_modules; - root_ctx.set_variable("$fn", Value(0.0)); - root_ctx.set_variable("$fs", Value(1.0)); - root_ctx.set_variable("$fa", Value(12.0)); - root_ctx.set_variable("$t", Value(0.0)); - - Value zero3; - zero3.type = Value::VECTOR; - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - root_ctx.set_variable("$vpt", zero3); - root_ctx.set_variable("$vpr", zero3); - + register_builtin(root_ctx); AbstractModule *root_module; ModuleInstantiation root_inst; @@ -422,8 +420,7 @@ int main(int argc, char **argv) exit(1); } - destroy_builtin_functions(); - destroy_builtin_modules(); + Builtins::instance(true); return rc; } diff --git a/src/polyset.cc b/src/polyset.cc index 1d31005..742e425 100644 --- a/src/polyset.cc +++ b/src/polyset.cc @@ -27,10 +27,6 @@ #include "polyset.h" // FIXME: Reenable/rewrite - don't be dependant on GUI // #include "Preferences.h" -#ifdef ENABLE_CGAL -#include <CGAL/assertions_behaviour.h> -#include <CGAL/exceptions.h> -#endif #include "linalg.h" #include <Eigen/LU> #include <QColor> diff --git a/src/primitives.cc b/src/primitives.cc index a651ff8..b18a816 100644 --- a/src/primitives.cc +++ b/src/primitives.cc @@ -236,17 +236,6 @@ AbstractNode *PrimitiveModule::evaluate(const Context *ctx, const ModuleInstanti return node; } -void register_builtin_primitives() -{ - builtin_modules["cube"] = new PrimitiveModule(CUBE); - builtin_modules["sphere"] = new PrimitiveModule(SPHERE); - builtin_modules["cylinder"] = new PrimitiveModule(CYLINDER); - builtin_modules["polyhedron"] = new PrimitiveModule(POLYHEDRON); - builtin_modules["square"] = new PrimitiveModule(SQUARE); - builtin_modules["circle"] = new PrimitiveModule(CIRCLE); - builtin_modules["polygon"] = new PrimitiveModule(POLYGON); -} - /*! Returns the number of subdivision of a whole circle, given radius and the three special variables $fn, $fs and $fa @@ -606,3 +595,14 @@ std::string PrimitiveNode::toString() const return stream.str(); } + +void register_builtin_primitives() +{ + Builtins::init("cube", new PrimitiveModule(CUBE)); + Builtins::init("sphere", new PrimitiveModule(SPHERE)); + Builtins::init("cylinder", new PrimitiveModule(CYLINDER)); + Builtins::init("polyhedron", new PrimitiveModule(POLYHEDRON)); + Builtins::init("square", new PrimitiveModule(SQUARE)); + Builtins::init("circle", new PrimitiveModule(CIRCLE)); + Builtins::init("polygon", new PrimitiveModule(POLYGON)); +} diff --git a/src/projection.cc b/src/projection.cc index 1333d19..a712800 100644 --- a/src/projection.cc +++ b/src/projection.cc @@ -97,5 +97,5 @@ std::string ProjectionNode::toString() const void register_builtin_projection() { - builtin_modules["projection"] = new ProjectionModule(); + Builtins::init("projection", new ProjectionModule()); } diff --git a/src/render.cc b/src/render.cc index b79fa56..7b0ced5 100644 --- a/src/render.cc +++ b/src/render.cc @@ -67,11 +67,6 @@ class PolySet *RenderNode::evaluate_polyset(PolySetEvaluator *ps) const return ps->evaluatePolySet(*this); } -void register_builtin_render() -{ - builtin_modules["render"] = new RenderModule(); -} - std::string RenderNode::toString() const { std::stringstream stream; @@ -80,3 +75,8 @@ std::string RenderNode::toString() const return stream.str(); } + +void register_builtin_render() +{ + Builtins::init("render", new RenderModule()); +} diff --git a/src/rotateextrude.cc b/src/rotateextrude.cc index 4d6de73..ae8793d 100644 --- a/src/rotateextrude.cc +++ b/src/rotateextrude.cc @@ -92,12 +92,6 @@ AbstractNode *RotateExtrudeModule::evaluate(const Context *ctx, const ModuleInst return node; } -void register_builtin_dxf_rotate_extrude() -{ - builtin_modules["dxf_rotate_extrude"] = new RotateExtrudeModule(); - builtin_modules["rotate_extrude"] = new RotateExtrudeModule(); -} - PolySet *RotateExtrudeNode::evaluate_polyset(PolySetEvaluator *evaluator) const { if (!evaluator) { @@ -124,7 +118,7 @@ std::string RotateExtrudeNode::toString() const "file = \"" << this->filename << "\", " "cache = \"" << QFileInfo(QString::fromStdString(this->filename)) << "\", " "layer = \"" << this->layername << "\", " - "origin = [ " << std::dec << this->origin_x << " " << this->origin_y << " ], " + "origin = [" << std::dec << this->origin_x << ", " << this->origin_y << "], " "scale = " << this->scale << ", "; } stream << @@ -133,3 +127,9 @@ std::string RotateExtrudeNode::toString() const return stream.str(); } + +void register_builtin_dxf_rotate_extrude() +{ + Builtins::init("dxf_rotate_extrude", new RotateExtrudeModule()); + Builtins::init("rotate_extrude", new RotateExtrudeModule()); +} diff --git a/src/surface.cc b/src/surface.cc index 8349afd..cdac4ec 100644 --- a/src/surface.cc +++ b/src/surface.cc @@ -92,11 +92,6 @@ AbstractNode *SurfaceModule::evaluate(const Context *ctx, const ModuleInstantiat return node; } -void register_builtin_surface() -{ - builtin_modules["surface"] = new SurfaceModule(); -} - PolySet *SurfaceNode::evaluate_polyset(class PolySetEvaluator *) const { handle_dep(filename); @@ -219,3 +214,8 @@ std::string SurfaceNode::toString() const return stream.str(); } + +void register_builtin_surface() +{ + Builtins::init("surface", new SurfaceModule()); +} diff --git a/src/transform.cc b/src/transform.cc index eda69c2..f5038b1 100644 --- a/src/transform.cc +++ b/src/transform.cc @@ -206,9 +206,9 @@ std::string TransformNode::name() const void register_builtin_transform() { - builtin_modules["scale"] = new TransformModule(SCALE); - builtin_modules["rotate"] = new TransformModule(ROTATE); - builtin_modules["mirror"] = new TransformModule(MIRROR); - builtin_modules["translate"] = new TransformModule(TRANSLATE); - builtin_modules["multmatrix"] = new TransformModule(MULTMATRIX); + Builtins::init("scale", new TransformModule(SCALE)); + Builtins::init("rotate", new TransformModule(ROTATE)); + Builtins::init("mirror", new TransformModule(MIRROR)); + Builtins::init("translate", new TransformModule(TRANSLATE)); + Builtins::init("multmatrix", new TransformModule(MULTMATRIX)); } diff --git a/testdata/scad/bugs/rotate-diff-nonmanifold-crash.scad b/testdata/scad/bugs/rotate-diff-nonmanifold-crash.scad new file mode 100644 index 0000000..754a2a6 --- /dev/null +++ b/testdata/scad/bugs/rotate-diff-nonmanifold-crash.scad @@ -0,0 +1,9 @@ +difference() { + rotate_extrude($fn=5) translate([4,0,0]) square([10, 10], center=true); + translate([6,6,6]) sphere(r=10); +} + +union() { + rotate_extrude($fn=5) translate([4,0,0]) square([10, 10], center=true); + cylinder(h=5,r=3); +} diff --git a/testdata/scad/misc/builtin-tests.scad b/testdata/scad/misc/builtin-tests.scad new file mode 100644 index 0000000..6b5eac1 --- /dev/null +++ b/testdata/scad/misc/builtin-tests.scad @@ -0,0 +1 @@ +p = PI; echo(p); diff --git a/testdata/scad/misc/parser-tests.scad b/testdata/scad/misc/parser-tests.scad new file mode 100644 index 0000000..03cbded --- /dev/null +++ b/testdata/scad/misc/parser-tests.scad @@ -0,0 +1,7 @@ +// Number literals + +a = .1; echo(a); +b = 2.; echo(b); +c = 11e+2; echo(c); +d = 21.e-3; echo(d); +e = .11e-12; echo(e); diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 0000000..6b839c5 --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1,17 @@ +*-output +CMakeFiles +CMakeCache.txt +CTestTestfile.cmake +Testing +cmake_install.cmake +lexer.cpp +parser_yacc.c +cgalpngtest +cgaltest +csgtermtest +csgtexttest +dumptest +echotest +opencsgtest +throwntogethertest +yee_compare diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 6088ebc..2b60a09 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -158,6 +158,7 @@ include_directories(../src) add_definitions(-DOPENSCAD_VERSION=test -DOPENSCAD_YEAR=2011 -DOPENSCAD_MONTH=10) set(CORE_SOURCES + tests-common.cc ../src/mathc99.cc ../src/handle_dep.cc ../src/qhash.cc @@ -166,6 +167,7 @@ set(CORE_SOURCES ../src/func.cc ../src/module.cc ../src/node.cc + ../src/builtin.cc ../src/context.cc ../src/csgterm.cc ../src/polyset.cc @@ -322,15 +324,29 @@ file(GLOB MINIMAL_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/minimal/*.scad) file(GLOB FEATURES_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/features/*.scad) file(GLOB BUGS_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/bugs/*.scad) file(GLOB SCAD_DXF_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/dxf/*.scad) +file(GLOB EXAMPLE_FILES ${CMAKE_SOURCE_DIR}/../examples/*.scad) + +list(APPEND DUMPTEST_FILES ${MINIMAL_FILES} ${FEATURES_FILES} ${EXAMPLE_FILES}) +# Disable tests which are known to cause floating point comparison issues +# Once we're capable of comparing these across platforms, we can put these back in +list(REMOVE_ITEM DUMPTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/features/transform-tests.scad) +list(REMOVE_ITEM DUMPTEST_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/features/render-tests.scad) +list(REMOVE_ITEM DUMPTEST_FILES ${CMAKE_SOURCE_DIR}/../examples/example001.scad) +list(REMOVE_ITEM DUMPTEST_FILES ${CMAKE_SOURCE_DIR}/../examples/example005.scad) +list(REMOVE_ITEM DUMPTEST_FILES ${CMAKE_SOURCE_DIR}/../examples/example006.scad) +list(REMOVE_ITEM DUMPTEST_FILES ${CMAKE_SOURCE_DIR}/../examples/example020.scad) +list(REMOVE_ITEM DUMPTEST_FILES ${CMAKE_SOURCE_DIR}/../examples/example021.scad) list(APPEND ECHO_FILES ${CMAKE_SOURCE_DIR}/../testdata/scad/minimal/echo.scad - ${CMAKE_SOURCE_DIR}/../testdata/scad/features/echo-tests.scad) + ${CMAKE_SOURCE_DIR}/../testdata/scad/features/echo-tests.scad + ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/parser-tests.scad + ${CMAKE_SOURCE_DIR}/../testdata/scad/misc/builtin-tests.scad) # Add echotest tests to CTest add_cmdline_test(echotest txt ${ECHO_FILES}) # Add dumptest tests to CTest -add_cmdline_test(dumptest txt ${MINIMAL_FILES}) +add_cmdline_test(dumptest txt ${DUMPTEST_FILES}) # Add csgtexttest tests to CTest add_cmdline_test(csgtexttest txt ${MINIMAL_FILES}) # Add csgtermtest tests to CTest diff --git a/tests/OffscreenContext.mm b/tests/OffscreenContext.mm index eb2f777..2bbaffa 100644 --- a/tests/OffscreenContext.mm +++ b/tests/OffscreenContext.mm @@ -48,20 +48,20 @@ OffscreenContext *create_offscreen_context(int w, int h) glewInit(); #ifdef DEBUG - cout << "GLEW version " << glewGetString(GLEW_VERSION) << "\n"; - cout << (const char *)glGetString(GL_RENDERER) << "(" << (const char *)glGetString(GL_VENDOR) << ")\n" + std::cout << "GLEW version " << glewGetString(GLEW_VERSION) << "\n"; + std::cout << (const char *)glGetString(GL_RENDERER) << "(" << (const char *)glGetString(GL_VENDOR) << ")\n" << "OpenGL version " << (const char *)glGetString(GL_VERSION) << "\n"; - cout << "Extensions: " << (const char *)glGetString(GL_EXTENSIONS) << "\n"; + std::cout << "Extensions: " << (const char *)glGetString(GL_EXTENSIONS) << "\n"; if (GLEW_ARB_framebuffer_object) { - cout << "ARB_FBO supported\n"; + std::cout << "ARB_FBO supported\n"; } if (GLEW_EXT_framebuffer_object) { - cout << "EXT_FBO supported\n"; + std::cout << "EXT_FBO supported\n"; } if (GLEW_EXT_packed_depth_stencil) { - cout << "EXT_packed_depth_stencil\n"; + std::cout << "EXT_packed_depth_stencil\n"; } #endif diff --git a/tests/OffscreenView.cc b/tests/OffscreenView.cc index e34fbce..46951c1 100644 --- a/tests/OffscreenView.cc +++ b/tests/OffscreenView.cc @@ -16,6 +16,20 @@ OffscreenView::OffscreenView(size_t width, size_t height) for (int i = 0; i < 10; i++) this->shaderinfo[i] = 0; this->ctx = create_offscreen_context(width, height); if ( this->ctx == NULL ) throw -1; + +#ifdef DEBUG + GLint rbits, gbits, bbits, abits, dbits, sbits; + glGetIntegerv(GL_RED_BITS, &rbits); + glGetIntegerv(GL_GREEN_BITS, &gbits); + glGetIntegerv(GL_BLUE_BITS, &bbits); + glGetIntegerv(GL_ALPHA_BITS, &abits); + glGetIntegerv(GL_DEPTH_BITS, &dbits); + glGetIntegerv(GL_STENCIL_BITS, &sbits); + + fprintf(stderr, "FBO: RGBA(%d%d%d%d), depth(%d), stencil(%d)\n", + rbits, gbits, bbits, abits, dbits, sbits); +#endif + initializeGL(); resizeGL(width, height); } diff --git a/tests/cgalpngtest.cc b/tests/cgalpngtest.cc index 734f6eb..e9e1f7b 100644 --- a/tests/cgalpngtest.cc +++ b/tests/cgalpngtest.cc @@ -1,6 +1,7 @@ /* - * OpenSCAD (www.openscad.at) - * Copyright (C) 2009 Clifford Wolf <clifford@clifford.at> + * OpenSCAD (www.openscad.org) + * Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and + * Marius Kintel <marius@kintel.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,6 +25,7 @@ */ #include "myqhash.h" +#include "tests-common.h" #include "openscad.h" #include "node.h" #include "module.h" @@ -40,7 +42,6 @@ #include "CGAL_renderer.h" #include "cgal.h" #include "OffscreenView.h" -#include "handle_dep.h" #include <QApplication> #include <QFile> @@ -99,8 +100,7 @@ int main(int argc, char **argv) const char *filename = argv[1]; const char *outfile = argv[2]; - initialize_builtin_functions(); - initialize_builtin_modules(); + Builtins::instance()->initialize(); QApplication app(argc, argv, false); QDir original_path = QDir::current(); @@ -127,47 +127,17 @@ int main(int argc, char **argv) } Context root_ctx; - root_ctx.functions_p = &builtin_functions; - root_ctx.modules_p = &builtin_modules; - root_ctx.set_variable("$fn", Value(0.0)); - root_ctx.set_variable("$fs", Value(1.0)); - root_ctx.set_variable("$fa", Value(12.0)); - root_ctx.set_variable("$t", Value(0.0)); - - Value zero3; - zero3.type = Value::VECTOR; - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - root_ctx.set_variable("$vpt", zero3); - root_ctx.set_variable("$vpr", zero3); - + register_builtin(root_ctx); AbstractModule *root_module; ModuleInstantiation root_inst; - QFileInfo fileInfo(filename); - handle_dep(filename); - FILE *fp = fopen(filename, "rt"); - if (!fp) { - fprintf(stderr, "Can't open input file `%s'!\n", filename); + root_module = parsefile(filename); + if (!root_module) { exit(1); - } else { - std::stringstream text; - char buffer[513]; - int ret; - while ((ret = fread(buffer, 1, 512, fp)) > 0) { - buffer[ret] = 0; - text << buffer; - } - fclose(fp); - text << commandline_commands; - root_module = parse(text.str().c_str(), fileInfo.absolutePath().toLocal8Bit(), false); - if (!root_module) { - exit(1); - } } + QFileInfo fileInfo(filename); QDir::setCurrent(fileInfo.absolutePath()); AbstractNode::resetIndexCounter(); @@ -241,8 +211,7 @@ int main(int argc, char **argv) csgInfo.glview->paintGL(); csgInfo.glview->save(outfile); - destroy_builtin_functions(); - destroy_builtin_modules(); + Builtins::instance(true); return 0; } diff --git a/tests/cgaltest.cc b/tests/cgaltest.cc index 2c83cc8..0b433bf 100644 --- a/tests/cgaltest.cc +++ b/tests/cgaltest.cc @@ -1,6 +1,7 @@ /* - * OpenSCAD (www.openscad.at) - * Copyright (C) 2009 Clifford Wolf <clifford@clifford.at> + * OpenSCAD (www.openscad.org) + * Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and + * Marius Kintel <marius@kintel.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,8 +25,8 @@ */ #include "myqhash.h" +#include "tests-common.h" #include "openscad.h" -#include "handle_dep.h" #include "node.h" #include "module.h" #include "context.h" @@ -83,8 +84,7 @@ int main(int argc, char **argv) const char *filename = argv[1]; - initialize_builtin_functions(); - initialize_builtin_modules(); + Builtins::instance()->initialize(); QApplication app(argc, argv, false); QDir original_path = QDir::current(); @@ -111,47 +111,17 @@ int main(int argc, char **argv) } Context root_ctx; - root_ctx.functions_p = &builtin_functions; - root_ctx.modules_p = &builtin_modules; - root_ctx.set_variable("$fn", Value(0.0)); - root_ctx.set_variable("$fs", Value(1.0)); - root_ctx.set_variable("$fa", Value(12.0)); - root_ctx.set_variable("$t", Value(0.0)); - - Value zero3; - zero3.type = Value::VECTOR; - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - root_ctx.set_variable("$vpt", zero3); - root_ctx.set_variable("$vpr", zero3); - + register_builtin(root_ctx); AbstractModule *root_module; ModuleInstantiation root_inst; - QFileInfo fileInfo(filename); - handle_dep(filename); - FILE *fp = fopen(filename, "rt"); - if (!fp) { - fprintf(stderr, "Can't open input file `%s'!\n", filename); + root_module = parsefile(filename); + if (!root_module) { exit(1); - } else { - std::stringstream text; - char buffer[513]; - int ret; - while ((ret = fread(buffer, 1, 512, fp)) > 0) { - buffer[ret] = 0; - text << buffer; - } - fclose(fp); - text << commandline_commands; - root_module = parse(text.str().c_str(), fileInfo.absolutePath().toLocal8Bit(), false); - if (!root_module) { - exit(1); - } } + QFileInfo fileInfo(filename); QDir::setCurrent(fileInfo.absolutePath()); AbstractNode::resetIndexCounter(); @@ -171,8 +141,8 @@ int main(int argc, char **argv) if (!N.empty()) { export_stl(&N, std::cout, NULL); } - destroy_builtin_functions(); - destroy_builtin_modules(); + + Builtins::instance(true); return 0; } diff --git a/tests/csgtermtest.cc b/tests/csgtermtest.cc index 643a64f..c8fcc6b 100644 --- a/tests/csgtermtest.cc +++ b/tests/csgtermtest.cc @@ -1,6 +1,7 @@ /* - * OpenSCAD (www.openscad.at) - * Copyright (C) 2009 Clifford Wolf <clifford@clifford.at> + * OpenSCAD (www.openscad.org) + * Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and + * Marius Kintel <marius@kintel.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,10 +25,10 @@ */ #include "myqhash.h" +#include "tests-common.h" #include "PolySetEvaluator.h" #include "CSGTermEvaluator.h" #include "openscad.h" -#include "handle_dep.h" #include "node.h" #include "module.h" #include "context.h" @@ -68,8 +69,7 @@ int main(int argc, char **argv) int rc = 0; - initialize_builtin_functions(); - initialize_builtin_modules(); + Builtins::instance()->initialize(); QApplication app(argc, argv, false); QDir original_path = QDir::current(); @@ -96,48 +96,18 @@ int main(int argc, char **argv) } Context root_ctx; - root_ctx.functions_p = &builtin_functions; - root_ctx.modules_p = &builtin_modules; - root_ctx.set_variable("$fn", Value(0.0)); - root_ctx.set_variable("$fs", Value(1.0)); - root_ctx.set_variable("$fa", Value(12.0)); - root_ctx.set_variable("$t", Value(0.0)); - - Value zero3; - zero3.type = Value::VECTOR; - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - root_ctx.set_variable("$vpt", zero3); - root_ctx.set_variable("$vpr", zero3); - + register_builtin(root_ctx); AbstractModule *root_module; ModuleInstantiation root_inst; const AbstractNode *root_node; - QFileInfo fileInfo(filename); - handle_dep(filename); - FILE *fp = fopen(filename, "rt"); - if (!fp) { - fprintf(stderr, "Can't open input file `%s'!\n", filename); + root_module = parsefile(filename); + if (!root_module) { exit(1); - } else { - std::stringstream text; - char buffer[513]; - int ret; - while ((ret = fread(buffer, 1, 512, fp)) > 0) { - buffer[ret] = 0; - text << buffer; - } - fclose(fp); - text << commandline_commands; - root_module = parse(text.str().c_str(), fileInfo.absolutePath().toLocal8Bit(), false); - if (!root_module) { - exit(1); - } } + QFileInfo fileInfo(filename); QDir::setCurrent(fileInfo.absolutePath()); AbstractNode::resetIndexCounter(); @@ -163,6 +133,7 @@ int main(int argc, char **argv) // if (evaluator.background) cout << "Background terms: " << evaluator.background->size() << "\n"; // if (evaluator.highlights) cout << "Highlights terms: " << evaluator.highlights->size() << "\n"; + QDir::setCurrent(original_path.absolutePath()); std::ofstream outfile; outfile.open(outfilename); if (root_term) { @@ -173,8 +144,7 @@ int main(int argc, char **argv) } outfile.close(); - destroy_builtin_functions(); - destroy_builtin_modules(); + Builtins::instance(true); return rc; } diff --git a/tests/csgtestcore.cc b/tests/csgtestcore.cc index 2390f06..034084c 100644 --- a/tests/csgtestcore.cc +++ b/tests/csgtestcore.cc @@ -1,9 +1,9 @@ // csg test core, used by throwntegether test and opencsg test #include "csgtestcore.h" +#include "tests-common.h" #include "system-gl.h" #include "openscad.h" -#include "handle_dep.h" #include "builtin.h" #include "context.h" #include "node.h" @@ -74,11 +74,10 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) exit(1); } - std::string filename(argv[1]); - std::string outfile(argv[2]); + const char *filename = argv[1]; + const char *outfilename = argv[2]; - initialize_builtin_functions(); - initialize_builtin_modules(); + Builtins::instance()->initialize(); QApplication app(argc, argv, false); @@ -106,47 +105,17 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) } Context root_ctx; - root_ctx.functions_p = &builtin_functions; - root_ctx.modules_p = &builtin_modules; - root_ctx.set_variable("$fn", Value(0.0)); - root_ctx.set_variable("$fs", Value(1.0)); - root_ctx.set_variable("$fa", Value(12.0)); - root_ctx.set_variable("$t", Value(0.0)); - - Value zero3; - zero3.type = Value::VECTOR; - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - root_ctx.set_variable("$vpt", zero3); - root_ctx.set_variable("$vpr", zero3); - + register_builtin(root_ctx); AbstractModule *root_module; ModuleInstantiation root_inst; - QFileInfo fileInfo(filename.c_str()); - handle_dep(filename); - FILE *fp = fopen(filename.c_str(), "rt"); - if (!fp) { - fprintf(stderr, "Can't open input file `%s'!\n", filename.c_str()); + root_module = parsefile(filename); + if (!root_module) { exit(1); - } else { - std::stringstream text; - char buffer[513]; - int ret; - while ((ret = fread(buffer, 1, 512, fp)) > 0) { - buffer[ret] = 0; - text << buffer; - } - fclose(fp); - text << commandline_commands; - root_module = parse(text.str().c_str(), fileInfo.absolutePath().toLocal8Bit(), false); - if (!root_module) { - exit(1); - } } + QFileInfo fileInfo(filename); QDir::setCurrent(fileInfo.absolutePath()); AbstractNode::resetIndexCounter(); @@ -245,10 +214,9 @@ int csgtestcore(int argc, char *argv[], test_type_e test_type) csgInfo.glview->paintGL(); - csgInfo.glview->save(outfile.c_str()); + csgInfo.glview->save(outfilename); - destroy_builtin_functions(); - destroy_builtin_modules(); + Builtins::instance(true); return 0; } diff --git a/tests/csgtexttest.cc b/tests/csgtexttest.cc index 21ebf6a..76f6eb1 100644 --- a/tests/csgtexttest.cc +++ b/tests/csgtexttest.cc @@ -1,6 +1,7 @@ /* - * OpenSCAD (www.openscad.at) - * Copyright (C) 2009 Clifford Wolf <clifford@clifford.at> + * OpenSCAD (www.openscad.org) + * Copyright (C) 2009-2011 Clifford Wolf <clifford@clifford.at> and + * Marius Kintel <marius@kintel.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,10 +24,10 @@ * */ +#include "tests-common.h" #include "CSGTextRenderer.h" #include "CSGTextCache.h" #include "openscad.h" -#include "handle_dep.h" #include "node.h" #include "module.h" #include "context.h" @@ -71,8 +72,7 @@ int main(int argc, char **argv) int rc = 0; - initialize_builtin_functions(); - initialize_builtin_modules(); + Builtins::instance()->initialize(); QApplication app(argc, argv, false); QDir original_path = QDir::current(); @@ -99,48 +99,18 @@ int main(int argc, char **argv) } Context root_ctx; - root_ctx.functions_p = &builtin_functions; - root_ctx.modules_p = &builtin_modules; - root_ctx.set_variable("$fn", Value(0.0)); - root_ctx.set_variable("$fs", Value(1.0)); - root_ctx.set_variable("$fa", Value(12.0)); - root_ctx.set_variable("$t", Value(0.0)); - - Value zero3; - zero3.type = Value::VECTOR; - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - root_ctx.set_variable("$vpt", zero3); - root_ctx.set_variable("$vpr", zero3); - + register_builtin(root_ctx); AbstractModule *root_module; ModuleInstantiation root_inst; AbstractNode *root_node; - QFileInfo fileInfo(filename); - handle_dep(filename); - FILE *fp = fopen(filename, "rt"); - if (!fp) { - fprintf(stderr, "Can't open input file `%s'!\n", filename); + root_module = parsefile(filename); + if (!root_module) { exit(1); - } else { - std::stringstream text; - char buffer[513]; - int ret; - while ((ret = fread(buffer, 1, 512, fp)) > 0) { - buffer[ret] = 0; - text << buffer; - } - fclose(fp); - text << commandline_commands; - root_module = parse(text.str().c_str(), fileInfo.absolutePath().toLocal8Bit(), false); - if (!root_module) { - exit(1); - } } + QFileInfo fileInfo(filename); QDir::setCurrent(fileInfo.absolutePath()); AbstractNode::resetIndexCounter(); @@ -153,13 +123,13 @@ int main(int argc, char **argv) csgTree(csgcache, *root_node); // std::cout << tree.getString(*root_node) << "\n"; + QDir::setCurrent(original_path.absolutePath()); std::ofstream outfile; outfile.open(outfilename); outfile << csgcache[*root_node] << "\n"; outfile.close(); - destroy_builtin_functions(); - destroy_builtin_modules(); + Builtins::instance(true); return rc; } diff --git a/tests/dumptest.cc b/tests/dumptest.cc index 3782446..5f2f22f 100644 --- a/tests/dumptest.cc +++ b/tests/dumptest.cc @@ -24,15 +24,14 @@ * */ +#include "tests-common.h" #include "openscad.h" -#include "handle_dep.h" #include "node.h" #include "module.h" #include "context.h" #include "value.h" #include "export.h" #include "builtin.h" -#include "nodedumper.h" #include "Tree.h" #include <QApplication> @@ -54,8 +53,22 @@ QString currentdir; QString examplesdir; QString librarydir; +string dumptree(const Tree &tree, const AbstractNode &node) +{ + std::stringstream str; + const std::vector<AbstractNode*> &children = node.getChildren(); + for (std::vector<AbstractNode*>::const_iterator iter = children.begin(); iter != children.end(); iter++) { + str << tree.getString(**iter) << "\n"; + } + return str.str(); +} + int main(int argc, char **argv) { +#ifdef WIN32 + _set_output_format(_TWO_DIGIT_EXPONENT); +#endif + if (argc != 3) { fprintf(stderr, "Usage: %s <file.scad> <output.txt>\n", argv[0]); exit(1); @@ -66,8 +79,7 @@ int main(int argc, char **argv) int rc = 0; - initialize_builtin_functions(); - initialize_builtin_modules(); + Builtins::instance()->initialize(); QApplication app(argc, argv, false); QDir original_path = QDir::current(); @@ -94,69 +106,63 @@ int main(int argc, char **argv) } Context root_ctx; - root_ctx.functions_p = &builtin_functions; - root_ctx.modules_p = &builtin_modules; - root_ctx.set_variable("$fn", Value(0.0)); - root_ctx.set_variable("$fs", Value(1.0)); - root_ctx.set_variable("$fa", Value(12.0)); - root_ctx.set_variable("$t", Value(0.0)); - - Value zero3; - zero3.type = Value::VECTOR; - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - root_ctx.set_variable("$vpt", zero3); - root_ctx.set_variable("$vpr", zero3); - + register_builtin(root_ctx); AbstractModule *root_module; ModuleInstantiation root_inst; AbstractNode *root_node; - QFileInfo fileInfo(filename); - handle_dep(filename); - FILE *fp = fopen(filename, "rt"); - if (!fp) { - fprintf(stderr, "Can't open input file `%s'!\n", filename); + root_module = parsefile(filename); + if (!root_module) { exit(1); - } else { - std::stringstream text; - char buffer[513]; - int ret; - while ((ret = fread(buffer, 1, 512, fp)) > 0) { - buffer[ret] = 0; - text << buffer; - } - fclose(fp); - text << commandline_commands; - root_module = parse(text.str().c_str(), fileInfo.absolutePath().toLocal8Bit(), false); - if (!root_module) { - exit(1); - } } + QFileInfo fileInfo(filename); QDir::setCurrent(fileInfo.absolutePath()); AbstractNode::resetIndexCounter(); root_node = root_module->evaluate(&root_ctx, &root_inst); - // Cache test - QString teststr("test"); Tree tree; tree.setRoot(root_node); - string dumpstdstr = tree.getString(*root_node); - string dumpstdstr_cached = tree.getString(*root_node); - assert(dumpstdstr == dumpstdstr_cached); + string dumpstdstr = dumptree(tree, *root_node); + string dumpstdstr_cached = dumptree(tree, *root_node); + if (dumpstdstr != dumpstdstr_cached) { + fprintf(stderr, "Error: Dump cached failed\n"); + exit(1); + } + QDir::setCurrent(original_path.absolutePath()); std::ofstream outfile; outfile.open(outfilename); outfile << dumpstdstr << "\n"; outfile.close(); - destroy_builtin_functions(); - destroy_builtin_modules(); + root_module = parsefile(outfilename); + if (!root_module) { + fprintf(stderr, "Error: Unable to read back dumped file\n"); + exit(1); + } + fileInfo = QFileInfo(outfilename); + QDir::setCurrent(fileInfo.absolutePath()); + + AbstractNode::resetIndexCounter(); + root_node = root_module->evaluate(&root_ctx, &root_inst); + + tree.setRoot(root_node); + + string readbackstr = dumptree(tree, *root_node); + if (dumpstdstr != readbackstr) { + fprintf(stderr, "Error: Readback is different from original dump:\n"); + fprintf(stderr, "Original:\n"); + fprintf(stderr, dumpstdstr.c_str()); + fprintf(stderr, "Readback:\n"); + fprintf(stderr, readbackstr.c_str()); + exit(1); + } + + Builtins::instance(true); return rc; } diff --git a/tests/echotest.cc b/tests/echotest.cc index 046f883..5ab9efa 100644 --- a/tests/echotest.cc +++ b/tests/echotest.cc @@ -24,8 +24,8 @@ * */ +#include "tests-common.h" #include "openscad.h" -#include "handle_dep.h" #include "node.h" #include "module.h" #include "context.h" @@ -76,8 +76,7 @@ int main(int argc, char **argv) } set_output_handler(&outfile_handler, &ofile); - initialize_builtin_functions(); - initialize_builtin_modules(); + Builtins::instance()->initialize(); QApplication app(argc, argv, false); QDir original_path = QDir::current(); @@ -104,56 +103,24 @@ int main(int argc, char **argv) } Context root_ctx; - root_ctx.functions_p = &builtin_functions; - root_ctx.modules_p = &builtin_modules; - root_ctx.set_variable("$fn", Value(0.0)); - root_ctx.set_variable("$fs", Value(1.0)); - root_ctx.set_variable("$fa", Value(12.0)); - root_ctx.set_variable("$t", Value(0.0)); - - Value zero3; - zero3.type = Value::VECTOR; - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - zero3.append(new Value(0.0)); - root_ctx.set_variable("$vpt", zero3); - root_ctx.set_variable("$vpr", zero3); - + register_builtin(root_ctx); AbstractModule *root_module; ModuleInstantiation root_inst; AbstractNode *root_node; - QFileInfo fileInfo(filename); - handle_dep(filename); - FILE *fp = fopen(filename, "rt"); - if (!fp) { - fprintf(stderr, "Can't open input file `%s'!\n", filename); + root_module = parsefile(filename); + if (!root_module) { exit(1); - } else { - std::stringstream text; - char buffer[513]; - int ret; - while ((ret = fread(buffer, 1, 512, fp)) > 0) { - buffer[ret] = 0; - text << buffer; - } - fclose(fp); - text << commandline_commands; - root_module = parse(text.str().c_str(), fileInfo.absolutePath().toLocal8Bit(), false); - if (!root_module) { - exit(1); - } } + QFileInfo fileInfo(filename); QDir::setCurrent(fileInfo.absolutePath()); AbstractNode::resetIndexCounter(); root_node = root_module->evaluate(&root_ctx, &root_inst); - destroy_builtin_functions(); - destroy_builtin_modules(); - + Builtins::instance(true); ofile.close(); return rc; } diff --git a/tests/regression/csgtexttest/allmodules-expected.txt b/tests/regression/csgtexttest/allmodules-expected.txt index 34fa5ae..49171ba 100644 --- a/tests/regression/csgtexttest/allmodules-expected.txt +++ b/tests/regression/csgtexttest/allmodules-expected.txt @@ -1 +1 @@ -group1(minkowski2+glide3+subdiv4+hull5+group6+group6+group6+intersection_for9+group6+union11+difference12+intersection13+linear_extrude+linear_extrude+rotate_extrude+rotate_extrude+import+import+import+import+group6+cube+sphere+cylinder+polyhedron+square+circle+polygon+projection+render31+surface+transform33+transform33+transform35+transform33+transform33+color38) +group1(minkowski2+glide3+subdiv4+hull5+group6+group6+group6+intersection9+group6+union11+difference12+intersection9+linear_extrude+linear_extrude+rotate_extrude+rotate_extrude+import+import+import+import+group6+cube+sphere+cylinder+polyhedron+square+circle+polygon+projection+render31+surface+transform33+transform33+transform35+transform33+transform33+color38) diff --git a/tests/regression/csgtexttest/intersection_for-expected.txt b/tests/regression/csgtexttest/intersection_for-expected.txt index b503644..0ce0967 100644 --- a/tests/regression/csgtexttest/intersection_for-expected.txt +++ b/tests/regression/csgtexttest/intersection_for-expected.txt @@ -1 +1 @@ -group1(intersection_for2) +group1(intersection2) diff --git a/tests/regression/dumptest/2d-3d-expected.txt b/tests/regression/dumptest/2d-3d-expected.txt new file mode 100644 index 0000000..5789ed7 --- /dev/null +++ b/tests/regression/dumptest/2d-3d-expected.txt @@ -0,0 +1,5 @@ + cube(size = [1, 1, 1], center = false); + multmatrix([[1, 0, 0, 2], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = false); + } + diff --git a/tests/regression/dumptest/allfunctions-expected.txt b/tests/regression/dumptest/allfunctions-expected.txt index 0a04719..8b13789 100644 --- a/tests/regression/dumptest/allfunctions-expected.txt +++ b/tests/regression/dumptest/allfunctions-expected.txt @@ -1 +1 @@ -group(); + diff --git a/tests/regression/dumptest/allmodules-expected.txt b/tests/regression/dumptest/allmodules-expected.txt index 2f920df..fee83a0 100644 --- a/tests/regression/dumptest/allmodules-expected.txt +++ b/tests/regression/dumptest/allmodules-expected.txt @@ -1,4 +1,3 @@ -group() { minkowski(convexity = 0); glide(path = undef, convexity = 0); subdiv(level = 1, convexity = 0); @@ -6,7 +5,7 @@ group() { group(); group(); group(); - intersection_for(); + intersection(); group(); union(); difference(); @@ -15,10 +14,10 @@ group() { linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 1); rotate_extrude(convexity = 1, $fn = 0, $fa = 12, $fs = 1); rotate_extrude(convexity = 1, $fn = 0, $fa = 12, $fs = 1); - import(file = "", cache = "0.0", layer = "", origin = [ 0 0 ], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); - import(file = "", cache = "0.0", layer = "", origin = [ 0 0 ], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); - import(file = "", cache = "0.0", layer = "", origin = [ 0 0 ], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); - import(file = "", cache = "0.0", layer = "", origin = [ 0 0 ], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + import(file = "", cache = "0.0", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + import(file = "", cache = "0.0", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + import(file = "", cache = "0.0", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + import(file = "", cache = "0.0", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); group(); cube(size = [1, 1, 1], center = false); sphere($fn = 0, $fa = 12, $fs = 1, r = 1); @@ -36,4 +35,4 @@ group() { multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]); multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]); color([-1, -1, -1, 1]); -} + diff --git a/tests/regression/dumptest/assign-expected.txt b/tests/regression/dumptest/assign-expected.txt index 434cc8f..b2915cb 100644 --- a/tests/regression/dumptest/assign-expected.txt +++ b/tests/regression/dumptest/assign-expected.txt @@ -1,3 +1,2 @@ -group() { group(); -} + diff --git a/tests/regression/dumptest/assign-tests-expected.txt b/tests/regression/dumptest/assign-tests-expected.txt new file mode 100644 index 0000000..f9db497 --- /dev/null +++ b/tests/regression/dumptest/assign-tests-expected.txt @@ -0,0 +1,51 @@ + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [0, 0, 0], center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, -5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + cube(size = [0, 0, 0], center = false); + } + } + } + multmatrix([[1, 0, 0, 0.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [1, 1, 1], center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, -5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + cube(size = [0.5, 0.5, 0.5], center = false); + } + } + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [2, 2, 2], center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, -5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + cube(size = [1, 1, 1], center = false); + } + } + } + multmatrix([[1, 0, 0, 4.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [3, 3, 3], center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, -5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + cube(size = [1.5, 1.5, 1.5], center = false); + } + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [4, 4, 4], center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, -5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + cube(size = [2, 2, 2], center = false); + } + } + } + multmatrix([[1, 0, 0, 12.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [5, 5, 5], center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, -5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + cube(size = [2.5, 2.5, 2.5], center = false); + } + } + } + } + diff --git a/tests/regression/dumptest/background-modifier-expected.txt b/tests/regression/dumptest/background-modifier-expected.txt new file mode 100644 index 0000000..ca75e52 --- /dev/null +++ b/tests/regression/dumptest/background-modifier-expected.txt @@ -0,0 +1,5 @@ + difference() { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + cylinder($fn = 0, $fa = 12, $fs = 1, h = 30, r1 = 6, r2 = 6, center = true); + } + diff --git a/tests/regression/dumptest/child-background-expected.txt b/tests/regression/dumptest/child-background-expected.txt new file mode 100644 index 0000000..d720179 --- /dev/null +++ b/tests/regression/dumptest/child-background-expected.txt @@ -0,0 +1,7 @@ + difference() { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + group() { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 30, r1 = 6, r2 = 6, center = true); + } + } + diff --git a/tests/regression/dumptest/child-expected.txt b/tests/regression/dumptest/child-expected.txt index 0a04719..8b13789 100644 --- a/tests/regression/dumptest/child-expected.txt +++ b/tests/regression/dumptest/child-expected.txt @@ -1 +1 @@ -group(); + diff --git a/tests/regression/dumptest/child-tests-expected.txt b/tests/regression/dumptest/child-tests-expected.txt new file mode 100644 index 0000000..981a5c1 --- /dev/null +++ b/tests/regression/dumptest/child-tests-expected.txt @@ -0,0 +1,40 @@ + group() { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 16, $fa = 12, $fs = 1, r = 1); + } + multmatrix([[1, 0, 0, 2.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 16, $fa = 12, $fs = 1, h = 2, r1 = 1, r2 = 1, center = true); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [2, 2, 2], center = true); + } + } + } + group() { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]); + multmatrix([[1, 0, 0, 2.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]); + multmatrix([[1, 0, 0, 5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 16, $fa = 12, $fs = 1, r = 1); + } + multmatrix([[1, 0, 0, 2.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]); + multmatrix([[1, 0, 0, 5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]); + } + } + } + multmatrix([[1, 0, 0, 2.5], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + cylinder($fn = 16, $fa = 12, $fs = 1, h = 2, r1 = 1, r2 = 1, center = true); + } + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group(); + } + diff --git a/tests/regression/dumptest/circle-expected.txt b/tests/regression/dumptest/circle-expected.txt index 1060d3c..ce06391 100644 --- a/tests/regression/dumptest/circle-expected.txt +++ b/tests/regression/dumptest/circle-expected.txt @@ -1,3 +1,2 @@ -group() { circle($fn = 0, $fa = 12, $fs = 1, r = 1); -} + diff --git a/tests/regression/dumptest/circle-tests-expected.txt b/tests/regression/dumptest/circle-tests-expected.txt new file mode 100644 index 0000000..c19bb0c --- /dev/null +++ b/tests/regression/dumptest/circle-tests-expected.txt @@ -0,0 +1,29 @@ + circle($fn = 0, $fa = 12, $fs = 1, r = 1); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 0, $fa = 12, $fs = 1, r = 1); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, -1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 0, $fa = 12, $fs = 1, r = 0); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, -3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 4, $fa = 12, $fs = 1, r = 1); + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, -3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 8, $fa = 12, $fs = 1, r = 1); + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, -3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 12, $fa = 12, $fs = 1, r = 1); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, -6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 0, $fa = 20, $fs = 0.3, r = 1); + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, -6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 0, $fa = 30, $fs = 0.3, r = 1); + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, -6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 0, $fa = 40, $fs = 0.3, r = 1); + } + diff --git a/tests/regression/dumptest/color-expected.txt b/tests/regression/dumptest/color-expected.txt index ef862fc..cead62d 100644 --- a/tests/regression/dumptest/color-expected.txt +++ b/tests/regression/dumptest/color-expected.txt @@ -1,3 +1,2 @@ -group() { color([-1, -1, -1, 1]); -} + diff --git a/tests/regression/dumptest/color-tests-expected.txt b/tests/regression/dumptest/color-tests-expected.txt new file mode 100644 index 0000000..1224e2d --- /dev/null +++ b/tests/regression/dumptest/color-tests-expected.txt @@ -0,0 +1,55 @@ + color([-1, -1, -1, 1]); + color([-1, -1, -1, 1]); + multmatrix([[1, 0, 0, 12], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + cube(size = [10, 10, 10], center = false); + } + } + color([1, 0, 0, 1]) { + multmatrix([[1, 0, 0, 24], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + cube(size = [10, 10, 10], center = false); + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.501961, 0, 0.501961, 1]) { + group() { + cube(size = [10, 10, 10], center = false); + } + } + } + color([0, 0, 1, 0.5]) { + group() { + cube(size = [10, 10, 10], center = false); + } + } + multmatrix([[1, 0, 0, 12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0, 0, 1, 0.5]) { + group() { + cube(size = [10, 10, 10], center = false); + } + } + } + multmatrix([[1, 0, 0, 24], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0, 0.501961, 0, 0.2]) { + group() { + cube(size = [10, 10, 10], center = false); + } + } + } + multmatrix([[1, 0, 0, -12], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([-1, -1, -1, 1]) { + group() { + cube(size = [10, 10, 10], center = false); + } + } + } + multmatrix([[1, 0, 0, -12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([-1, -1, -1, 0.5]) { + group() { + cube(size = [10, 10, 10], center = false); + } + } + } + diff --git a/tests/regression/dumptest/cube-expected.txt b/tests/regression/dumptest/cube-expected.txt index 91dc5fc..d1c5d32 100644 --- a/tests/regression/dumptest/cube-expected.txt +++ b/tests/regression/dumptest/cube-expected.txt @@ -1,3 +1,2 @@ -group() { cube(size = [1, 1, 1], center = false); -} + diff --git a/tests/regression/dumptest/cube-tests-expected.txt b/tests/regression/dumptest/cube-tests-expected.txt new file mode 100644 index 0000000..697c433 --- /dev/null +++ b/tests/regression/dumptest/cube-tests-expected.txt @@ -0,0 +1,12 @@ + cube(size = [1, 1, 1], center = false); + cube(size = [1, 1, 0], center = false); + cube(size = [1, 0, 1], center = false); + cube(size = [0, 1, 1], center = false); + cube(size = [0, 0, 0], center = false); + multmatrix([[1, 0, 0, 2], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [2, 3, 1], center = false); + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [2, 4, 2], center = true); + } + diff --git a/tests/regression/dumptest/cylinder-expected.txt b/tests/regression/dumptest/cylinder-expected.txt index a26a533..b839db7 100644 --- a/tests/regression/dumptest/cylinder-expected.txt +++ b/tests/regression/dumptest/cylinder-expected.txt @@ -1,3 +1,2 @@ -group() { cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 1, r2 = 1, center = false); -} + diff --git a/tests/regression/dumptest/cylinder-tests-expected.txt b/tests/regression/dumptest/cylinder-tests-expected.txt new file mode 100644 index 0000000..5b25429 --- /dev/null +++ b/tests/regression/dumptest/cylinder-tests-expected.txt @@ -0,0 +1,32 @@ + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 1, r2 = 1, center = false); + multmatrix([[1, 0, 0, 1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 0, r2 = 0, center = false); + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 0, r2 = 0, center = false); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, -11], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 5, r2 = 5, center = false); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 11], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 10, r1 = 5, r2 = 5, center = true); + } + multmatrix([[1, 0, 0, 11], [0, 1, 0, -11], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 5, r1 = 5, r2 = 1, center = false); + } + multmatrix([[1, 0, 0, 11], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 5, r1 = 5, r2 = 0, center = false); + } + multmatrix([[1, 0, 0, 11], [0, 1, 0, 11], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 8, r1 = 5, r2 = 5, center = false); + } + multmatrix([[1, 0, 0, 22], [0, 1, 0, -11], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 5, r1 = 0, r2 = 5, center = true); + } + multmatrix([[1, 0, 0, 22], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 5, r1 = 5, r2 = 0, center = false); + } + multmatrix([[1, 0, 0, 22], [0, 1, 0, 11], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 15, r1 = 5, r2 = 5, center = false); + } + diff --git a/tests/regression/dumptest/difference-expected.txt b/tests/regression/dumptest/difference-expected.txt index 09b977f..84a3635 100644 --- a/tests/regression/dumptest/difference-expected.txt +++ b/tests/regression/dumptest/difference-expected.txt @@ -1,3 +1,2 @@ -group() { difference(); -} + diff --git a/tests/regression/dumptest/difference-tests-expected.txt b/tests/regression/dumptest/difference-tests-expected.txt index bc59e45..bbdf3ea 100644 --- a/tests/regression/dumptest/difference-tests-expected.txt +++ b/tests/regression/dumptest/difference-tests-expected.txt @@ -1,6 +1,38 @@ -group() { + difference(); + difference(); difference() { - sphere($fn = 0, $fa = 12, $fs = 1, r = 3); - cube(size = [3, 3, 8], center = true); + cube(size = [10, 10, 10], center = true); + cylinder($fn = 0, $fa = 12, $fs = 1, h = 20, r1 = 4, r2 = 4, center = true); } -} + multmatrix([[1, 0, 0, 12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + difference() { + cube(size = [10, 10, 10], center = true); + cylinder($fn = 0, $fa = 12, $fs = 1, h = 10, r1 = 4, r2 = 4, center = true); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + difference() { + cube(size = [10, 10, 10], center = true); + cylinder($fn = 0, $fa = 12, $fs = 1, h = 11, r1 = 4, r2 = 4, center = true); + multmatrix([[2.22045e-16, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 2.22045e-16, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 11, r1 = 4, r2 = 4, center = true); + } + } + } + multmatrix([[1, 0, 0, 12], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + difference() { + cube(size = [10, 10, 10], center = true); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 7], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 4, r1 = 4, r2 = 4, center = true); + } + } + } + multmatrix([[1, 0, 0, 24], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + difference() { + cube(size = [10, 10, 10], center = true); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 6.99], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 4, r1 = 4, r2 = 4, center = true); + } + } + } + diff --git a/tests/regression/dumptest/dim-all-expected.txt b/tests/regression/dumptest/dim-all-expected.txt index 8d088d9..98a9bd9 100644 --- a/tests/regression/dumptest/dim-all-expected.txt +++ b/tests/regression/dumptest/dim-all-expected.txt @@ -1,4 +1,3 @@ -group() { group(); group(); group(); @@ -7,4 +6,4 @@ group() { group(); group(); group(); -} + diff --git a/tests/regression/dumptest/disable-modifier-expected.txt b/tests/regression/dumptest/disable-modifier-expected.txt new file mode 100644 index 0000000..b1543f7 --- /dev/null +++ b/tests/regression/dumptest/disable-modifier-expected.txt @@ -0,0 +1,4 @@ + difference() { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 30, r1 = 6, r2 = 6, center = true); + } + diff --git a/tests/regression/dumptest/dxf-export-expected.txt b/tests/regression/dumptest/dxf-export-expected.txt index 692526c..93be68c 100644 --- a/tests/regression/dumptest/dxf-export-expected.txt +++ b/tests/regression/dumptest/dxf-export-expected.txt @@ -1,4 +1,3 @@ -group() { circle($fn = 0, $fa = 12, $fs = 1, r = 5); multmatrix([[1, 0, 0, 15], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { square(size = [10, 10], center = true); @@ -14,4 +13,4 @@ group() { } } } -} + diff --git a/tests/regression/dumptest/dxf_linear_extrude-expected.txt b/tests/regression/dumptest/dxf_linear_extrude-expected.txt index 9284114..c6034d9 100644 --- a/tests/regression/dumptest/dxf_linear_extrude-expected.txt +++ b/tests/regression/dumptest/dxf_linear_extrude-expected.txt @@ -1,3 +1,2 @@ -group() { linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 1); -} + diff --git a/tests/regression/dumptest/dxf_rotate_extrude-expected.txt b/tests/regression/dumptest/dxf_rotate_extrude-expected.txt index e2f5832..9ab8f0f 100644 --- a/tests/regression/dumptest/dxf_rotate_extrude-expected.txt +++ b/tests/regression/dumptest/dxf_rotate_extrude-expected.txt @@ -1,3 +1,2 @@ -group() { rotate_extrude(convexity = 1, $fn = 0, $fa = 12, $fs = 1); -} + diff --git a/tests/regression/dumptest/echo-expected.txt b/tests/regression/dumptest/echo-expected.txt index 434cc8f..b2915cb 100644 --- a/tests/regression/dumptest/echo-expected.txt +++ b/tests/regression/dumptest/echo-expected.txt @@ -1,3 +1,2 @@ -group() { group(); -} + diff --git a/tests/regression/dumptest/echo-tests-expected.txt b/tests/regression/dumptest/echo-tests-expected.txt new file mode 100644 index 0000000..98a9bd9 --- /dev/null +++ b/tests/regression/dumptest/echo-tests-expected.txt @@ -0,0 +1,9 @@ + group(); + group(); + group(); + group(); + group(); + group(); + group(); + group(); + diff --git a/tests/regression/dumptest/example001-expected.txt b/tests/regression/dumptest/example001-expected.txt new file mode 100644 index 0000000..7d92377 --- /dev/null +++ b/tests/regression/dumptest/example001-expected.txt @@ -0,0 +1,21 @@ + group() { + difference() { + sphere($fn = 0, $fa = 12, $fs = 1, r = 25); + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 62.5, r1 = 12.5, r2 = 12.5, center = true); + } + } + group() { + multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 62.5, r1 = 12.5, r2 = 12.5, center = true); + } + } + group() { + multmatrix([[6.12323e-17, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 62.5, r1 = 12.5, r2 = 12.5, center = true); + } + } + } + } + diff --git a/tests/regression/dumptest/example002-expected.txt b/tests/regression/dumptest/example002-expected.txt new file mode 100644 index 0000000..04fc3b9 --- /dev/null +++ b/tests/regression/dumptest/example002-expected.txt @@ -0,0 +1,21 @@ + group() { + intersection() { + difference() { + union() { + cube(size = [30, 30, 30], center = true); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -25], [0, 0, 0, 1]]) { + cube(size = [15, 15, 50], center = true); + } + } + union() { + cube(size = [50, 10, 10], center = true); + cube(size = [10, 50, 10], center = true); + cube(size = [10, 10, 50], center = true); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 5], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 50, r1 = 20, r2 = 5, center = true); + } + } + } + diff --git a/tests/regression/dumptest/example003-expected.txt b/tests/regression/dumptest/example003-expected.txt new file mode 100644 index 0000000..480b032 --- /dev/null +++ b/tests/regression/dumptest/example003-expected.txt @@ -0,0 +1,16 @@ + group() { + difference() { + union() { + cube(size = [30, 30, 30], center = true); + cube(size = [40, 15, 15], center = true); + cube(size = [15, 40, 15], center = true); + cube(size = [15, 15, 40], center = true); + } + union() { + cube(size = [50, 10, 10], center = true); + cube(size = [10, 50, 10], center = true); + cube(size = [10, 10, 50], center = true); + } + } + } + diff --git a/tests/regression/dumptest/example004-expected.txt b/tests/regression/dumptest/example004-expected.txt new file mode 100644 index 0000000..a85ed90 --- /dev/null +++ b/tests/regression/dumptest/example004-expected.txt @@ -0,0 +1,7 @@ + group() { + difference() { + cube(size = [30, 30, 30], center = true); + sphere($fn = 0, $fa = 12, $fs = 1, r = 20); + } + } + diff --git a/tests/regression/dumptest/example005-expected.txt b/tests/regression/dumptest/example005-expected.txt new file mode 100644 index 0000000..e584aa7 --- /dev/null +++ b/tests/regression/dumptest/example005-expected.txt @@ -0,0 +1,43 @@ + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -120], [0, 0, 0, 1]]) { + difference() { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 50, r1 = 100, r2 = 100, center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 10], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 50, r1 = 80, r2 = 80, center = false); + } + multmatrix([[1, 0, 0, 100], [0, 1, 0, 0], [0, 0, 1, 35], [0, 0, 0, 1]]) { + cube(size = [50, 50, 50], center = true); + } + } + group() { + group(); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 80], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 200, r1 = 10, r2 = 10, center = false); + } + group(); + multmatrix([[1, 0, 0, 69.282], [0, 1, 0, 40], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 200, r1 = 10, r2 = 10, center = false); + } + group(); + multmatrix([[1, 0, 0, 69.282], [0, 1, 0, -40], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 200, r1 = 10, r2 = 10, center = false); + } + group(); + multmatrix([[1, 0, 0, 9.79717e-15], [0, 1, 0, -80], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 200, r1 = 10, r2 = 10, center = false); + } + group(); + multmatrix([[1, 0, 0, -69.282], [0, 1, 0, -40], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 200, r1 = 10, r2 = 10, center = false); + } + group(); + multmatrix([[1, 0, 0, -69.282], [0, 1, 0, 40], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 200, r1 = 10, r2 = 10, center = false); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 200], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 80, r1 = 120, r2 = 0, center = false); + } + } + } + diff --git a/tests/regression/dumptest/example006-expected.txt b/tests/regression/dumptest/example006-expected.txt new file mode 100644 index 0000000..467ccbc --- /dev/null +++ b/tests/regression/dumptest/example006-expected.txt @@ -0,0 +1,373 @@ + group() { + difference() { + cube(size = [100, 100, 100], center = true); + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 50], [0, 1, 0, 50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + render(convexity = 2) { + difference() { + cube(size = [20, 20, 150], center = true); + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 80, r1 = 10, r2 = 10, center = true); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, -40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + } + } + } + } + } + multmatrix([[1, 0, 0, -50], [0, 1, 0, 50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[6.12323e-17, -1, 0, 0], [1, 6.12323e-17, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + render(convexity = 2) { + difference() { + cube(size = [20, 20, 150], center = true); + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 80, r1 = 10, r2 = 10, center = true); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, -40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + } + } + } + } + } + multmatrix([[1, 0, 0, -50], [0, 1, 0, -50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[-1, -1.22465e-16, 0, 0], [1.22465e-16, -1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + render(convexity = 2) { + difference() { + cube(size = [20, 20, 150], center = true); + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 80, r1 = 10, r2 = 10, center = true); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, -40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + } + } + } + } + } + multmatrix([[1, 0, 0, 50], [0, 1, 0, -50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[-1.83697e-16, 1, 0, 0], [-1, -1.83697e-16, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + render(convexity = 2) { + difference() { + cube(size = [20, 20, 150], center = true); + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 80, r1 = 10, r2 = 10, center = true); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, -40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + } + } + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 50], [0, 1, 0, 50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + render(convexity = 2) { + difference() { + cube(size = [20, 20, 150], center = true); + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 80, r1 = 10, r2 = 10, center = true); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, -40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + } + } + } + } + } + multmatrix([[1, 0, 0, -50], [0, 1, 0, 50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[6.12323e-17, -1, 0, 0], [1, 6.12323e-17, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + render(convexity = 2) { + difference() { + cube(size = [20, 20, 150], center = true); + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 80, r1 = 10, r2 = 10, center = true); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, -40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + } + } + } + } + } + multmatrix([[1, 0, 0, -50], [0, 1, 0, -50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[-1, -1.22465e-16, 0, 0], [1.22465e-16, -1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + render(convexity = 2) { + difference() { + cube(size = [20, 20, 150], center = true); + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 80, r1 = 10, r2 = 10, center = true); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, -40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + } + } + } + } + } + multmatrix([[1, 0, 0, 50], [0, 1, 0, -50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[-1.83697e-16, 1, 0, 0], [-1, -1.83697e-16, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + render(convexity = 2) { + difference() { + cube(size = [20, 20, 150], center = true); + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 80, r1 = 10, r2 = 10, center = true); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, -40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + } + } + } + } + } + } + } + multmatrix([[6.12323e-17, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 6.12323e-17, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 50], [0, 1, 0, 50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + render(convexity = 2) { + difference() { + cube(size = [20, 20, 150], center = true); + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 80, r1 = 10, r2 = 10, center = true); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, -40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + } + } + } + } + } + multmatrix([[1, 0, 0, -50], [0, 1, 0, 50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[6.12323e-17, -1, 0, 0], [1, 6.12323e-17, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + render(convexity = 2) { + difference() { + cube(size = [20, 20, 150], center = true); + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 80, r1 = 10, r2 = 10, center = true); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, -40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + } + } + } + } + } + multmatrix([[1, 0, 0, -50], [0, 1, 0, -50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[-1, -1.22465e-16, 0, 0], [1.22465e-16, -1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + render(convexity = 2) { + difference() { + cube(size = [20, 20, 150], center = true); + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 80, r1 = 10, r2 = 10, center = true); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, -40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + } + } + } + } + } + multmatrix([[1, 0, 0, 50], [0, 1, 0, -50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[-1.83697e-16, 1, 0, 0], [-1, -1.83697e-16, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + render(convexity = 2) { + difference() { + cube(size = [20, 20, 150], center = true); + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 80, r1 = 10, r2 = 10, center = true); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, -40], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + } + } + } + } + } + } + } + } + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, -50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + } + } + } + } + multmatrix([[6.12323e-17, -1, 0, 0], [1, 6.12323e-17, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, -50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, -20], [0, 1, 0, 0], [0, 0, 1, -20], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 20], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + } + } + } + } + multmatrix([[-1, -1.22465e-16, 0, 0], [1.22465e-16, -1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, -50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, -20], [0, 1, 0, 0], [0, 0, 1, -25], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, -20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, -20], [0, 1, 0, 0], [0, 0, 1, 25], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, -25], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 25], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + } + } + } + } + multmatrix([[-1.83697e-16, 1, 0, 0], [-1, -1.83697e-16, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, -50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, -25], [0, 1, 0, 0], [0, 0, 1, -25], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, 25], [0, 1, 0, 0], [0, 0, 1, -25], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, -25], [0, 1, 0, 0], [0, 0, 1, 25], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, 25], [0, 1, 0, 0], [0, 0, 1, 25], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, -50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, -25], [0, 1, 0, 0], [0, 0, 1, -25], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, 25], [0, 1, 0, 0], [0, 0, 1, 25], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, 1, 0], [0, -1, 6.12323e-17, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, -50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + multmatrix([[1, 0, 0, -25], [0, 1, 0, 0], [0, 0, 1, -25], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, 25], [0, 1, 0, 0], [0, 0, 1, -25], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, -25], [0, 1, 0, 0], [0, 0, 1, 25], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + multmatrix([[1, 0, 0, 25], [0, 1, 0, 0], [0, 0, 1, 25], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + } + } + } + } + } + } + } + } + diff --git a/tests/regression/dumptest/example007-expected.txt b/tests/regression/dumptest/example007-expected.txt new file mode 100644 index 0000000..9f6c9a9 --- /dev/null +++ b/tests/regression/dumptest/example007-expected.txt @@ -0,0 +1,46 @@ + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -10], [0, 0, 0, 1]]) { + group() { + difference() { + rotate_extrude(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example007.dxf", cache = "4d38d4de.3739", layer = "dorn", origin = [0, 0], scale = 1, convexity = 3, $fn = 0, $fa = 12, $fs = 1); + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + intersection() { + multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -50], [0, 0, 0, 1]]) { + linear_extrude(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example007.dxf", cache = "4d38d4de.3739", layer = "cutout1", origin = [0, 0], scale = 1, height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + } + } + multmatrix([[6.12323e-17, -1, 0, 0], [1, 6.12323e-17, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -50], [0, 0, 0, 1]]) { + linear_extrude(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example007.dxf", cache = "4d38d4de.3739", layer = "cutout2", origin = [0, 0], scale = 1, height = 100, center = false, convexity = 2, $fn = 0, $fa = 12, $fs = 1); + } + } + } + } + } + } + multmatrix([[6.12323e-17, -1, 0, 0], [1, 6.12323e-17, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + intersection() { + multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -50], [0, 0, 0, 1]]) { + linear_extrude(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example007.dxf", cache = "4d38d4de.3739", layer = "cutout1", origin = [0, 0], scale = 1, height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + } + } + multmatrix([[6.12323e-17, -1, 0, 0], [1, 6.12323e-17, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -50], [0, 0, 0, 1]]) { + linear_extrude(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example007.dxf", cache = "4d38d4de.3739", layer = "cutout2", origin = [0, 0], scale = 1, height = 100, center = false, convexity = 2, $fn = 0, $fa = 12, $fs = 1); + } + } + } + } + } + } + } + } + } + } + diff --git a/tests/regression/dumptest/example008-expected.txt b/tests/regression/dumptest/example008-expected.txt new file mode 100644 index 0000000..8620536 --- /dev/null +++ b/tests/regression/dumptest/example008-expected.txt @@ -0,0 +1,28 @@ + difference() { + intersection() { + multmatrix([[1, 0, 0, -25], [0, 1, 0, -25], [0, 0, 1, -25], [0, 0, 0, 1]]) { + linear_extrude(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example008.dxf", cache = "4d38d4de.462c", layer = "G", origin = [0, 0], scale = 1, height = 50, center = false, convexity = 3, $fn = 0, $fa = 12, $fs = 1); + } + multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, -25], [0, 1, 0, -125], [0, 0, 1, -25], [0, 0, 0, 1]]) { + linear_extrude(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example008.dxf", cache = "4d38d4de.462c", layer = "E", origin = [0, 0], scale = 1, height = 50, center = false, convexity = 3, $fn = 0, $fa = 12, $fs = 1); + } + } + multmatrix([[6.12323e-17, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 6.12323e-17, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, -125], [0, 1, 0, -125], [0, 0, 1, -25], [0, 0, 0, 1]]) { + linear_extrude(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example008.dxf", cache = "4d38d4de.462c", layer = "B", origin = [0, 0], scale = 1, height = 50, center = false, convexity = 3, $fn = 0, $fa = 12, $fs = 1); + } + } + } + intersection() { + multmatrix([[1, 0, 0, -125], [0, 1, 0, -25], [0, 0, 1, -25], [0, 0, 0, 1]]) { + linear_extrude(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example008.dxf", cache = "4d38d4de.462c", layer = "X", origin = [0, 0], scale = 1, height = 50, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + } + multmatrix([[6.12323e-17, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 6.12323e-17, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, -125], [0, 1, 0, -25], [0, 0, 1, -25], [0, 0, 0, 1]]) { + linear_extrude(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example008.dxf", cache = "4d38d4de.462c", layer = "X", origin = [0, 0], scale = 1, height = 50, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + } + } + } + } + diff --git a/tests/regression/dumptest/example009-expected.txt b/tests/regression/dumptest/example009-expected.txt new file mode 100644 index 0000000..01d9ebe --- /dev/null +++ b/tests/regression/dumptest/example009-expected.txt @@ -0,0 +1,14 @@ + linear_extrude(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example009.dxf", cache = "4d38d4de.59bc", layer = "body", origin = [0, 0], scale = 1, height = 22, center = true, convexity = 10, $fn = 0, $fa = 12, $fs = 1); + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 12], [0, 0, 0, 1]]) { + linear_extrude(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example009.dxf", cache = "4d38d4de.59bc", layer = "plate", origin = [0, 0], scale = 1, height = 2, center = true, convexity = 10, $fn = 0, $fa = 12, $fs = 1); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -12], [0, 0, 0, 1]]) { + linear_extrude(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example009.dxf", cache = "4d38d4de.59bc", layer = "plate", origin = [0, 0], scale = 1, height = 2, center = true, convexity = 10, $fn = 0, $fa = 12, $fs = 1); + } + } + intersection() { + linear_extrude(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example009.dxf", cache = "4d38d4de.59bc", layer = "fan_top", origin = [0, 0], scale = 1, height = 20, center = true, convexity = 10, twist = -57.5288, slices = 4, $fn = 0, $fa = 12, $fs = 1); + rotate_extrude(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example009.dxf", cache = "4d38d4de.59bc", layer = "fan_side", origin = [0, -40], scale = 1, convexity = 10, $fn = 0, $fa = 12, $fs = 1); + } + diff --git a/tests/regression/dumptest/example010-expected.txt b/tests/regression/dumptest/example010-expected.txt new file mode 100644 index 0000000..19c84bf --- /dev/null +++ b/tests/regression/dumptest/example010-expected.txt @@ -0,0 +1,7 @@ + intersection() { + surface(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example010.dat", center = true); + multmatrix([[0.707107, -0.707107, 0, 0], [0.707107, 0.707107, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + surface(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example010.dat", center = true); + } + } + diff --git a/tests/regression/dumptest/example011-expected.txt b/tests/regression/dumptest/example011-expected.txt new file mode 100644 index 0000000..de56dde --- /dev/null +++ b/tests/regression/dumptest/example011-expected.txt @@ -0,0 +1,2 @@ + polyhedron(points = [[10, 0, 0], [0, 10, 0], [-10, 0, 0], [0, -10, 0], [0, 0, 10]], triangles = [[0, 1, 2, 3], [4, 1, 0], [4, 2, 1], [4, 3, 2], [4, 0, 3]], convexity = 1); + diff --git a/tests/regression/dumptest/example012-expected.txt b/tests/regression/dumptest/example012-expected.txt new file mode 100644 index 0000000..698ad99 --- /dev/null +++ b/tests/regression/dumptest/example012-expected.txt @@ -0,0 +1,9 @@ + difference() { + sphere($fn = 0, $fa = 12, $fs = 1, r = 20); + multmatrix([[1, 0, 0, -2.92], [0, 1, 0, 0.5], [0, 0, 1, 20], [0, 0, 0, 1]]) { + multmatrix([[-1, 1.22465e-16, 1.49976e-32, 0], [1.22465e-16, 1, 1.22465e-16, 0], [0, 1.22465e-16, -1, 0], [0, 0, 0, 1]]) { + import(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example012.stl", cache = "4d38d4de.456f", layer = "", origin = [0, 0], scale = 1, convexity = 5, $fn = 0, $fa = 12, $fs = 1); + } + } + } + diff --git a/tests/regression/dumptest/example013-expected.txt b/tests/regression/dumptest/example013-expected.txt new file mode 100644 index 0000000..53d2e83 --- /dev/null +++ b/tests/regression/dumptest/example013-expected.txt @@ -0,0 +1,10 @@ + intersection() { + linear_extrude(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example013.dxf", cache = "4d38d4de.34bc", layer = "", origin = [0, 0], scale = 1, height = 100, center = true, convexity = 3, $fn = 0, $fa = 12, $fs = 1); + multmatrix([[2.22045e-16, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 2.22045e-16, 0], [0, 0, 0, 1]]) { + linear_extrude(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example013.dxf", cache = "4d38d4de.34bc", layer = "", origin = [0, 0], scale = 1, height = 100, center = true, convexity = 3, $fn = 0, $fa = 12, $fs = 1); + } + multmatrix([[1, 0, 0, 0], [0, 2.22045e-16, -1, 0], [0, 1, 2.22045e-16, 0], [0, 0, 0, 1]]) { + linear_extrude(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example013.dxf", cache = "4d38d4de.34bc", layer = "", origin = [0, 0], scale = 1, height = 100, center = true, convexity = 3, $fn = 0, $fa = 12, $fs = 1); + } + } + diff --git a/tests/regression/dumptest/example014-expected.txt b/tests/regression/dumptest/example014-expected.txt new file mode 100644 index 0000000..9a65acd --- /dev/null +++ b/tests/regression/dumptest/example014-expected.txt @@ -0,0 +1,15 @@ + intersection() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [100, 20, 20], center = true); + } + multmatrix([[0.469846, 0.882564, 0.0180283, 0], [-0.813798, 0.44097, -0.378522, 0], [-0.34202, 0.163176, 0.925417, 0], [0, 0, 0, 1]]) { + cube(size = [100, 20, 20], center = true); + } + multmatrix([[0.417218, 0.668356, -0.615817, 0], [0.642459, -0.696172, -0.320299, 0], [-0.642788, -0.262003, -0.719846, 0], [0, 0, 0, 1]]) { + cube(size = [100, 20, 20], center = true); + } + multmatrix([[0.0190076, -0.601928, 0.798324, 0], [0.0292692, 0.798461, 0.601335, 0], [-0.999391, 0.0119363, 0.0327948, 0], [0, 0, 0, 1]]) { + cube(size = [100, 20, 20], center = true); + } + } + diff --git a/tests/regression/dumptest/example015-expected.txt b/tests/regression/dumptest/example015-expected.txt new file mode 100644 index 0000000..24a3bbd --- /dev/null +++ b/tests/regression/dumptest/example015-expected.txt @@ -0,0 +1,29 @@ + group() { + difference() { + multmatrix([[1, 0, 0, -35], [0, 1, 0, -35], [0, 0, 1, 0], [0, 0, 0, 1]]) { + intersection() { + union() { + difference() { + square(size = [100, 100], center = true); + square(size = [50, 50], center = true); + } + multmatrix([[1, 0, 0, 50], [0, 1, 0, 50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [15, 15], center = true); + } + } + multmatrix([[0.707107, -0.707107, 0, 0], [0.707107, 0.707107, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, -15], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [100, 30], center = false); + } + } + } + } + multmatrix([[0.707107, 0.707107, 0, 0], [-0.707107, 0.707107, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[0.7, 0, 0, 0], [0, 1.3, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 0, $fa = 12, $fs = 1, r = 5); + } + } + } + import(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example009.dxf", cache = "4d38d4de.59bc", layer = "body", origin = [0, 0], scale = 2, convexity = 6, $fn = 0, $fa = 12, $fs = 1); + } + diff --git a/tests/regression/dumptest/example016-expected.txt b/tests/regression/dumptest/example016-expected.txt new file mode 100644 index 0000000..d393fb6 --- /dev/null +++ b/tests/regression/dumptest/example016-expected.txt @@ -0,0 +1,84 @@ + difference() { + group() { + cube(size = [65, 28, 28], center = true); + } + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + render(convexity = 12) { + difference() { + group() { + difference() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 7.5], [0, 0, 0, 1]]) { + cube(size = [60, 28, 14], center = true); + } + cube(size = [8, 32, 32], center = true); + } + } + group() { + multmatrix([[1, 0, 0, -14], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + import(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example016.stl", cache = "4d38d4de.1954", layer = "", origin = [0, 0], scale = 1, convexity = 12, $fn = 0, $fa = 12, $fs = 1); + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) { + render(convexity = 12) { + difference() { + group() { + difference() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 7.5], [0, 0, 0, 1]]) { + cube(size = [60, 28, 14], center = true); + } + cube(size = [8, 32, 32], center = true); + } + } + group() { + multmatrix([[1, 0, 0, -14], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + import(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example016.stl", cache = "4d38d4de.1954", layer = "", origin = [0, 0], scale = 1, convexity = 12, $fn = 0, $fa = 12, $fs = 1); + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, -1, -1.22465e-16, 0], [0, 1.22465e-16, -1, 0], [0, 0, 0, 1]]) { + render(convexity = 12) { + difference() { + group() { + difference() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 7.5], [0, 0, 0, 1]]) { + cube(size = [60, 28, 14], center = true); + } + cube(size = [8, 32, 32], center = true); + } + } + group() { + multmatrix([[1, 0, 0, -14], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + import(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example016.stl", cache = "4d38d4de.1954", layer = "", origin = [0, 0], scale = 1, convexity = 12, $fn = 0, $fa = 12, $fs = 1); + } + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, -1.83697e-16, 1, 0], [0, -1, -1.83697e-16, 0], [0, 0, 0, 1]]) { + render(convexity = 12) { + difference() { + group() { + difference() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 7.5], [0, 0, 0, 1]]) { + cube(size = [60, 28, 14], center = true); + } + cube(size = [8, 32, 32], center = true); + } + } + group() { + multmatrix([[1, 0, 0, -14], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + import(file = "/Users/kintel/code/OpenSCAD/openscad/examples/example016.stl", cache = "4d38d4de.1954", layer = "", origin = [0, 0], scale = 1, convexity = 12, $fn = 0, $fa = 12, $fs = 1); + } + } + } + } + } + } + } + diff --git a/tests/regression/dumptest/example017-expected.txt b/tests/regression/dumptest/example017-expected.txt new file mode 100644 index 0000000..42ef321 --- /dev/null +++ b/tests/regression/dumptest/example017-expected.txt @@ -0,0 +1,215 @@ + group(); + group(); + group() { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 74], [0, 0, 0, 1]]) { + linear_extrude(height = 6, center = false, convexity = 4, $fn = 0, $fa = 12, $fs = 1) { + group() { + difference() { + circle($fn = 0, $fa = 12, $fs = 1, r = 47); + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 36], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [6, 10], center = true); + } + } + multmatrix([[-0.5, -0.866025, 0, 0], [0.866025, -0.5, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 36], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [6, 10], center = true); + } + } + multmatrix([[-0.5, 0.866025, 0, 0], [-0.866025, -0.5, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 36], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [6, 10], center = true); + } + } + } + circle($fn = 0, $fa = 12, $fs = 1, r = 25); + } + } + } + } + linear_extrude(height = 6, center = false, convexity = 4, $fn = 0, $fa = 12, $fs = 1) { + group() { + difference() { + circle($fn = 0, $fa = 12, $fs = 1, r = 102); + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 88.5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [6, 15], center = true); + } + } + multmatrix([[-0.5, -0.866025, 0, 0], [0.866025, -0.5, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 88.5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [6, 15], center = true); + } + } + multmatrix([[-0.5, 0.866025, 0, 0], [-0.866025, -0.5, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 88.5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [6, 15], center = true); + } + } + } + circle($fn = 0, $fa = 12, $fs = 1, r = 75); + } + } + } + color([0.7, 0.7, 1, 1]) { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 102], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[2.22045e-16, 2.22045e-16, -1, 0], [-1, 0, -2.22045e-16, 0], [0, 1, 2.22045e-16, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 6, center = true, convexity = 10, $fn = 0, $fa = 12, $fs = 1) { + group() { + union() { + difference() { + polygon(points = [[0, 6], [6, 6], [6, 0], [21, 0], [21, 6], [27, 6], [27, 0], [77, 0], [83, 12], [77, 18], [77, 74], [71, 74], [71, 80], [61, 80], [61, 74], [55, 74], [55, 80], [49, 74], [49, 18], [43, 12], [6, 12]], paths = undef, convexity = 1); + multmatrix([[1, 0, 0, 43], [0, 1, 0, 18], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 0, $fa = 12, $fs = 1, r = 6); + } + multmatrix([[1, 0, 0, 83], [0, 1, 0, 18], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 0, $fa = 12, $fs = 1, r = 6); + } + } + multmatrix([[1, 0, 0, 77], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [9, 12], center = false); + } + multmatrix([[1, 0, 0, 86], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 0, $fa = 12, $fs = 1, r = 6); + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + intersection() { + circle($fn = 0, $fa = 12, $fs = 1, r = 6); + multmatrix([[1, 0, 0, -12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [12, 12], center = false); + } + } + } + multmatrix([[1, 0, 0, 55], [0, 1, 0, 74], [0, 0, 1, 0], [0, 0, 0, 1]]) { + intersection() { + circle($fn = 0, $fa = 12, $fs = 1, r = 6); + multmatrix([[1, 0, 0, -12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [12, 12], center = false); + } + } + } + } + } + } + } + } + } + multmatrix([[-0.5, -0.866025, 0, 0], [0.866025, -0.5, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 102], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[2.22045e-16, 2.22045e-16, -1, 0], [-1, 0, -2.22045e-16, 0], [0, 1, 2.22045e-16, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 6, center = true, convexity = 10, $fn = 0, $fa = 12, $fs = 1) { + group() { + union() { + difference() { + polygon(points = [[0, 6], [6, 6], [6, 0], [21, 0], [21, 6], [27, 6], [27, 0], [77, 0], [83, 12], [77, 18], [77, 74], [71, 74], [71, 80], [61, 80], [61, 74], [55, 74], [55, 80], [49, 74], [49, 18], [43, 12], [6, 12]], paths = undef, convexity = 1); + multmatrix([[1, 0, 0, 43], [0, 1, 0, 18], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 0, $fa = 12, $fs = 1, r = 6); + } + multmatrix([[1, 0, 0, 83], [0, 1, 0, 18], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 0, $fa = 12, $fs = 1, r = 6); + } + } + multmatrix([[1, 0, 0, 77], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [9, 12], center = false); + } + multmatrix([[1, 0, 0, 86], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 0, $fa = 12, $fs = 1, r = 6); + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + intersection() { + circle($fn = 0, $fa = 12, $fs = 1, r = 6); + multmatrix([[1, 0, 0, -12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [12, 12], center = false); + } + } + } + multmatrix([[1, 0, 0, 55], [0, 1, 0, 74], [0, 0, 1, 0], [0, 0, 0, 1]]) { + intersection() { + circle($fn = 0, $fa = 12, $fs = 1, r = 6); + multmatrix([[1, 0, 0, -12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [12, 12], center = false); + } + } + } + } + } + } + } + } + } + multmatrix([[-0.5, 0.866025, 0, 0], [-0.866025, -0.5, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 102], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[2.22045e-16, 2.22045e-16, -1, 0], [-1, 0, -2.22045e-16, 0], [0, 1, 2.22045e-16, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 6, center = true, convexity = 10, $fn = 0, $fa = 12, $fs = 1) { + group() { + union() { + difference() { + polygon(points = [[0, 6], [6, 6], [6, 0], [21, 0], [21, 6], [27, 6], [27, 0], [77, 0], [83, 12], [77, 18], [77, 74], [71, 74], [71, 80], [61, 80], [61, 74], [55, 74], [55, 80], [49, 74], [49, 18], [43, 12], [6, 12]], paths = undef, convexity = 1); + multmatrix([[1, 0, 0, 43], [0, 1, 0, 18], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 0, $fa = 12, $fs = 1, r = 6); + } + multmatrix([[1, 0, 0, 83], [0, 1, 0, 18], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 0, $fa = 12, $fs = 1, r = 6); + } + } + multmatrix([[1, 0, 0, 77], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [9, 12], center = false); + } + multmatrix([[1, 0, 0, 86], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 0, $fa = 12, $fs = 1, r = 6); + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + intersection() { + circle($fn = 0, $fa = 12, $fs = 1, r = 6); + multmatrix([[1, 0, 0, -12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [12, 12], center = false); + } + } + } + multmatrix([[1, 0, 0, 55], [0, 1, 0, 74], [0, 0, 1, 0], [0, 0, 0, 1]]) { + intersection() { + circle($fn = 0, $fa = 12, $fs = 1, r = 6); + multmatrix([[1, 0, 0, -12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [12, 12], center = false); + } + } + } + } + } + } + } + } + } + } + } + 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 = 1) { + square(size = [25, 68], center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 68], [0, 0, 1, 0], [0, 0, 0, 1]]) { + intersection() { + square(size = [25, 25], center = false); + multmatrix([[1, 0, 0, 0], [0, 0.7, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 0, $fa = 12, $fs = 1, r = 25); + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 93], [0, 0, 1, 0], [0, 0, 0, 1]]) { + intersection() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, -12.5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [12.5, 25], center = false); + } + circle($fn = 0, $fa = 12, $fs = 1, r = 12.5); + } + } + } + } + } + } + } + diff --git a/tests/regression/dumptest/example018-expected.txt b/tests/regression/dumptest/example018-expected.txt new file mode 100644 index 0000000..d83440a --- /dev/null +++ b/tests/regression/dumptest/example018-expected.txt @@ -0,0 +1,119 @@ + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, -150], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + multmatrix([[1, 0, 0, -150], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [60, 60, 60], center = true); + } + multmatrix([[1, 0, 0, -50], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 50, r1 = 30, r2 = 30, center = true); + } + multmatrix([[1, 0, 0, 50], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + union() { + cube(size = [45, 45, 45], center = true); + multmatrix([[1, 0, 0, 0], [0, 0.707107, -0.707107, 0], [0, 0.707107, 0.707107, 0], [0, 0, 0, 1]]) { + cube(size = [50, 50, 50], center = true); + } + multmatrix([[0.707107, 0, 0.707107, 0], [0, 1, 0, 0], [-0.707107, 0, 0.707107, 0], [0, 0, 0, 1]]) { + cube(size = [50, 50, 50], center = true); + } + multmatrix([[0.707107, -0.707107, 0, 0], [0.707107, 0.707107, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [50, 50, 50], center = true); + } + } + } + multmatrix([[1, 0, 0, 150], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 30); + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, -50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + multmatrix([[1, 0, 0, -150], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 50, r1 = 30, r2 = 30, center = true); + } + multmatrix([[1, 0, 0, -50], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + union() { + cube(size = [45, 45, 45], center = true); + multmatrix([[1, 0, 0, 0], [0, 0.707107, -0.707107, 0], [0, 0.707107, 0.707107, 0], [0, 0, 0, 1]]) { + cube(size = [50, 50, 50], center = true); + } + multmatrix([[0.707107, 0, 0.707107, 0], [0, 1, 0, 0], [-0.707107, 0, 0.707107, 0], [0, 0, 0, 1]]) { + cube(size = [50, 50, 50], center = true); + } + multmatrix([[0.707107, -0.707107, 0, 0], [0.707107, 0.707107, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [50, 50, 50], center = true); + } + } + } + multmatrix([[1, 0, 0, 50], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 30); + } + multmatrix([[1, 0, 0, 150], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [60, 60, 60], center = true); + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + multmatrix([[1, 0, 0, -150], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + union() { + cube(size = [45, 45, 45], center = true); + multmatrix([[1, 0, 0, 0], [0, 0.707107, -0.707107, 0], [0, 0.707107, 0.707107, 0], [0, 0, 0, 1]]) { + cube(size = [50, 50, 50], center = true); + } + multmatrix([[0.707107, 0, 0.707107, 0], [0, 1, 0, 0], [-0.707107, 0, 0.707107, 0], [0, 0, 0, 1]]) { + cube(size = [50, 50, 50], center = true); + } + multmatrix([[0.707107, -0.707107, 0, 0], [0.707107, 0.707107, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [50, 50, 50], center = true); + } + } + } + multmatrix([[1, 0, 0, -50], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 30); + } + multmatrix([[1, 0, 0, 50], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [60, 60, 60], center = true); + } + multmatrix([[1, 0, 0, 150], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 50, r1 = 30, r2 = 30, center = true); + } + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 150], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + multmatrix([[1, 0, 0, -150], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 30); + } + multmatrix([[1, 0, 0, -50], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [60, 60, 60], center = true); + } + multmatrix([[1, 0, 0, 50], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 50, r1 = 30, r2 = 30, center = true); + } + multmatrix([[1, 0, 0, 150], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + union() { + cube(size = [45, 45, 45], center = true); + multmatrix([[1, 0, 0, 0], [0, 0.707107, -0.707107, 0], [0, 0.707107, 0.707107, 0], [0, 0, 0, 1]]) { + cube(size = [50, 50, 50], center = true); + } + multmatrix([[0.707107, 0, 0.707107, 0], [0, 1, 0, 0], [-0.707107, 0, 0.707107, 0], [0, 0, 0, 1]]) { + cube(size = [50, 50, 50], center = true); + } + multmatrix([[0.707107, -0.707107, 0, 0], [0.707107, 0.707107, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [50, 50, 50], center = true); + } + } + } + } + } + } + } + diff --git a/tests/regression/dumptest/example019-expected.txt b/tests/regression/dumptest/example019-expected.txt new file mode 100644 index 0000000..2ad2fb6 --- /dev/null +++ b/tests/regression/dumptest/example019-expected.txt @@ -0,0 +1,126 @@ + group() { + multmatrix([[1, 0, 0, -100], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 45, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, -95], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 46.5, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, -90], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 48, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, -85], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 49.5, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, -80], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 51, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, -75], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 52.5, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, -70], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 54, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, -65], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 55.5, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, -60], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 57, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, -55], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 58.5, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, -50], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 60, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, -45], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 59, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, -40], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 58, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, -35], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 57, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, -30], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 56, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, -25], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 55, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, -20], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 54, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, -15], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 55.05, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 56.1, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, -5], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 57.15, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 58.2, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 59.25, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 60.3, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 15], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 61.35, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 62.4, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 25], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 63.45, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 30], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 64.5, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 35], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 65.55, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 40], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 66.6, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 45], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 67.65, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 50], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 68.7, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 55], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 69.75, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 60], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 70.8, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 65], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 71.85, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 70], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 72.9, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 75], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 73.95, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 80], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 75, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 85], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 70.0714, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 90], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 65.1429, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 95], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 60.2143, r1 = 6, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 100], [0, 1, 0, 0], [0, 0, 1, -30], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 55.2857, r1 = 6, r2 = 2, center = false); + } + } + diff --git a/tests/regression/dumptest/example020-expected.txt b/tests/regression/dumptest/example020-expected.txt new file mode 100644 index 0000000..733f1e1 --- /dev/null +++ b/tests/regression/dumptest/example020-expected.txt @@ -0,0 +1,232 @@ + multmatrix([[1, 0, 0, -30], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + linear_extrude(height = 100, center = false, convexity = 8, twist = 411.429, slices = 34, $fn = 0, $fa = 12, $fs = 1) { + difference() { + circle($fn = 0, $fa = 12, $fs = 1, r = 20); + group() { + group(); + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[40, 0], [20, 0], [14.62391868272735, 3.337814009344716], [13.51453301853629, 6.508256086763372], [15.6366296493606, 12.46979603717467], [31.27325929872119, 24.93959207434934]], paths = undef, convexity = 1); + } + } + group(); + group() { + multmatrix([[0.62349, -0.781831, 0, 0], [0.781831, 0.62349, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[40, 0], [20, 0], [14.62391868272735, 3.337814009344716], [13.51453301853629, 6.508256086763372], [15.6366296493606, 12.46979603717467], [31.27325929872119, 24.93959207434934]], paths = undef, convexity = 1); + } + } + group(); + group() { + multmatrix([[-0.222521, -0.974928, 0, 0], [0.974928, -0.222521, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[40, 0], [20, 0], [14.62391868272735, 3.337814009344716], [13.51453301853629, 6.508256086763372], [15.6366296493606, 12.46979603717467], [31.27325929872119, 24.93959207434934]], paths = undef, convexity = 1); + } + } + group(); + group() { + multmatrix([[-0.900969, -0.433884, 0, 0], [0.433884, -0.900969, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[40, 0], [20, 0], [14.62391868272735, 3.337814009344716], [13.51453301853629, 6.508256086763372], [15.6366296493606, 12.46979603717467], [31.27325929872119, 24.93959207434934]], paths = undef, convexity = 1); + } + } + group(); + group() { + multmatrix([[-0.900969, 0.433884, 0, 0], [-0.433884, -0.900969, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[40, 0], [20, 0], [14.62391868272735, 3.337814009344716], [13.51453301853629, 6.508256086763372], [15.6366296493606, 12.46979603717467], [31.27325929872119, 24.93959207434934]], paths = undef, convexity = 1); + } + } + group(); + group() { + multmatrix([[-0.222521, 0.974928, 0, 0], [-0.974928, -0.222521, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[40, 0], [20, 0], [14.62391868272735, 3.337814009344716], [13.51453301853629, 6.508256086763372], [15.6366296493606, 12.46979603717467], [31.27325929872119, 24.93959207434934]], paths = undef, convexity = 1); + } + } + group(); + group() { + multmatrix([[0.62349, 0.781831, 0, 0], [-0.781831, 0.62349, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[40, 0], [20, 0], [14.62391868272735, 3.337814009344716], [13.51453301853629, 6.508256086763372], [15.6366296493606, 12.46979603717467], [31.27325929872119, 24.93959207434934]], paths = undef, convexity = 1); + } + } + } + } + } + } + } + multmatrix([[1, 0, 0, 30], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + difference() { + cylinder($fn = 6, $fa = 12, $fs = 1, h = 20, r1 = 30, r2 = 30, center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -10], [0, 0, 0, 1]]) { + group() { + linear_extrude(height = 40, center = false, convexity = 3, twist = 164.571, slices = 13, $fn = 0, $fa = 12, $fs = 1) { + difference() { + circle($fn = 0, $fa = 12, $fs = 1, r = 21); + group() { + group(); + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[42, 0], [21, 0], [15.59884659490918, 3.56033494330103], [14.41550188643871, 6.94213982588093], [16.41846113182863, 13.0932858390334], [32.83692226365725, 26.18657167806681]], paths = undef, convexity = 1); + } + } + group(); + group() { + multmatrix([[0.62349, -0.781831, 0, 0], [0.781831, 0.62349, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[42, 0], [21, 0], [15.59884659490918, 3.56033494330103], [14.41550188643871, 6.94213982588093], [16.41846113182863, 13.0932858390334], [32.83692226365725, 26.18657167806681]], paths = undef, convexity = 1); + } + } + group(); + group() { + multmatrix([[-0.222521, -0.974928, 0, 0], [0.974928, -0.222521, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[42, 0], [21, 0], [15.59884659490918, 3.56033494330103], [14.41550188643871, 6.94213982588093], [16.41846113182863, 13.0932858390334], [32.83692226365725, 26.18657167806681]], paths = undef, convexity = 1); + } + } + group(); + group() { + multmatrix([[-0.900969, -0.433884, 0, 0], [0.433884, -0.900969, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[42, 0], [21, 0], [15.59884659490918, 3.56033494330103], [14.41550188643871, 6.94213982588093], [16.41846113182863, 13.0932858390334], [32.83692226365725, 26.18657167806681]], paths = undef, convexity = 1); + } + } + group(); + group() { + multmatrix([[-0.900969, 0.433884, 0, 0], [-0.433884, -0.900969, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[42, 0], [21, 0], [15.59884659490918, 3.56033494330103], [14.41550188643871, 6.94213982588093], [16.41846113182863, 13.0932858390334], [32.83692226365725, 26.18657167806681]], paths = undef, convexity = 1); + } + } + group(); + group() { + multmatrix([[-0.222521, 0.974928, 0, 0], [-0.974928, -0.222521, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[42, 0], [21, 0], [15.59884659490918, 3.56033494330103], [14.41550188643871, 6.94213982588093], [16.41846113182863, 13.0932858390334], [32.83692226365725, 26.18657167806681]], paths = undef, convexity = 1); + } + } + group(); + group() { + multmatrix([[0.62349, 0.781831, 0, 0], [-0.781831, 0.62349, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[42, 0], [21, 0], [15.59884659490918, 3.56033494330103], [14.41550188643871, 6.94213982588093], [16.41846113182863, 13.0932858390334], [32.83692226365725, 26.18657167806681]], paths = undef, convexity = 1); + } + } + } + } + } + } + } + } + } + } + group() { + linear_extrude(height = 100, center = false, convexity = 5, twist = 1500, slices = 79, $fn = 19.2, $fa = 12, $fs = 1) { + group() { + group() { + group() { + polygon(points = [[100, 0], [90.10870717256485, 30.58778441039996], [99.27731872645629, 33.70010865023236]], paths = undef, convexity = 1); + } + group(); + group(); + } + group() { + group(); + group(); + group() { + polygon(points = [[99.27731872645629, 33.70010865023236], [90.10870717256485, 30.58778441039996], [74.08779492859099, 56.84956452855862], [84.58287312965604, 64.90272127318551]], paths = undef, convexity = 1); + } + } + group() { + group(); + group(); + group() { + polygon(points = [[84.58287312965604, 64.90272127318551], [74.08779492859099, 56.84956452855862], [51.22010456048879, 76.65630364955641], [59.89394204343166, 89.63761881095262]], paths = undef, convexity = 1); + } + } + group() { + group(); + group(); + group() { + polygon(points = [[59.89394204343166, 89.63761881095262], [51.22010456048879, 76.65630364955641], [23.64046582983194, 88.22741959152876], [28.12334319067221, 104.9577456662849]], paths = undef, convexity = 1); + } + } + group() { + group(); + group(); + group() { + polygon(points = [[28.12334319067221, 104.9577456662849], [23.64046582983194, 88.22741959152876], [-5.934009687954409, 90.53549252778905], [-7.146616158074179, 109.0362921199316]], paths = undef, convexity = 1); + } + } + group() { + group(); + group(); + group() { + polygon(points = [[-7.146616158074179, 109.0362921199316], [-5.934009687954409, 90.53549252778905], [-34.56302683546026, 83.44252814283341], [-41.97365963755769, 101.3333783594239]], paths = undef, convexity = 1); + } + } + group() { + group(); + group(); + group() { + polygon(points = [[-41.97365963755769, 101.3333783594239], [-34.56302683546026, 83.44252814283341], [-59.39283755470954, 67.72455141159254], [-72.47632546530423, 82.64341008420294]], paths = undef, convexity = 1); + } + } + group() { + group(); + group(); + group() { + polygon(points = [[-72.47632546530423, 82.64341008420294], [-59.39283755470954, 67.72455141159254], [-77.94228634059948, 44.99999999999999], [-95.26279441628826, 54.99999999999999]], paths = undef, convexity = 1); + } + } + group() { + group(); + group(); + group() { + polygon(points = [[-95.26279441628826, 54.99999999999999], [-77.94228634059948, 44.99999999999999], [-88.34760075969918, 17.57343041942462], [-107.8094553209469, 21.444633983801]], paths = undef, convexity = 1); + } + } + group() { + group(); + group(); + group() { + polygon(points = [[-107.8094553209469, 21.444633983801], [-88.34760075969918, 17.57343041942462], [-89.54486254542182, -11.78880480022482], [-108.7441097293403, -14.31643364378545]], paths = undef, convexity = 1); + } + } + group() { + group(); + group(); + group() { + polygon(points = [[-108.7441097293403, -14.31643364378545], [-89.54486254542182, -11.78880480022482], [-81.37304131717875, -40.12874312782305], [-98.0015069893589, -48.32899491597725]], paths = undef, convexity = 1); + } + } + group() { + group(); + group(); + group() { + polygon(points = [[-98.0015069893589, -48.32899491597725], [-81.37304131717875, -40.12874312782305], [-64.58695376169682, -64.5869537616968], [-76.83440247561271, -76.83440247561269]], paths = undef, convexity = 1); + } + } + group() { + group(); + group(); + group() { + polygon(points = [[-76.83440247561271, -76.83440247561269], [-64.58695376169682, -64.5869537616968], [-40.77625404048524, -82.68606355865667], [-47.68148400331503, -96.68848474788098]], paths = undef, convexity = 1); + } + } + group() { + group(); + group(); + group() { + polygon(points = [[-47.68148400331503, -96.68848474788098], [-40.77625404048524, -82.68606355865667], [-12.18926961151899, -92.58669478281102], [-13.91596883249134, -105.7022774919511]], paths = undef, convexity = 1); + } + } + group() { + group(); + group(); + group() { + polygon(points = [[-13.91596883249134, -105.7022774919511], [-12.18926961151899, -92.58669478281102], [18.56455524139444, -93.33032171881419], [20.45350916183121, -102.8267343618319]], paths = undef, convexity = 1); + } + } + group() { + group(); + group() { + polygon(points = [[20.45350916183121, -102.8267343618319], [18.56455524139444, -93.33032171881419], [50, -86.60254037844386]], paths = undef, convexity = 1); + } + group(); + } + } + } + } + diff --git a/tests/regression/dumptest/example021-expected.txt b/tests/regression/dumptest/example021-expected.txt new file mode 100644 index 0000000..8122a9d --- /dev/null +++ b/tests/regression/dumptest/example021-expected.txt @@ -0,0 +1,267 @@ + multmatrix([[1, 0, 0, -30], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + linear_extrude(height = 0.5, center = true, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + projection(cut = false, convexity = 0) { + group() { + difference() { + sphere($fn = 0, $fa = 30, $fs = 1, r = 25); + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + multmatrix([[6.12323e-17, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + } + } + } + } + group() { + difference() { + sphere($fn = 0, $fa = 30, $fs = 1, r = 25); + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + multmatrix([[6.12323e-17, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + } + } + } + } + multmatrix([[1, 0, 0, 30], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + multmatrix([[0.933013, 0.0669873, -0.353553, 0], [0.0669873, 0.933013, 0.353553, 0], [0.353553, -0.353553, 0.866025, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 20], [0, 0, 0, 1]]) { + linear_extrude(height = 0.5, center = true, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + projection(cut = true, convexity = 0) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -20], [0, 0, 0, 1]]) { + multmatrix([[0.933013, 0.0669873, 0.353553, 0], [0.0669873, 0.933013, -0.353553, 0], [-0.353553, 0.353553, 0.866025, 0], [0, 0, 0, 1]]) { + group() { + difference() { + sphere($fn = 0, $fa = 30, $fs = 1, r = 25); + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + multmatrix([[6.12323e-17, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + } + } + } + } + } + } + } + } + multmatrix([[0.933013, 0.0669873, -0.353553, 0], [0.0669873, 0.933013, 0.353553, 0], [0.353553, -0.353553, 0.866025, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 15], [0, 0, 0, 1]]) { + linear_extrude(height = 0.5, center = true, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + projection(cut = true, convexity = 0) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -15], [0, 0, 0, 1]]) { + multmatrix([[0.933013, 0.0669873, 0.353553, 0], [0.0669873, 0.933013, -0.353553, 0], [-0.353553, 0.353553, 0.866025, 0], [0, 0, 0, 1]]) { + group() { + difference() { + sphere($fn = 0, $fa = 30, $fs = 1, r = 25); + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + multmatrix([[6.12323e-17, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + } + } + } + } + } + } + } + } + multmatrix([[0.933013, 0.0669873, -0.353553, 0], [0.0669873, 0.933013, 0.353553, 0], [0.353553, -0.353553, 0.866025, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 10], [0, 0, 0, 1]]) { + linear_extrude(height = 0.5, center = true, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + projection(cut = true, convexity = 0) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -10], [0, 0, 0, 1]]) { + multmatrix([[0.933013, 0.0669873, 0.353553, 0], [0.0669873, 0.933013, -0.353553, 0], [-0.353553, 0.353553, 0.866025, 0], [0, 0, 0, 1]]) { + group() { + difference() { + sphere($fn = 0, $fa = 30, $fs = 1, r = 25); + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + multmatrix([[6.12323e-17, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + } + } + } + } + } + } + } + } + multmatrix([[0.933013, 0.0669873, -0.353553, 0], [0.0669873, 0.933013, 0.353553, 0], [0.353553, -0.353553, 0.866025, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 5], [0, 0, 0, 1]]) { + linear_extrude(height = 0.5, center = true, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + projection(cut = true, convexity = 0) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -5], [0, 0, 0, 1]]) { + multmatrix([[0.933013, 0.0669873, 0.353553, 0], [0.0669873, 0.933013, -0.353553, 0], [-0.353553, 0.353553, 0.866025, 0], [0, 0, 0, 1]]) { + group() { + difference() { + sphere($fn = 0, $fa = 30, $fs = 1, r = 25); + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + multmatrix([[6.12323e-17, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + } + } + } + } + } + } + } + } + multmatrix([[0.933013, 0.0669873, -0.353553, 0], [0.0669873, 0.933013, 0.353553, 0], [0.353553, -0.353553, 0.866025, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 0.5, center = true, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + projection(cut = true, convexity = 0) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[0.933013, 0.0669873, 0.353553, 0], [0.0669873, 0.933013, -0.353553, 0], [-0.353553, 0.353553, 0.866025, 0], [0, 0, 0, 1]]) { + group() { + difference() { + sphere($fn = 0, $fa = 30, $fs = 1, r = 25); + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + multmatrix([[6.12323e-17, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + } + } + } + } + } + } + } + } + multmatrix([[0.933013, 0.0669873, -0.353553, 0], [0.0669873, 0.933013, 0.353553, 0], [0.353553, -0.353553, 0.866025, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -5], [0, 0, 0, 1]]) { + linear_extrude(height = 0.5, center = true, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + projection(cut = true, convexity = 0) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 5], [0, 0, 0, 1]]) { + multmatrix([[0.933013, 0.0669873, 0.353553, 0], [0.0669873, 0.933013, -0.353553, 0], [-0.353553, 0.353553, 0.866025, 0], [0, 0, 0, 1]]) { + group() { + difference() { + sphere($fn = 0, $fa = 30, $fs = 1, r = 25); + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + multmatrix([[6.12323e-17, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + } + } + } + } + } + } + } + } + multmatrix([[0.933013, 0.0669873, -0.353553, 0], [0.0669873, 0.933013, 0.353553, 0], [0.353553, -0.353553, 0.866025, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -10], [0, 0, 0, 1]]) { + linear_extrude(height = 0.5, center = true, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + projection(cut = true, convexity = 0) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 10], [0, 0, 0, 1]]) { + multmatrix([[0.933013, 0.0669873, 0.353553, 0], [0.0669873, 0.933013, -0.353553, 0], [-0.353553, 0.353553, 0.866025, 0], [0, 0, 0, 1]]) { + group() { + difference() { + sphere($fn = 0, $fa = 30, $fs = 1, r = 25); + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + multmatrix([[6.12323e-17, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + } + } + } + } + } + } + } + } + multmatrix([[0.933013, 0.0669873, -0.353553, 0], [0.0669873, 0.933013, 0.353553, 0], [0.353553, -0.353553, 0.866025, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -15], [0, 0, 0, 1]]) { + linear_extrude(height = 0.5, center = true, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + projection(cut = true, convexity = 0) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 15], [0, 0, 0, 1]]) { + multmatrix([[0.933013, 0.0669873, 0.353553, 0], [0.0669873, 0.933013, -0.353553, 0], [-0.353553, 0.353553, 0.866025, 0], [0, 0, 0, 1]]) { + group() { + difference() { + sphere($fn = 0, $fa = 30, $fs = 1, r = 25); + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + multmatrix([[6.12323e-17, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + } + } + } + } + } + } + } + } + multmatrix([[0.933013, 0.0669873, -0.353553, 0], [0.0669873, 0.933013, 0.353553, 0], [0.353553, -0.353553, 0.866025, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -20], [0, 0, 0, 1]]) { + linear_extrude(height = 0.5, center = true, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + projection(cut = true, convexity = 0) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 20], [0, 0, 0, 1]]) { + multmatrix([[0.933013, 0.0669873, 0.353553, 0], [0.0669873, 0.933013, -0.353553, 0], [-0.353553, 0.353553, 0.866025, 0], [0, 0, 0, 1]]) { + group() { + difference() { + sphere($fn = 0, $fa = 30, $fs = 1, r = 25); + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + multmatrix([[6.12323e-17, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + } + } + } + } + } + } + } + } + } + group() { + difference() { + sphere($fn = 0, $fa = 30, $fs = 1, r = 25); + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + multmatrix([[6.12323e-17, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 6.12323e-17, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 30, $fs = 1, h = 62.5, r1 = 12.5, r2 = 6.25, center = true); + } + } + } + } + } + diff --git a/tests/regression/dumptest/example022-expected.txt b/tests/regression/dumptest/example022-expected.txt new file mode 100644 index 0000000..4f224be --- /dev/null +++ b/tests/regression/dumptest/example022-expected.txt @@ -0,0 +1,126 @@ + multmatrix([[1, 0, 0, -15], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + cube(size = [10, 30, 40], center = true); + cube(size = [20, 20, 40], center = true); + group() { + multmatrix([[1, 0, 0, -5], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 40, r1 = 5, r2 = 5, center = true); + } + multmatrix([[1, 0, 0, -5], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 40, r1 = 5, r2 = 5, center = true); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 40, r1 = 5, r2 = 5, center = true); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 40, r1 = 5, r2 = 5, center = true); + } + } + } + } + } + multmatrix([[1, 0, 0, 15], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + cube(size = [20, 20, 30], center = true); + cube(size = [10, 30, 30], center = true); + cube(size = [10, 20, 40], center = true); + group() { + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, -5], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 30, r1 = 5, r2 = 5, center = true); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, -5], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 30, r1 = 5, r2 = 5, center = true); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 5], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 30, r1 = 5, r2 = 5, center = true); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 5], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 30, r1 = 5, r2 = 5, center = true); + } + } + } + group() { + multmatrix([[2.22045e-16, -2.22045e-16, 1, 0], [1, 0, -2.22045e-16, 0], [0, 1, 2.22045e-16, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, -10], [0, 1, 0, -15], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 10, r1 = 5, r2 = 5, center = true); + } + } + multmatrix([[2.22045e-16, -2.22045e-16, 1, 0], [1, 0, -2.22045e-16, 0], [0, 1, 2.22045e-16, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, -10], [0, 1, 0, 15], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 10, r1 = 5, r2 = 5, center = true); + } + } + multmatrix([[2.22045e-16, -2.22045e-16, 1, 0], [1, 0, -2.22045e-16, 0], [0, 1, 2.22045e-16, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 10], [0, 1, 0, -15], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 10, r1 = 5, r2 = 5, center = true); + } + } + multmatrix([[2.22045e-16, -2.22045e-16, 1, 0], [1, 0, -2.22045e-16, 0], [0, 1, 2.22045e-16, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 10], [0, 1, 0, 15], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 10, r1 = 5, r2 = 5, center = true); + } + } + } + group() { + multmatrix([[2.22045e-16, 1, 2.22045e-16, 0], [0, 2.22045e-16, -1, 0], [-1, 2.22045e-16, 0, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, -15], [0, 1, 0, -5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 20, r1 = 5, r2 = 5, center = true); + } + } + multmatrix([[2.22045e-16, 1, 2.22045e-16, 0], [0, 2.22045e-16, -1, 0], [-1, 2.22045e-16, 0, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, -15], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 20, r1 = 5, r2 = 5, center = true); + } + } + multmatrix([[2.22045e-16, 1, 2.22045e-16, 0], [0, 2.22045e-16, -1, 0], [-1, 2.22045e-16, 0, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 15], [0, 1, 0, -5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 20, r1 = 5, r2 = 5, center = true); + } + } + multmatrix([[2.22045e-16, 1, 2.22045e-16, 0], [0, 2.22045e-16, -1, 0], [-1, 2.22045e-16, 0, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 15], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 20, r1 = 5, r2 = 5, center = true); + } + } + } + } + group() { + multmatrix([[1, 0, 0, -5], [0, 1, 0, -10], [0, 0, 1, -15], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 5); + } + multmatrix([[1, 0, 0, -5], [0, 1, 0, -10], [0, 0, 1, 15], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 5); + } + multmatrix([[1, 0, 0, -5], [0, 1, 0, 10], [0, 0, 1, -15], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 5); + } + multmatrix([[1, 0, 0, -5], [0, 1, 0, 10], [0, 0, 1, 15], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 5); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, -10], [0, 0, 1, -15], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 5); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, -10], [0, 0, 1, 15], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 5); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 10], [0, 0, 1, -15], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 5); + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 10], [0, 0, 1, 15], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 5); + } + } + } + } + } + diff --git a/tests/regression/dumptest/for-expected.txt b/tests/regression/dumptest/for-expected.txt index 434cc8f..b2915cb 100644 --- a/tests/regression/dumptest/for-expected.txt +++ b/tests/regression/dumptest/for-expected.txt @@ -1,3 +1,2 @@ -group() { group(); -} + diff --git a/tests/regression/dumptest/for-nested-tests-expected.txt b/tests/regression/dumptest/for-nested-tests-expected.txt new file mode 100644 index 0000000..24fd447 --- /dev/null +++ b/tests/regression/dumptest/for-nested-tests-expected.txt @@ -0,0 +1,111 @@ + group() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 20], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 30], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 5], [0, 0, 1, 20], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 5], [0, 0, 1, 30], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 10], [0, 0, 1, 20], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 10], [0, 0, 1, 30], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 0], [0, 0, 1, 20], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 0], [0, 0, 1, 30], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 5], [0, 0, 1, 20], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 5], [0, 0, 1, 30], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 10], [0, 0, 1, 20], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 10], [0, 0, 1, 30], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 20], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 30], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 20], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 20], [0, 1, 0, 5], [0, 0, 1, 20], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 20], [0, 1, 0, 5], [0, 0, 1, 30], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 20], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 20], [0, 1, 0, 10], [0, 0, 1, 20], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 20], [0, 1, 0, 10], [0, 0, 1, 30], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 30], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 30], [0, 1, 0, 0], [0, 0, 1, 20], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 30], [0, 1, 0, 0], [0, 0, 1, 30], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 30], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 30], [0, 1, 0, 5], [0, 0, 1, 20], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 30], [0, 1, 0, 5], [0, 0, 1, 30], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 30], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 30], [0, 1, 0, 10], [0, 0, 1, 20], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + multmatrix([[1, 0, 0, 30], [0, 1, 0, 10], [0, 0, 1, 30], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 3); + } + } + diff --git a/tests/regression/dumptest/for-tests-expected.txt b/tests/regression/dumptest/for-tests-expected.txt new file mode 100644 index 0000000..ce8953b --- /dev/null +++ b/tests/regression/dumptest/for-tests-expected.txt @@ -0,0 +1,114 @@ + group(); + group(); + multmatrix([[1, 0, 0, -10], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group(); + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 3, r2 = 3, center = false); + } + } + group() { + multmatrix([[1, 0, 0, -20], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 1, r2 = 1, center = false); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 2, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 3, r2 = 3, center = false); + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 4, r2 = 4, center = false); + } + multmatrix([[1, 0, 0, 20], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 5, r2 = 5, center = false); + } + } + group() { + multmatrix([[1, 0, 0, -20], [0, 1, 0, 20], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 1, r2 = 1, center = false); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, 20], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 2, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 20], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 3, r2 = 3, center = false); + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 20], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 4, r2 = 4, center = false); + } + multmatrix([[1, 0, 0, 20], [0, 1, 0, 20], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 5, r2 = 5, center = false); + } + } + group() { + multmatrix([[1, 0, 0, -20], [0, 1, 0, 30], [0, 0, 1, 0], [0, 0, 0, 1]]) { + difference() { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 1, r2 = 1, center = true); + cylinder($fn = 0, $fa = 12, $fs = 1, h = 2, r1 = 0.5, r2 = 0.5, center = true); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 30], [0, 0, 1, 0], [0, 0, 0, 1]]) { + difference() { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 3, r2 = 3, center = true); + cylinder($fn = 0, $fa = 12, $fs = 1, h = 2, r1 = 1.5, r2 = 1.5, center = true); + } + } + multmatrix([[1, 0, 0, 20], [0, 1, 0, 30], [0, 0, 1, 0], [0, 0, 0, 1]]) { + difference() { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 5, r2 = 5, center = true); + cylinder($fn = 0, $fa = 12, $fs = 1, h = 2, r1 = 2.5, r2 = 2.5, center = true); + } + } + } + group() { + multmatrix([[1, 0, 0, -15], [0, 1, 0, 30], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [1, 6, 2], center = true); + } + multmatrix([[1, 0, 0, -13], [0, 1, 0, 30], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [1, 6.8, 2], center = true); + } + multmatrix([[1, 0, 0, -11], [0, 1, 0, 30], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [1, 7.6, 2], center = true); + } + multmatrix([[1, 0, 0, -9], [0, 1, 0, 30], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [1, 8.4, 2], center = true); + } + multmatrix([[1, 0, 0, -7], [0, 1, 0, 30], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [1, 9.2, 2], center = true); + } + } + group(); + group() { + multmatrix([[1, 0, 0, -20], [0, 1, 0, 40], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 1, r2 = 1, center = false); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, 40], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 2, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 40], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 3, r2 = 3, center = false); + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 40], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 4, r2 = 4, center = false); + } + multmatrix([[1, 0, 0, 20], [0, 1, 0, 40], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 5, r2 = 5, center = false); + } + } + group(); + group(); + group(); + group() { + multmatrix([[1, 0, 0, -20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 1, r2 = 1, center = false); + } + multmatrix([[1, 0, 0, -10], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 2, r2 = 2, center = false); + } + multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 5, r2 = 5, center = false); + } + } + diff --git a/tests/regression/dumptest/glide-expected.txt b/tests/regression/dumptest/glide-expected.txt index 67e40b8..74fbc08 100644 --- a/tests/regression/dumptest/glide-expected.txt +++ b/tests/regression/dumptest/glide-expected.txt @@ -1,3 +1,2 @@ -group() { glide(path = undef, convexity = 0); -} + diff --git a/tests/regression/dumptest/group-expected.txt b/tests/regression/dumptest/group-expected.txt index 434cc8f..b2915cb 100644 --- a/tests/regression/dumptest/group-expected.txt +++ b/tests/regression/dumptest/group-expected.txt @@ -1,3 +1,2 @@ -group() { group(); -} + diff --git a/tests/regression/dumptest/highlight-and-background-modifier-expected.txt b/tests/regression/dumptest/highlight-and-background-modifier-expected.txt new file mode 100644 index 0000000..16f7b2a --- /dev/null +++ b/tests/regression/dumptest/highlight-and-background-modifier-expected.txt @@ -0,0 +1,11 @@ + difference() { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + cylinder($fn = 0, $fa = 12, $fs = 1, h = 30, r1 = 6, r2 = 6, center = true); + } + multmatrix([[1, 0, 0, 13], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + difference() { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + cylinder($fn = 0, $fa = 12, $fs = 1, h = 30, r1 = 6, r2 = 6, center = true); + } + } + diff --git a/tests/regression/dumptest/highlight-modifier-expected.txt b/tests/regression/dumptest/highlight-modifier-expected.txt new file mode 100644 index 0000000..ca75e52 --- /dev/null +++ b/tests/regression/dumptest/highlight-modifier-expected.txt @@ -0,0 +1,5 @@ + difference() { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + cylinder($fn = 0, $fa = 12, $fs = 1, h = 30, r1 = 6, r2 = 6, center = true); + } + diff --git a/tests/regression/dumptest/hull-expected.txt b/tests/regression/dumptest/hull-expected.txt index 6f777b0..3f27d2f 100644 --- a/tests/regression/dumptest/hull-expected.txt +++ b/tests/regression/dumptest/hull-expected.txt @@ -1,3 +1,2 @@ -group() { hull(); -} + diff --git a/tests/regression/dumptest/hull2-tests-expected.txt b/tests/regression/dumptest/hull2-tests-expected.txt new file mode 100644 index 0000000..87365a6 --- /dev/null +++ b/tests/regression/dumptest/hull2-tests-expected.txt @@ -0,0 +1,35 @@ + group() { + hull() { + multmatrix([[1, 0, 0, 15], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 0, $fa = 12, $fs = 1, r = 10); + } + difference() { + circle($fn = 0, $fa = 12, $fs = 1, r = 10); + circle($fn = 0, $fa = 12, $fs = 1, r = 5); + } + } + } + multmatrix([[1, 0, 0, 40], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + hull() { + multmatrix([[1, 0, 0, 15], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 0, $fa = 12, $fs = 1, r = 10); + } + circle($fn = 0, $fa = 12, $fs = 1, r = 10); + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, -20], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + hull() { + multmatrix([[1, 0, 0, 15], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [2, 2], center = false); + } + multmatrix([[1, 0, 0, 15], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [2, 2], center = false); + } + square(size = [2, 2], center = false); + } + } + } + diff --git a/tests/regression/dumptest/hull3-tests-expected.txt b/tests/regression/dumptest/hull3-tests-expected.txt new file mode 100644 index 0000000..831aae2 --- /dev/null +++ b/tests/regression/dumptest/hull3-tests-expected.txt @@ -0,0 +1,26 @@ + multmatrix([[1, 0, 0, 0], [0, 1, 0, 40], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + hull() { + multmatrix([[1, 0, 0, 15], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 10, r1 = 1, r2 = 1, center = false); + } + difference() { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 10, r1 = 1, r2 = 1, center = false); + cylinder($fn = 0, $fa = 12, $fs = 1, h = 5, r1 = 1, r2 = 1, center = false); + } + } + } + } + multmatrix([[1, 0, 0, 40], [0, 1, 0, 40], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + hull() { + multmatrix([[1, 0, 0, 15], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 10, r2 = 10, center = false); + } + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 10, r2 = 10, center = false); + } + } + } + hull(); + hull(); + diff --git a/tests/regression/dumptest/if-expected.txt b/tests/regression/dumptest/if-expected.txt index 434cc8f..b2915cb 100644 --- a/tests/regression/dumptest/if-expected.txt +++ b/tests/regression/dumptest/if-expected.txt @@ -1,3 +1,2 @@ -group() { group(); -} + diff --git a/tests/regression/dumptest/ifelse-tests-expected.txt b/tests/regression/dumptest/ifelse-tests-expected.txt new file mode 100644 index 0000000..1b60002 --- /dev/null +++ b/tests/regression/dumptest/ifelse-tests-expected.txt @@ -0,0 +1,58 @@ + group() { + cube(size = [2, 2, 2], center = true); + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + cube(size = [2, 2, 2], center = true); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + cube(size = [2, 2, 2], center = true); + } + } + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + group() { + cube(size = [2, 2, 2], center = true); + } + } + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + cube(size = [2, 2, 2], center = true); + } + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + cube(size = [2, 2, 2], center = true); + } + } + multmatrix([[1, 0, 0, 9], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + cube(size = [2, 2, 2], center = true); + } + } + multmatrix([[1, 0, 0, 9], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + cube(size = [2, 2, 2], center = true); + } + } + multmatrix([[1, 0, 0, 12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + cube(size = [2, 2, 2], center = true); + } + } + multmatrix([[1, 0, 0, 12], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + cube(size = [2, 2, 2], center = true); + } + } + multmatrix([[1, 0, 0, 15], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + cube(size = [2, 2, 2], center = true); + } + } + diff --git a/tests/regression/dumptest/import-expected.txt b/tests/regression/dumptest/import-expected.txt index b424afe..6482303 100644 --- a/tests/regression/dumptest/import-expected.txt +++ b/tests/regression/dumptest/import-expected.txt @@ -1,3 +1,2 @@ -group() { - import(file = "", cache = "0.0", layer = "", origin = [ 0 0 ], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); -} + import(file = "", cache = "0.0", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + diff --git a/tests/regression/dumptest/import_dxf-expected.txt b/tests/regression/dumptest/import_dxf-expected.txt index b424afe..6482303 100644 --- a/tests/regression/dumptest/import_dxf-expected.txt +++ b/tests/regression/dumptest/import_dxf-expected.txt @@ -1,3 +1,2 @@ -group() { - import(file = "", cache = "0.0", layer = "", origin = [ 0 0 ], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); -} + import(file = "", cache = "0.0", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + diff --git a/tests/regression/dumptest/import_dxf-tests-expected.txt b/tests/regression/dumptest/import_dxf-tests-expected.txt new file mode 100644 index 0000000..f17daf2 --- /dev/null +++ b/tests/regression/dumptest/import_dxf-tests-expected.txt @@ -0,0 +1,24 @@ + import(file = "", cache = "0.0", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + multmatrix([[1, 0, 0, -210], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + import(file = "/Users/kintel/code/OpenSCAD/openscad/testdata/dxf/polygons.dxf", cache = "4d38d4de.308a", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + } + multmatrix([[1, 0, 0, -210], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + import(file = "/Users/kintel/code/OpenSCAD/openscad/testdata/dxf/polygons.dxf", cache = "4d38d4de.308a", layer = "", origin = [0, 110], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + } + multmatrix([[1, 0, 0, -210], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + import(file = "/Users/kintel/code/OpenSCAD/openscad/testdata/dxf/polygons.dxf", cache = "4d38d4de.308a", layer = "", origin = [110, 110], scale = 0.5, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + } + import(file = "/Users/kintel/code/OpenSCAD/openscad/testdata/dxf/multiple-layers.dxf", cache = "4e823dda.3570", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + multmatrix([[1, 0, 0, -200], [0, 1, 0, 200], [0, 0, 1, 0], [0, 0, 0, 1]]) { + import(file = "/Users/kintel/code/OpenSCAD/openscad/testdata/dxf/multiple-layers.dxf", cache = "4e823dda.3570", layer = "0", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 200], [0, 0, 1, 0], [0, 0, 0, 1]]) { + import(file = "/Users/kintel/code/OpenSCAD/openscad/testdata/dxf/multiple-layers.dxf", cache = "4e823dda.3570", layer = "0", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + } + multmatrix([[1, 0, 0, 200], [0, 1, 0, 200], [0, 0, 1, 0], [0, 0, 0, 1]]) { + import(file = "/Users/kintel/code/OpenSCAD/openscad/testdata/dxf/multiple-layers.dxf", cache = "4e823dda.3570", layer = "noname", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 200], [0, 0, 1, 0], [0, 0, 0, 1]]) { + import(file = "/Users/kintel/code/OpenSCAD/openscad/testdata/dxf/multiple-layers.dxf", cache = "4e823dda.3570", layer = "Layer with a pretty long name including \ "special" /'\\ characters", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + } + diff --git a/tests/regression/dumptest/import_off-expected.txt b/tests/regression/dumptest/import_off-expected.txt index b424afe..6482303 100644 --- a/tests/regression/dumptest/import_off-expected.txt +++ b/tests/regression/dumptest/import_off-expected.txt @@ -1,3 +1,2 @@ -group() { - import(file = "", cache = "0.0", layer = "", origin = [ 0 0 ], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); -} + import(file = "", cache = "0.0", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + diff --git a/tests/regression/dumptest/import_stl-expected.txt b/tests/regression/dumptest/import_stl-expected.txt index b424afe..6482303 100644 --- a/tests/regression/dumptest/import_stl-expected.txt +++ b/tests/regression/dumptest/import_stl-expected.txt @@ -1,3 +1,2 @@ -group() { - import(file = "", cache = "0.0", layer = "", origin = [ 0 0 ], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); -} + import(file = "", cache = "0.0", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + diff --git a/tests/regression/dumptest/import_stl-tests-expected.txt b/tests/regression/dumptest/import_stl-tests-expected.txt index bc27c6a..8c3a540 100644 --- a/tests/regression/dumptest/import_stl-tests-expected.txt +++ b/tests/regression/dumptest/import_stl-tests-expected.txt @@ -1,3 +1,2 @@ -group() { - import_stl(file = "/Users/kintel/code/metalab/checkout/OpenSCAD/openscad-visitor/testdata/scad/import.stl", cache = "4c34b4bc.2506", convexity = 1); -} + import(file = "/Users/kintel/code/OpenSCAD/openscad/testdata/scad/features/import.stl", cache = "4e823ddd.2506", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + diff --git a/tests/regression/dumptest/include test6-expected.txt b/tests/regression/dumptest/include test6-expected.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tests/regression/dumptest/include test6-expected.txt @@ -0,0 +1 @@ + diff --git a/tests/regression/dumptest/include-test5-expected.txt b/tests/regression/dumptest/include-test5-expected.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tests/regression/dumptest/include-test5-expected.txt @@ -0,0 +1 @@ + diff --git a/tests/regression/dumptest/include-tests-expected.txt b/tests/regression/dumptest/include-tests-expected.txt new file mode 100644 index 0000000..33f9156 --- /dev/null +++ b/tests/regression/dumptest/include-tests-expected.txt @@ -0,0 +1,32 @@ + group() { + group() { + cube(size = [1, 1, 1], center = true); + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 0.7, r2 = 0.2, center = true); + } + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, -2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + cylinder($fn = 10, $fa = 12, $fs = 1, h = 1, r1 = 0.5, r2 = 0.5, center = true); + } + } + multmatrix([[1, 0, 0, -2], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + sphere($fn = 8, $fa = 12, $fs = 1, r = 0.5); + } + } + multmatrix([[1, 0, 0, -2], [0, 1, 0, -2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + difference() { + cube(size = [1, 1, 1], center = true); + cylinder($fn = 0, $fa = 12, $fs = 1, h = 2, r1 = 0.4, r2 = 0.4, center = true); + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, -2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 16, $fa = 12, $fs = 1, r = 0.7); + } + } + diff --git a/tests/regression/dumptest/intersection-expected.txt b/tests/regression/dumptest/intersection-expected.txt index 409e196..ed3847d 100644 --- a/tests/regression/dumptest/intersection-expected.txt +++ b/tests/regression/dumptest/intersection-expected.txt @@ -1,3 +1,2 @@ -group() { intersection(); -} + diff --git a/tests/regression/dumptest/intersection-tests-expected.txt b/tests/regression/dumptest/intersection-tests-expected.txt index 90349a3..5613abf 100644 --- a/tests/regression/dumptest/intersection-tests-expected.txt +++ b/tests/regression/dumptest/intersection-tests-expected.txt @@ -1,6 +1,56 @@ -group() { + intersection(); + intersection(); intersection() { - sphere($fn = 0, $fa = 12, $fs = 1, r = 3); - cube(size = [3, 3, 8], center = true); + sphere($fn = 0, $fa = 12, $fs = 1, r = 5); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 3], [0, 0, 0, 1]]) { + cube(size = [4, 4, 6], center = true); + } } -} + multmatrix([[1, 0, 0, 0], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + intersection() { + cube(size = [10, 10, 10], center = true); + cylinder($fn = 0, $fa = 12, $fs = 1, h = 12, r1 = 4, r2 = 4, center = true); + } + } + multmatrix([[1, 0, 0, 12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + intersection() { + cube(size = [10, 10, 10], center = true); + cylinder($fn = 0, $fa = 12, $fs = 1, h = 12, r1 = 4, r2 = 4, center = true); + multmatrix([[2.22045e-16, 0, 1, 0], [0, 1, 0, 0], [-1, 0, 2.22045e-16, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 12, r1 = 4, r2 = 4, center = true); + } + } + } + multmatrix([[1, 0, 0, 12], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + intersection() { + cube(size = [10, 10, 10], center = true); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 7], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 4, r1 = 4, r2 = 4, center = true); + } + } + } + multmatrix([[1, 0, 0, 24], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + intersection() { + cube(size = [10, 10, 10], center = true); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 6.99], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 4, r1 = 4, r2 = 4, center = true); + } + } + } + multmatrix([[1, 0, 0, -12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + intersection() { + cube(size = [10, 10, 10], center = true); + multmatrix([[1, 0, 0, 0], [0, 1, 0, -10], [0, 0, 1, -10], [0, 0, 0, 1]]) { + cube(size = [10, 10, 10], center = true); + } + } + } + multmatrix([[1, 0, 0, -12], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + intersection() { + cube(size = [10, 10, 10], center = true); + multmatrix([[1, 0, 0, 0], [0, 1, 0, -9.99], [0, 0, 1, -9.99], [0, 0, 0, 1]]) { + cube(size = [10, 10, 10], center = true); + } + } + } + diff --git a/tests/regression/dumptest/intersection_for-expected.txt b/tests/regression/dumptest/intersection_for-expected.txt index 8bb5d2d..ed3847d 100644 --- a/tests/regression/dumptest/intersection_for-expected.txt +++ b/tests/regression/dumptest/intersection_for-expected.txt @@ -1,3 +1,2 @@ -group() { - intersection_for(); -} + intersection(); + diff --git a/tests/regression/dumptest/intersection_for-tests-expected.txt b/tests/regression/dumptest/intersection_for-tests-expected.txt new file mode 100644 index 0000000..30d0bd3 --- /dev/null +++ b/tests/regression/dumptest/intersection_for-tests-expected.txt @@ -0,0 +1,17 @@ + intersection(); + intersection(); + intersection() { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [100, 20, 20], center = true); + } + multmatrix([[0.469846, 0.882564, 0.0180283, 0], [-0.813798, 0.44097, -0.378522, 0], [-0.34202, 0.163176, 0.925417, 0], [0, 0, 0, 1]]) { + cube(size = [100, 20, 20], center = true); + } + multmatrix([[0.417218, 0.668356, -0.615817, 0], [0.642459, -0.696172, -0.320299, 0], [-0.642788, -0.262003, -0.719846, 0], [0, 0, 0, 1]]) { + cube(size = [100, 20, 20], center = true); + } + multmatrix([[0.0190076, -0.601928, 0.798324, 0], [0.0292692, 0.798461, 0.601335, 0], [-0.999391, 0.0119363, 0.0327948, 0], [0, 0, 0, 1]]) { + cube(size = [100, 20, 20], center = true); + } + } + diff --git a/tests/regression/dumptest/linear_extrude-expected.txt b/tests/regression/dumptest/linear_extrude-expected.txt index 9284114..c6034d9 100644 --- a/tests/regression/dumptest/linear_extrude-expected.txt +++ b/tests/regression/dumptest/linear_extrude-expected.txt @@ -1,3 +1,2 @@ -group() { linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 1); -} + diff --git a/tests/regression/dumptest/linear_extrude-tests-expected.txt b/tests/regression/dumptest/linear_extrude-tests-expected.txt index 8fe9928..08b9f3e 100644 --- a/tests/regression/dumptest/linear_extrude-tests-expected.txt +++ b/tests/regression/dumptest/linear_extrude-tests-expected.txt @@ -1,30 +1,32 @@ -group() { - linear_extrude(file = "", cache = "0.0", layer = "", height = 10, origin = [ 0 0 ], scale = 1, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + rotate_extrude(convexity = 1, $fn = 0, $fa = 12, $fs = 1); + rotate_extrude(convexity = 1, $fn = 0, $fa = 12, $fs = 1); + rotate_extrude(convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + cube(size = [1, 1, 1], center = false); + } + linear_extrude(height = 10, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { square(size = [10, 10], center = false); } multmatrix([[1, 0, 0, 19], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(file = "", cache = "0.0", layer = "", height = 10, origin = [ 0 0 ], scale = 1, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { - circle($fn = 0, $fa = 12, $fs = 1, r = 5); + linear_extrude(height = 10, center = true, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + difference() { + circle($fn = 0, $fa = 12, $fs = 1, r = 5); + circle($fn = 0, $fa = 12, $fs = 1, r = 3); + } } } multmatrix([[1, 0, 0, 31.5], [0, 1, 0, 2.5], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(file = "", cache = "0.0", layer = "", height = 10, origin = [ 0 0 ], scale = 1, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + linear_extrude(height = 10, center = false, convexity = 1, twist = -45, slices = 3, $fn = 0, $fa = 12, $fs = 1) { polygon(points = [[-5, -2.5], [5, -2.5], [0, 2.5]], paths = undef, convexity = 1); } } - multmatrix([[1, 0, 0, 0], [0, 1, 0, -12], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(file = "", cache = "0.0", layer = "", height = 20, origin = [ 0 0 ], scale = 1, center = false, convexity = 1, twist = 45, slices = 3, $fn = 0, $fa = 12, $fs = 1) { + multmatrix([[1, 0, 0, 0], [0, 1, 0, 20], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 20, center = false, convexity = 1, twist = 45, slices = 2, $fn = 0, $fa = 12, $fs = 1) { square(size = [10, 10], center = false); } } - multmatrix([[1, 0, 0, 19], [0, 1, 0, -7], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(file = "", cache = "0.0", layer = "", height = 20, origin = [ 0 0 ], scale = 1, center = false, convexity = 1, twist = 90, slices = 7, $fn = 0, $fa = 12, $fs = 1) { - circle($fn = 0, $fa = 12, $fs = 1, r = 5); - } - } - multmatrix([[1, 0, 0, 31.5], [0, 1, 0, -9.5], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(file = "", cache = "0.0", layer = "", height = 20, origin = [ 0 0 ], scale = 1, center = false, convexity = 1, twist = 180, slices = 15, $fn = 0, $fa = 12, $fs = 1) { - polygon(points = [[-5, -2.5], [5, -2.5], [0, 2.5]], paths = undef, convexity = 1); + multmatrix([[1, 0, 0, 19], [0, 1, 0, 20], [0, 0, 1, 0], [0, 0, 0, 1]]) { + linear_extrude(height = 20, center = false, convexity = 1, twist = 45, slices = 10, $fn = 0, $fa = 12, $fs = 1) { + square(size = [10, 10], center = false); } } -} + diff --git a/tests/regression/dumptest/minkowski-expected.txt b/tests/regression/dumptest/minkowski-expected.txt index ecab5f3..799062f 100644 --- a/tests/regression/dumptest/minkowski-expected.txt +++ b/tests/regression/dumptest/minkowski-expected.txt @@ -1,3 +1,2 @@ -group() { minkowski(convexity = 0); -} + diff --git a/tests/regression/dumptest/minkowski2-tests-expected.txt b/tests/regression/dumptest/minkowski2-tests-expected.txt new file mode 100644 index 0000000..fe78b90 --- /dev/null +++ b/tests/regression/dumptest/minkowski2-tests-expected.txt @@ -0,0 +1,31 @@ + multmatrix([[1, 0, 0, -20], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + minkowski(convexity = 0) { + difference() { + square(size = [10, 10], center = true); + square(size = [8, 8], center = true); + } + circle($fn = 0, $fa = 12, $fs = 1, r = 2); + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + minkowski(convexity = 0) { + difference() { + square(size = [10, 10], center = false); + square(size = [5, 5], center = false); + } + circle($fn = 0, $fa = 12, $fs = 1, r = 5); + } + } + } + multmatrix([[1, 0, 0, 25], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + minkowski(convexity = 0) { + square(size = [10, 10], center = false); + circle($fn = 0, $fa = 12, $fs = 1, r = 5); + } + } + } + diff --git a/tests/regression/dumptest/minkowski3-tests-expected.txt b/tests/regression/dumptest/minkowski3-tests-expected.txt new file mode 100644 index 0000000..0226beb --- /dev/null +++ b/tests/regression/dumptest/minkowski3-tests-expected.txt @@ -0,0 +1,33 @@ + multmatrix([[1, 0, 0, -20], [0, 1, 0, 30], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + minkowski(convexity = 0) { + difference() { + cube(size = [10, 10, 5], center = true); + cube(size = [8, 8, 10], center = true); + } + cylinder($fn = 0, $fa = 12, $fs = 1, h = 1, r1 = 2, r2 = 2, center = false); + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 25], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + minkowski(convexity = 0) { + difference() { + cube(size = [10, 10, 5], center = false); + cube(size = [5, 5, 5], center = false); + } + cylinder($fn = 0, $fa = 12, $fs = 1, h = 5, r1 = 5, r2 = 5, center = false); + } + } + } + multmatrix([[1, 0, 0, 25], [0, 1, 0, 25], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + minkowski(convexity = 0) { + cube(size = [10, 10, 5], center = false); + cylinder($fn = 0, $fa = 12, $fs = 1, h = 5, r1 = 5, r2 = 5, center = false); + } + } + } + minkowski(convexity = 0); + minkowski(convexity = 0); + diff --git a/tests/regression/dumptest/mirror-expected.txt b/tests/regression/dumptest/mirror-expected.txt index 3ad73cb..fdf0ee0 100644 --- a/tests/regression/dumptest/mirror-expected.txt +++ b/tests/regression/dumptest/mirror-expected.txt @@ -1,3 +1,2 @@ -group() { multmatrix([[-1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]); -} + diff --git a/tests/regression/dumptest/multmatrix-expected.txt b/tests/regression/dumptest/multmatrix-expected.txt index 87e28e2..c3185a3 100644 --- a/tests/regression/dumptest/multmatrix-expected.txt +++ b/tests/regression/dumptest/multmatrix-expected.txt @@ -1,3 +1,2 @@ -group() { multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]); -} + diff --git a/tests/regression/dumptest/null-polygons-expected.txt b/tests/regression/dumptest/null-polygons-expected.txt index bfceaff..f98d284 100644 --- a/tests/regression/dumptest/null-polygons-expected.txt +++ b/tests/regression/dumptest/null-polygons-expected.txt @@ -1,6 +1,5 @@ -group() { - linear_extrude(file = "", cache = "0.0", layer = "", height = 100, origin = [ 0 0 ], scale = 1, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { - import_dxf(file = "/Users/kintel/code/metalab/checkout/OpenSCAD/openscad-visitor/testdata/scad/null-polygons.dxf", cache = "4c34b4bc.3124", layer = "", origin = [ 0 0 ], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + linear_extrude(height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + import(file = "/Users/kintel/code/OpenSCAD/openscad/testdata/scad/features/null-polygons.dxf", cache = "4e823ddd.3124", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); } - linear_extrude(file = "/Users/kintel/code/metalab/checkout/OpenSCAD/openscad-visitor/testdata/scad/null-polygons.dxf", cache = "4c34b4bc.3124", layer = "", height = 100, origin = [ 0 0 ], scale = 1, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 1); -} + linear_extrude(file = "/Users/kintel/code/OpenSCAD/openscad/testdata/scad/features/null-polygons.dxf", cache = "4e823ddd.3124", layer = "", origin = [0, 0], scale = 1, height = 100, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + diff --git a/tests/regression/dumptest/polygon-expected.txt b/tests/regression/dumptest/polygon-expected.txt index d04aec9..a525d29 100644 --- a/tests/regression/dumptest/polygon-expected.txt +++ b/tests/regression/dumptest/polygon-expected.txt @@ -1,3 +1,2 @@ -group() { polygon(points = undef, paths = undef, convexity = 1); -} + diff --git a/tests/regression/dumptest/polygon-tests-expected.txt b/tests/regression/dumptest/polygon-tests-expected.txt new file mode 100644 index 0000000..ce4ad87 --- /dev/null +++ b/tests/regression/dumptest/polygon-tests-expected.txt @@ -0,0 +1,32 @@ + polygon(points = undef, paths = undef, convexity = 1); + polygon(points = [], paths = undef, convexity = 1); + polygon(points = [[], []], paths = undef, convexity = 1); + polygon(points = [[[]]], paths = undef, convexity = 1); + multmatrix([[1, 0, 0, 2], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[0, 0], [1, 0], [1, 1]], paths = undef, convexity = 1); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[0, 0]], paths = undef, convexity = 1); + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[0, 0], [1, 1]], paths = undef, convexity = 1); + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[0, 0], [1, 1], [2, 2]], paths = undef, convexity = 1); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, -2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[0, 0], [1, 0], [1, 1], [0, 1]], paths = undef, convexity = 1); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, -4], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[0, 0], [1, 0], [1, 1], [0, 1]], paths = [], convexity = 1); + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, -2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[0, 0], [1, 0], [0.8, 0.5], [1, 1], [0, 1]], paths = undef, convexity = 1); + } + multmatrix([[1, 0, 0, -2], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[0, 0], [0.5, -0.2], [1, 0], [1.2, 0.5], [1, 1], [0.5, 1.2], [0, 1], [-0.2, 0.5]], paths = undef, convexity = 1); + } + multmatrix([[1, 0, 0, -2], [0, 1, 0, -2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polygon(points = [[0, 0], [0.5, -0.2], [1, 0], [1.2, 0.5], [1, 1], [0.5, 1.2], [0, 1], [-0.2, 0.5]], paths = [[0, 1, 2, 3], [4, 5, 6, 7]], convexity = 1); + } + diff --git a/tests/regression/dumptest/polyhedron-expected.txt b/tests/regression/dumptest/polyhedron-expected.txt index c37a529..806c952 100644 --- a/tests/regression/dumptest/polyhedron-expected.txt +++ b/tests/regression/dumptest/polyhedron-expected.txt @@ -1,3 +1,2 @@ -group() { polyhedron(points = undef, triangles = undef, convexity = 1); -} + diff --git a/tests/regression/dumptest/polyhedron-tests-expected.txt b/tests/regression/dumptest/polyhedron-tests-expected.txt new file mode 100644 index 0000000..7de5236 --- /dev/null +++ b/tests/regression/dumptest/polyhedron-tests-expected.txt @@ -0,0 +1,26 @@ + group() { + polyhedron(points = [[1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0], [0, 0, 1], [0, 0, -1]], triangles = [[0, 4, 2], [0, 2, 5], [0, 3, 4], [0, 5, 3], [1, 2, 4], [1, 5, 2], [1, 4, 3], [1, 3, 5]], convexity = 1); + multmatrix([[1, 0, 0, 2], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polyhedron(points = [[1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0], [0, 0, 1], [0, 0, -1]], triangles = [[0, 4, 2], [0, 2, 5], [0, 3, 4], [0, 5, 3], [1, 2, 4], [1, 5, 2], [1, 3, 4], [1, 3, 5]], convexity = 1); + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polyhedron(points = [[1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0], [0, 0, 1], [0, 0, -1]], triangles = [[0, 2, 4], [0, 5, 2], [0, 4, 3], [0, 3, 5], [1, 4, 2], [1, 2, 5], [1, 3, 4], [1, 5, 3]], convexity = 1); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + difference() { + group() { + polyhedron(points = [[1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0], [0, 0, 1], [0, 0, -1]], triangles = [[0, 4, 2], [0, 2, 5], [0, 3, 4], [0, 5, 3], [1, 2, 4], [1, 5, 2], [1, 4, 3], [1, 3, 5]], convexity = 1); + multmatrix([[1, 0, 0, 2], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polyhedron(points = [[1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0], [0, 0, 1], [0, 0, -1]], triangles = [[0, 4, 2], [0, 2, 5], [0, 3, 4], [0, 5, 3], [1, 2, 4], [1, 5, 2], [1, 3, 4], [1, 3, 5]], convexity = 1); + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + polyhedron(points = [[1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0], [0, 0, 1], [0, 0, -1]], triangles = [[0, 2, 4], [0, 5, 2], [0, 4, 3], [0, 3, 5], [1, 4, 2], [1, 2, 5], [1, 3, 4], [1, 5, 3]], convexity = 1); + } + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 0], [0, 0, 1, 2], [0, 0, 0, 1]]) { + cube(size = [8, 3, 3], center = true); + } + } + } + diff --git a/tests/regression/dumptest/projection-expected.txt b/tests/regression/dumptest/projection-expected.txt index d776c2e..85611b4 100644 --- a/tests/regression/dumptest/projection-expected.txt +++ b/tests/regression/dumptest/projection-expected.txt @@ -1,3 +1,2 @@ -group() { projection(cut = false, convexity = 0); -} + diff --git a/tests/regression/dumptest/projection-tests-expected.txt b/tests/regression/dumptest/projection-tests-expected.txt index 836c115..e51ce8e 100644 --- a/tests/regression/dumptest/projection-tests-expected.txt +++ b/tests/regression/dumptest/projection-tests-expected.txt @@ -1,11 +1,15 @@ -group() { - linear_extrude(file = "", cache = "0.0", layer = "", height = 20, origin = [ 0 0 ], scale = 1, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + projection(cut = false, convexity = 0); + projection(cut = false, convexity = 0); + projection(cut = true, convexity = 0) { + square(size = [1, 1], center = false); + } + linear_extrude(height = 20, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { projection(cut = false, convexity = 0) { sphere($fn = 0, $fa = 12, $fs = 1, r = 10); } } multmatrix([[1, 0, 0, 22], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(file = "", cache = "0.0", layer = "", height = 20, origin = [ 0 0 ], scale = 1, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + linear_extrude(height = 20, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { projection(cut = true, convexity = 0) { multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 9], [0, 0, 0, 1]]) { sphere($fn = 0, $fa = 12, $fs = 1, r = 10); @@ -14,7 +18,7 @@ group() { } } multmatrix([[1, 0, 0, 44], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { - linear_extrude(file = "", cache = "0.0", layer = "", height = 20, origin = [ 0 0 ], scale = 1, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + linear_extrude(height = 20, center = false, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { projection(cut = true, convexity = 0) { multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 7], [0, 0, 0, 1]]) { sphere($fn = 0, $fa = 12, $fs = 1, r = 10); @@ -22,4 +26,4 @@ group() { } } } -} + diff --git a/tests/regression/dumptest/render-expected.txt b/tests/regression/dumptest/render-expected.txt index c599c6b..dcc005e 100644 --- a/tests/regression/dumptest/render-expected.txt +++ b/tests/regression/dumptest/render-expected.txt @@ -1,3 +1,2 @@ -group() { render(convexity = 1); -} + diff --git a/tests/regression/dumptest/render-tests-expected.txt b/tests/regression/dumptest/render-tests-expected.txt new file mode 100644 index 0000000..6914270 --- /dev/null +++ b/tests/regression/dumptest/render-tests-expected.txt @@ -0,0 +1,71 @@ + render(convexity = 1); + render(convexity = 1); + group() { + difference() { + cube(size = [100, 100, 100], center = true); + multmatrix([[1, 0, 0, -50], [0, 1, 0, -50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[-1, -1.22465e-16, 0, 0], [1.22465e-16, -1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + difference() { + cube(size = [20, 20, 150], center = true); + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 80, r1 = 10, r2 = 10, center = true); + } + } + } + } + } + multmatrix([[1, 0, 0, 50], [0, 1, 0, -50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[-1.83697e-16, 1, 0, 0], [-1, -1.83697e-16, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + difference() { + cube(size = [20, 20, 150], center = true); + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 80, r1 = 10, r2 = 10, center = true); + } + } + } + } + } + } + } + multmatrix([[1, 0, 0, 110], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + difference() { + cube(size = [100, 100, 100], center = true); + multmatrix([[1, 0, 0, -50], [0, 1, 0, -50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[-1, -1.22465e-16, 0, 0], [1.22465e-16, -1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + render(convexity = 2) { + group() { + difference() { + cube(size = [20, 20, 150], center = true); + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 80, r1 = 10, r2 = 10, center = true); + } + } + } + } + } + } + } + multmatrix([[1, 0, 0, 50], [0, 1, 0, -50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[-1.83697e-16, 1, 0, 0], [-1, -1.83697e-16, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + render(convexity = 2) { + group() { + difference() { + cube(size = [20, 20, 150], center = true); + multmatrix([[1, 0, 0, -10], [0, 1, 0, -10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 80, r1 = 10, r2 = 10, center = true); + } + } + } + } + } + } + } + } + } + } + diff --git a/tests/regression/dumptest/root-modifier-expected.txt b/tests/regression/dumptest/root-modifier-expected.txt new file mode 100644 index 0000000..ca75e52 --- /dev/null +++ b/tests/regression/dumptest/root-modifier-expected.txt @@ -0,0 +1,5 @@ + difference() { + sphere($fn = 0, $fa = 12, $fs = 1, r = 10); + cylinder($fn = 0, $fa = 12, $fs = 1, h = 30, r1 = 6, r2 = 6, center = true); + } + diff --git a/tests/regression/dumptest/rotate-expected.txt b/tests/regression/dumptest/rotate-expected.txt index 87e28e2..c3185a3 100644 --- a/tests/regression/dumptest/rotate-expected.txt +++ b/tests/regression/dumptest/rotate-expected.txt @@ -1,3 +1,2 @@ -group() { multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]); -} + diff --git a/tests/regression/dumptest/rotate_extrude-expected.txt b/tests/regression/dumptest/rotate_extrude-expected.txt index e2f5832..9ab8f0f 100644 --- a/tests/regression/dumptest/rotate_extrude-expected.txt +++ b/tests/regression/dumptest/rotate_extrude-expected.txt @@ -1,3 +1,2 @@ -group() { rotate_extrude(convexity = 1, $fn = 0, $fa = 12, $fs = 1); -} + diff --git a/tests/regression/dumptest/rotate_extrude-tests-expected.txt b/tests/regression/dumptest/rotate_extrude-tests-expected.txt index 068d32c..f3deec2 100644 --- a/tests/regression/dumptest/rotate_extrude-tests-expected.txt +++ b/tests/regression/dumptest/rotate_extrude-tests-expected.txt @@ -1,7 +1,45 @@ -group() { - rotate_extrude(file = "", cache = "0.0", layer = "", origin = [ 0 0 ], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + rotate_extrude(convexity = 1, $fn = 0, $fa = 12, $fs = 1); + rotate_extrude(convexity = 1, $fn = 0, $fa = 12, $fs = 1); + rotate_extrude(convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + cube(size = [1, 1, 1], center = false); + } + rotate_extrude(convexity = 1, $fn = 0, $fa = 12, $fs = 1) { multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { circle($fn = 0, $fa = 12, $fs = 1, r = 10); } } -} + multmatrix([[1, 0, 0, 50], [0, 1, 0, -20], [0, 0, 1, 0], [0, 0, 0, 1]]) { + difference() { + rotate_extrude(convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + difference() { + circle($fn = 0, $fa = 12, $fs = 1, r = 10); + circle($fn = 0, $fa = 12, $fs = 1, r = 8); + } + } + } + multmatrix([[1, 0, 0, -50], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [100, 100, 100], center = true); + } + } + } + multmatrix([[1, 0, 0, 50], [0, 1, 0, 50], [0, 0, 1, 0], [0, 0, 0, 1]]) { + difference() { + difference() { + rotate_extrude(convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 0, $fa = 12, $fs = 1, r = 10); + } + } + rotate_extrude(convexity = 1, $fn = 0, $fa = 12, $fs = 1) { + multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + circle($fn = 0, $fa = 12, $fs = 1, r = 8); + } + } + } + multmatrix([[1, 0, 0, -50], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + cube(size = [100, 100, 100], center = true); + } + } + } + diff --git a/tests/regression/dumptest/rotate_extrude_dxf-tests-expected.txt b/tests/regression/dumptest/rotate_extrude_dxf-tests-expected.txt new file mode 100644 index 0000000..77ba467 --- /dev/null +++ b/tests/regression/dumptest/rotate_extrude_dxf-tests-expected.txt @@ -0,0 +1,2 @@ + rotate_extrude(file = "/Users/kintel/code/OpenSCAD/openscad/testdata/dxf/open-polyline.dxf", cache = "4ead4109.2d8a", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 1); + diff --git a/tests/regression/dumptest/scale-expected.txt b/tests/regression/dumptest/scale-expected.txt index 87e28e2..c3185a3 100644 --- a/tests/regression/dumptest/scale-expected.txt +++ b/tests/regression/dumptest/scale-expected.txt @@ -1,3 +1,2 @@ -group() { multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]); -} + diff --git a/tests/regression/dumptest/sphere-expected.txt b/tests/regression/dumptest/sphere-expected.txt index bc8bc7b..3a93101 100644 --- a/tests/regression/dumptest/sphere-expected.txt +++ b/tests/regression/dumptest/sphere-expected.txt @@ -1,3 +1,2 @@ -group() { sphere($fn = 0, $fa = 12, $fs = 1, r = 1); -} + diff --git a/tests/regression/dumptest/sphere-tests-expected.txt b/tests/regression/dumptest/sphere-tests-expected.txt index a672c23..f6f6a49 100644 --- a/tests/regression/dumptest/sphere-tests-expected.txt +++ b/tests/regression/dumptest/sphere-tests-expected.txt @@ -1,12 +1,29 @@ -group() { - sphere($fn = 0, $fa = 12, $fs = 1, r = 5); - multmatrix([[1, 0, 0, 0], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { - sphere($fn = 0, $fa = 5, $fs = 0.5, r = 5); + sphere($fn = 0, $fa = 12, $fs = 1, r = 1); + multmatrix([[1, 0, 0, 2], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 0); } - multmatrix([[1, 0, 0, 12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { - sphere($fn = 0, $fa = 12, $fs = 1, r = 6); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 11], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 5); } - multmatrix([[1, 0, 0, 12], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { - sphere($fn = 5, $fa = 12, $fs = 1, r = 6); + multmatrix([[1, 0, 0, 0], [0, 1, 0, -11], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 12, $fs = 1, r = 5); } -} + multmatrix([[1, 0, 0, 11], [0, 1, 0, -11], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 5); + } + multmatrix([[1, 0, 0, 11], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 10, $fa = 12, $fs = 1, r = 5); + } + multmatrix([[1, 0, 0, 11], [0, 1, 0, 11], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 15, $fa = 12, $fs = 1, r = 5); + } + multmatrix([[1, 0, 0, 22], [0, 1, 0, -11], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 20, $fs = 0.3, r = 5); + } + multmatrix([[1, 0, 0, 22], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 30, $fs = 0.3, r = 5); + } + multmatrix([[1, 0, 0, 22], [0, 1, 0, 11], [0, 0, 1, 0], [0, 0, 0, 1]]) { + sphere($fn = 0, $fa = 40, $fs = 0.3, r = 5); + } + diff --git a/tests/regression/dumptest/square-expected.txt b/tests/regression/dumptest/square-expected.txt index a4a24d8..0f14657 100644 --- a/tests/regression/dumptest/square-expected.txt +++ b/tests/regression/dumptest/square-expected.txt @@ -1,3 +1,2 @@ -group() { square(size = [1, 1], center = false); -} + diff --git a/tests/regression/dumptest/square-tests-expected.txt b/tests/regression/dumptest/square-tests-expected.txt new file mode 100644 index 0000000..c23c83d --- /dev/null +++ b/tests/regression/dumptest/square-tests-expected.txt @@ -0,0 +1,23 @@ + square(size = [1, 1], center = false); + multmatrix([[1, 0, 0, 2], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 1], center = true); + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [0, 0], center = true); + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 0], center = true); + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [0, 1], center = true); + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [1, 2], center = true); + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + square(size = [2, 1], center = true); + } + diff --git a/tests/regression/dumptest/string-test-expected.txt b/tests/regression/dumptest/string-test-expected.txt index 434cc8f..b2915cb 100644 --- a/tests/regression/dumptest/string-test-expected.txt +++ b/tests/regression/dumptest/string-test-expected.txt @@ -1,3 +1,2 @@ -group() { group(); -} + diff --git a/tests/regression/dumptest/subdiv-expected.txt b/tests/regression/dumptest/subdiv-expected.txt index bc40dc2..cd7d37e 100644 --- a/tests/regression/dumptest/subdiv-expected.txt +++ b/tests/regression/dumptest/subdiv-expected.txt @@ -1,3 +1,2 @@ -group() { subdiv(level = 1, convexity = 0); -} + diff --git a/tests/regression/dumptest/surface-expected.txt b/tests/regression/dumptest/surface-expected.txt index 4c9b5b8..7ed73bd 100644 --- a/tests/regression/dumptest/surface-expected.txt +++ b/tests/regression/dumptest/surface-expected.txt @@ -1,3 +1,2 @@ -group() { surface(file = "", center = false); -} + diff --git a/tests/regression/dumptest/surface-tests-expected.txt b/tests/regression/dumptest/surface-tests-expected.txt index 9786d85..9405aa4 100644 --- a/tests/regression/dumptest/surface-tests-expected.txt +++ b/tests/regression/dumptest/surface-tests-expected.txt @@ -1,3 +1,3 @@ -group() { - surface(file = "/Users/kintel/code/metalab/checkout/OpenSCAD/openscad-visitor/testdata/scad/surface.dat", center = false); -} + surface(file = "", center = false); + surface(file = "/Users/kintel/code/OpenSCAD/openscad/testdata/scad/features/surface.dat", center = true); + diff --git a/tests/regression/dumptest/testcolornames-expected.txt b/tests/regression/dumptest/testcolornames-expected.txt new file mode 100644 index 0000000..626a266 --- /dev/null +++ b/tests/regression/dumptest/testcolornames-expected.txt @@ -0,0 +1,706 @@ + multmatrix([[1, 0, 0, 1], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.803922, 0.360784, 0.360784, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.941176, 0.501961, 0.501961, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.980392, 0.501961, 0.447059, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.913725, 0.588235, 0.478431, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.627451, 0.478431, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0, 0, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.862745, 0.0784314, 0.235294, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.698039, 0.133333, 0.133333, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 9], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.545098, 0, 0, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.752941, 0.796078, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 1], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.713725, 0.756863, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.411765, 0.705882, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.0784314, 0.576471, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.780392, 0.0823529, 0.521569, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.858824, 0.439216, 0.576471, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.627451, 0.478431, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.498039, 0.313725, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 9], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.388235, 0.278431, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.270588, 0, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.54902, 0, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 1], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.647059, 0, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.843137, 0, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 1, 0, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 1, 0.878431, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.980392, 0.803922, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.980392, 0.980392, 0.823529, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.937255, 0.835294, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 9], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.894118, 0.709804, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 2], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.854902, 0.72549, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.933333, 0.909804, 0.666667, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 1], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.941176, 0.901961, 0.54902, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.741176, 0.717647, 0.419608, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.901961, 0.901961, 0.980392, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.847059, 0.74902, 0.847059, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.866667, 0.627451, 0.866667, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.933333, 0.509804, 0.933333, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.854902, 0.439216, 0.839216, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 9], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0, 1, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 3], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0, 1, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 4], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.729412, 0.333333, 0.827451, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 1], [0, 1, 0, 4], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.576471, 0.439216, 0.858824, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 4], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.541176, 0.168627, 0.886275, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 4], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.580392, 0, 0.827451, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 4], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.6, 0.196078, 0.8, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 4], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.545098, 0, 0.545098, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 4], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.501961, 0, 0.501961, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 4], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.294118, 0, 0.509804, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 4], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.282353, 0.239216, 0.545098, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 9], [0, 1, 0, 4], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.415686, 0.352941, 0.803922, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 4], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.482353, 0.407843, 0.933333, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 1], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.678431, 1, 0.184314, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.498039, 1, 0, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.486275, 0.988235, 0, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0, 1, 0, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.196078, 0.803922, 0.196078, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.596078, 0.984314, 0.596078, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.564706, 0.933333, 0.564706, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0, 0.980392, 0.603922, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 9], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0, 1, 0.498039, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 5], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.235294, 0.701961, 0.443137, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.180392, 0.545098, 0.341176, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 1], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.133333, 0.545098, 0.133333, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0, 0.501961, 0, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0, 0.392157, 0, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.603922, 0.803922, 0.196078, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.419608, 0.556863, 0.137255, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.501961, 0.501961, 0, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.333333, 0.419608, 0.184314, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.4, 0.803922, 0.666667, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 9], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.560784, 0.737255, 0.560784, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 6], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.12549, 0.698039, 0.666667, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 7], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0, 0.545098, 0.545098, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 1], [0, 1, 0, 7], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0, 0.501961, 0.501961, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 7], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0, 1, 1, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 7], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0, 1, 1, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 7], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.878431, 1, 1, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 7], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.686275, 0.933333, 0.933333, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 7], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.498039, 1, 0.831373, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 7], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.25098, 0.878431, 0.815686, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 9], [0, 1, 0, 7], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.282353, 0.819608, 0.8, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 7], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0, 0.807843, 0.819608, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 8], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.372549, 0.619608, 0.627451, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 1], [0, 1, 0, 8], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.27451, 0.509804, 0.705882, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 8], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.690196, 0.768627, 0.870588, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 8], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.690196, 0.878431, 0.901961, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 8], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.678431, 0.847059, 0.901961, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 8], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.529412, 0.807843, 0.921569, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 8], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.529412, 0.807843, 0.980392, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 8], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0, 0.74902, 1, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 8], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.117647, 0.564706, 1, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 9], [0, 1, 0, 8], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.392157, 0.584314, 0.929412, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 8], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.254902, 0.411765, 0.882353, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 9], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0, 0, 1, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 1], [0, 1, 0, 9], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0, 0, 0.803922, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 9], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0, 0, 0.545098, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 9], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0, 0, 0.501961, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 9], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.0980392, 0.0980392, 0.439216, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 9], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.972549, 0.862745, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 9], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.921569, 0.803922, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 9], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.894118, 0.768627, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 9], [0, 1, 0, 9], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.870588, 0.678431, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 9], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.960784, 0.870588, 0.701961, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.870588, 0.721569, 0.529412, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 1], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.823529, 0.705882, 0.54902, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.737255, 0.560784, 0.560784, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.956863, 0.643137, 0.376471, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.854902, 0.647059, 0.12549, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.721569, 0.52549, 0.0431373, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.803922, 0.521569, 0.247059, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.823529, 0.411765, 0.117647, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.545098, 0.270588, 0.0745098, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 9], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.627451, 0.321569, 0.176471, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 10], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.647059, 0.164706, 0.164706, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 11], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.501961, 0, 0, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 11], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 1, 1, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 11], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.980392, 0.980392, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 11], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.941176, 1, 0.941176, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 11], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.960784, 1, 0.980392, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 11], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.941176, 1, 1, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 11], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.941176, 0.972549, 1, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 8], [0, 1, 0, 11], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.972549, 0.972549, 1, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 9], [0, 1, 0, 11], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.960784, 0.960784, 0.960784, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 11], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.960784, 0.933333, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.960784, 0.960784, 0.862745, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 1], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.992157, 0.960784, 0.901961, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.980392, 0.941176, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 1, 0.941176, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.980392, 0.921569, 0.843137, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.980392, 0.941176, 0.901961, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.941176, 0.960784, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([1, 0.894118, 0.882353, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 9], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.862745, 0.862745, 0.862745, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 10], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.827451, 0.827451, 0.827451, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 13], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.752941, 0.752941, 0.752941, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 1], [0, 1, 0, 13], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.662745, 0.662745, 0.662745, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 2], [0, 1, 0, 13], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.501961, 0.501961, 0.501961, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 3], [0, 1, 0, 13], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.411765, 0.411765, 0.411765, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 4], [0, 1, 0, 13], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.466667, 0.533333, 0.6, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 5], [0, 1, 0, 13], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.439216, 0.501961, 0.564706, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 6], [0, 1, 0, 13], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0.184314, 0.309804, 0.309804, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + multmatrix([[1, 0, 0, 7], [0, 1, 0, 13], [0, 0, 1, 0], [0, 0, 0, 1]]) { + color([0, 0, 0, 1]) { + sphere($fn = 5, $fa = 12, $fs = 1, r = 0.8); + } + } + diff --git a/tests/regression/dumptest/transform-tests-expected.txt b/tests/regression/dumptest/transform-tests-expected.txt new file mode 100644 index 0000000..97657da --- /dev/null +++ b/tests/regression/dumptest/transform-tests-expected.txt @@ -0,0 +1,44 @@ + multmatrix([[1, 0, 0, 25], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 2, 0, 0], [0, 0, 0.5, 0], [0, 0, 0, 1]]) { + group() { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 20, r1 = 10, r2 = 0, center = false); + } + } + } + multmatrix([[1, 0, 0, 20], [0, 1, 0, -30], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[0.5, 0, 0, 0], [0, 0.5, 0, 0], [0, 0, 0.5, 0], [0, 0, 0, 1]]) { + group() { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 20, r1 = 10, r2 = 0, center = false); + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, -20], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[1, 0, 0, 0], [0, 2.22045e-16, -1, 0], [0, 1, 2.22045e-16, 0], [0, 0, 0, 1]]) { + group() { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 20, r1 = 10, r2 = 0, center = false); + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, -40], [0, 0, 1, 0], [0, 0, 0, 1]]) { + multmatrix([[0.707107, -1.11022e-16, 0.707107, 0], [0.707107, 2.22045e-16, -0.707107, 0], [0, 1, 3.33067e-16, 0], [0, 0, 0, 1]]) { + group() { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 20, r1 = 10, r2 = 0, center = false); + } + } + } + multmatrix([[1, 0, 0, 0], [0, 0.707107, 0.707107, 0], [0, -0.707107, 0.707107, 0], [0, 0, 0, 1]]) { + group() { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 20, r1 = 10, r2 = 0, center = false); + } + } + multmatrix([[1, 0, 0, -25], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + group() { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 20, r1 = 10, r2 = 0, center = false); + } + } + multmatrix([[1, 0.4, 0.1, -25], [0.4, 0.8, 0, -25], [0.2, 0.2, 0.5, 0], [0, 0, 0, 1]]) { + group() { + cylinder($fn = 0, $fa = 12, $fs = 1, h = 20, r1 = 10, r2 = 0, center = false); + } + } + diff --git a/tests/regression/dumptest/translate-expected.txt b/tests/regression/dumptest/translate-expected.txt index 87e28e2..c3185a3 100644 --- a/tests/regression/dumptest/translate-expected.txt +++ b/tests/regression/dumptest/translate-expected.txt @@ -1,3 +1,2 @@ -group() { multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]); -} + diff --git a/tests/regression/dumptest/union-expected.txt b/tests/regression/dumptest/union-expected.txt index 34f53c2..654849e 100644 --- a/tests/regression/dumptest/union-expected.txt +++ b/tests/regression/dumptest/union-expected.txt @@ -1,3 +1,2 @@ -group() { union(); -} + diff --git a/tests/regression/dumptest/union-tests-expected.txt b/tests/regression/dumptest/union-tests-expected.txt new file mode 100644 index 0000000..b0a30f6 --- /dev/null +++ b/tests/regression/dumptest/union-tests-expected.txt @@ -0,0 +1,47 @@ + multmatrix([[1, 0, 0, -12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + union() { + cube(size = [10, 10, 10], center = false); + multmatrix([[1, 0, 0, 4], [0, 1, 0, 4], [0, 0, 1, 8], [0, 0, 0, 1]]) { + cube(size = [2, 2, 10], center = false); + } + } + } + union() { + cube(size = [10, 10, 10], center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 10], [0, 0, 0, 1]]) { + cube(size = [2, 2, 10], center = false); + } + } + multmatrix([[1, 0, 0, 12], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + union() { + cube(size = [10, 10, 10], center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 11], [0, 0, 0, 1]]) { + cube(size = [2, 2, 10], center = false); + } + } + } + multmatrix([[1, 0, 0, 24], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) { + union() { + cube(size = [10, 10, 10], center = false); + multmatrix([[1, 0, 0, 4], [0, 1, 0, 4], [0, 0, 1, 10], [0, 0, 0, 1]]) { + cube(size = [2, 2, 10], center = false); + } + } + } + multmatrix([[1, 0, 0, -12], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + union() { + cube(size = [10, 10, 10], center = false); + multmatrix([[1, 0, 0, -2], [0, 1, 0, 10], [0, 0, 1, 10], [0, 0, 0, 1]]) { + cube(size = [2, 2, 10], center = false); + } + } + } + multmatrix([[1, 0, 0, 0], [0, 1, 0, 12], [0, 0, 1, 0], [0, 0, 0, 1]]) { + union() { + cube(size = [10, 10, 10], center = false); + multmatrix([[1, 0, 0, 0], [0, 1, 0, 10], [0, 0, 1, 10], [0, 0, 0, 1]]) { + cube(size = [2, 2, 10], center = false); + } + } + } + diff --git a/tests/regression/echotest/builtin-tests-expected.txt b/tests/regression/echotest/builtin-tests-expected.txt new file mode 100644 index 0000000..e8b2027 --- /dev/null +++ b/tests/regression/echotest/builtin-tests-expected.txt @@ -0,0 +1 @@ +ECHO: 3.141592653589793 diff --git a/tests/regression/echotest/parser-tests-expected.txt b/tests/regression/echotest/parser-tests-expected.txt new file mode 100644 index 0000000..fb04907 --- /dev/null +++ b/tests/regression/echotest/parser-tests-expected.txt @@ -0,0 +1,5 @@ +ECHO: 0.1 +ECHO: 2 +ECHO: 1100 +ECHO: 0.021 +ECHO: 1.1e-13 diff --git a/tests/tests-common.cc b/tests/tests-common.cc new file mode 100644 index 0000000..1f19c59 --- /dev/null +++ b/tests/tests-common.cc @@ -0,0 +1,32 @@ +#include "tests-common.h" +#include "openscad.h" +#include "module.h" +#include "handle_dep.h" + +#include <QFile> +#include <QFileInfo> +#include <sstream> + +AbstractModule *parsefile(const char *filename) +{ + AbstractModule *root_module = NULL; + + QFileInfo fileInfo(filename); + handle_dep(filename); + FILE *fp = fopen(filename, "rt"); + if (!fp) { + fprintf(stderr, "Can't open input file `%s'!\n", filename); + } else { + std::stringstream text; + char buffer[513]; + int ret; + while ((ret = fread(buffer, 1, 512, fp)) > 0) { + buffer[ret] = 0; + text << buffer; + } + fclose(fp); + text << commandline_commands; + root_module = parse(text.str().c_str(), fileInfo.absolutePath().toLocal8Bit(), false); + } + return root_module; +} diff --git a/tests/tests-common.h b/tests/tests-common.h new file mode 100644 index 0000000..92ebc78 --- /dev/null +++ b/tests/tests-common.h @@ -0,0 +1,6 @@ +#ifndef TESTS_COMMON_H_ +#define TESTS_COMMON_H_ + +class AbstractModule *parsefile(const char *filename); + +#endif |