From 44dd33a5567681d28adb963d1d325aa86d723130 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Fri, 10 Dec 2010 11:46:09 +0000 Subject: Added some tests for new nested include feature. diff --git a/testdata/scad/include test6.scad b/testdata/scad/include test6.scad new file mode 100644 index 0000000..7a79456 --- /dev/null +++ b/testdata/scad/include test6.scad @@ -0,0 +1,4 @@ +module test6() +{ + echo("included from include test6.scad"); +} diff --git a/testdata/scad/include-test.scad b/testdata/scad/include-test.scad new file mode 100644 index 0000000..a9528f5 --- /dev/null +++ b/testdata/scad/include-test.scad @@ -0,0 +1,37 @@ +//Test that the entire path is pushed onto the stack upto the last '/' +include + +//Test with empty path +include + +//Test without preceeding space +include + +//Test with other strange character that is allowed +include>>>>> + +//Test that filenames with spaces work +include + +//Test with empty file +include + +//Test with empty path and file +include + +//Test with empty +include <> + +module test1() +{ + test2(); + test3(); + test4(); + test5(); + test6(); + + //Just to give a top level object + sphere(1); +} + +test1(); diff --git a/testdata/scad/include-test5.scad b/testdata/scad/include-test5.scad new file mode 100644 index 0000000..4f6e656 --- /dev/null +++ b/testdata/scad/include-test5.scad @@ -0,0 +1,4 @@ +module test5() +{ + echo("included from include-test5.scad"); +} diff --git a/testdata/scad/sub1/sub2/sub3/include-test4.scad b/testdata/scad/sub1/sub2/sub3/include-test4.scad new file mode 100644 index 0000000..1cb7eab --- /dev/null +++ b/testdata/scad/sub1/sub2/sub3/include-test4.scad @@ -0,0 +1,4 @@ +module test4() +{ + echo("included from include-test4.scad"); +} diff --git a/testdata/scad/sub1/sub2/sub3/sub4/include-test2.scad b/testdata/scad/sub1/sub2/sub3/sub4/include-test2.scad new file mode 100644 index 0000000..9f4c963 --- /dev/null +++ b/testdata/scad/sub1/sub2/sub3/sub4/include-test2.scad @@ -0,0 +1,10 @@ +//Test nested include +include + +//Test relative file location +include <../include-test4.scad> + +module test2 () +{ + echo("included from include-test2.scad"); +} diff --git a/testdata/scad/sub1/sub2/sub3/sub4/include-test3.scad b/testdata/scad/sub1/sub2/sub3/sub4/include-test3.scad new file mode 100644 index 0000000..2f67e93 --- /dev/null +++ b/testdata/scad/sub1/sub2/sub3/sub4/include-test3.scad @@ -0,0 +1,4 @@ +module test3() +{ + echo("included from include-test3.scad"); +} -- cgit v0.10.1 From 03c02cde89d43d465b9e9a354be8668fe6fca56d Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Fri, 10 Dec 2010 18:31:33 +0000 Subject: A basic test for the escape sequences in strings. diff --git a/testdata/scad/string-test.scad b/testdata/scad/string-test.scad new file mode 100644 index 0000000..5ec4cfb --- /dev/null +++ b/testdata/scad/string-test.scad @@ -0,0 +1 @@ +echo("The quick brown fox \tjumps \"over\" the lazy dog.\rThe quick brown fox.\nThe \\lazy\\ dog."); -- cgit v0.10.1 From 052f8bc620f579271be69a0d0d699b8b4ac5bb14 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sat, 11 Dec 2010 12:41:23 +0000 Subject: Fix for when the included file doesn't exist. Needed because we will never get an EOF, and so never pop the stack. diff --git a/src/lexer.l b/src/lexer.l index 9e8aaf8..932711b 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -202,6 +202,7 @@ void includefile() yyin = fopen(finfo.absoluteFilePath().toLocal8Bit(), "r"); if (!yyin) { PRINTA("WARNING: Can't open input file `%1'.", filename); + path_stack.pop(); return; } filename.clear(); diff --git a/testdata/scad/include-test.scad b/testdata/scad/include-test.scad index a9528f5..5db02d7 100644 --- a/testdata/scad/include-test.scad +++ b/testdata/scad/include-test.scad @@ -1,6 +1,9 @@ //Test that the entire path is pushed onto the stack upto the last '/' include +//Test that a non existent path/file doesn't screw things up +include + //Test with empty path include -- cgit v0.10.1 From 323918efef1af8b2abeed0e77567687278e74595 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 11 Dec 2010 22:01:35 +0100 Subject: sync diff --git a/doc/TODO.txt b/doc/TODO.txt index feed2b9..63afb03 100644 --- a/doc/TODO.txt +++ b/doc/TODO.txt @@ -4,8 +4,9 @@ BUGS o Some invalid DXF data gets pass the import checks and breaks the tessing code o Tesselation via GLU sometimes produces strange results o Export STL: Exports existing CGAL model even though the current model is changed, but not CGAL rendered -o It's now possible to start a new rendering while one is already running. +o It's now possible to start a new rendering while one is already running (which call processEvents()) -> turn off most (or all) interaction while rendering + -> Lock all or only one MainWindow (MDI)? o Look into the polygon winding and rotate_extrude() problem reported by Britton STL Import BUGS -- cgit v0.10.1 From f04c235f2f0480fce04e55812e3b7611db34577b Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 25 Dec 2010 23:46:07 +0100 Subject: Added section for proposed language changes for 'V2.0' diff --git a/doc/TODO.txt b/doc/TODO.txt index 63afb03..a053b58 100644 --- a/doc/TODO.txt +++ b/doc/TODO.txt @@ -169,6 +169,11 @@ o Grammar - import_*() -> *_import() (consistent prefix vs. postfix) - linear_extrude()/rotate_extrude(): Cumbersome names? -> (extrude, revolve, lathe, sweep ?) +IDEAS FOR LANGUAGE CHANGES +-------------------------- +o More strict checking of module parameters to make e.g. this fail: + module test(a,b) { a=1; b=2; echo(a,b,c); } test(c=3); + CODE ---- -- cgit v0.10.1 From 592ca6abadcb6443629be4407b973279a891278c Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sat, 25 Dec 2010 23:55:28 +0100 Subject: Output LWPOLYLINE objects instead of LINE for DXF export. Patch submitted by Lars Kruse diff --git a/src/export.cc b/src/export.cc index 40b16d5..2b474f6 100644 --- a/src/export.cc +++ b/src/export.cc @@ -166,6 +166,20 @@ void export_dxf(CGAL_Nef_polyhedron *root_N, QString filename, QProgressDialog * } setlocale(LC_NUMERIC, "C"); // Ensure radix is . (not ,) in output + + // Some importers (e.g. QCAD) needs a HEADER section specifying AutoCAD 2000 as + // the file format for LWPOLYLINE entities to work + fprintf(f, " 0\n" + "SECTION\n" + " 2\n" + "HEADER\n" + " 9\n" + "$ACADVER\n" + " 1\n" + "AC1015\n" + " 0\n" + "ENDSEC\n"); + // Some importers (e.g. Inkscape) needs a BLOCKS section to be present fprintf(f, " 0\n" "SECTION\n" @@ -182,26 +196,29 @@ void export_dxf(CGAL_Nef_polyhedron *root_N, QString filename, QProgressDialog * DxfData dd(*root_N); for (int i=0; ix; - double y1 = p1->y; - double x2 = p2->x; - double y2 = p2->y; - fprintf(f, " 0\n"); - fprintf(f, "LINE\n"); - // Some importers (e.g. Inkscape) needs a layer to be specified - fprintf(f, " 8\n"); - fprintf(f, "0\n"); + if (dd.paths[i].points.size() < 2) + // not a valid polygon + continue; + // Use the LWPOLYLINE class - this makes it easier to handle complete + // objects (as paths) in Inkscape. + fprintf(f, " 0\n"); + fprintf(f, "LWPOLYLINE\n"); + // Some importers (e.g. Inkscape) need a layer to be specified + fprintf(f, " 8\n"); + fprintf(f, "0\n"); + // number of vertices + fprintf(f, " 90\n"); + fprintf(f, "%d\n", dd.paths[i].points.size()); + // polygon flag (closed, ...) + fprintf(f, " 70\n"); + fprintf(f, "%d\n", dd.paths[i].is_closed ? 1 : 0); + // add all points + for (int j=0; jx); fprintf(f, " 20\n"); - fprintf(f, "%f\n", y1); - fprintf(f, " 21\n"); - fprintf(f, "%f\n", y2); + fprintf(f, "%f\n", p->y); } } -- cgit v0.10.1