summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2012-01-08 18:14:30 (GMT)
committerMarius Kintel <marius@kintel.net>2012-01-08 18:14:30 (GMT)
commit3c18145b13759db1a8926e29b81fb41f8efcde4d (patch)
tree75cc01dd8507a1667c4ba715cdc408ad785dce19
parent11fb1f71dad9c7d744ff5bbe7c3ee017ed67ff41 (diff)
parentf3e6e8168bac6b14383d1d321de7dcf122e0b7de (diff)
Merge branch 'master' into boost_filesystem
-rw-r--r--RELEASE_NOTES6
-rw-r--r--contrib/BBEdit-TextWrangler.txt5
-rw-r--r--contrib/OpenSCAD.plist119
-rw-r--r--doc/TODO.txt4
-rw-r--r--icons/icon-alpha.pngbin96607 -> 82391 bytes
-rw-r--r--icons/icon.pngbin121168 -> 84812 bytes
-rw-r--r--icons/mask.pngbin4470 -> 2359 bytes
-rw-r--r--icons/openscad.desktop7
-rw-r--r--icons/openscad.pngbin0 -> 82391 bytes
-rw-r--r--openscad.pro8
-rw-r--r--src/CGALEvaluator.cc5
-rw-r--r--src/Preferences.cc18
-rw-r--r--src/func.cc18
-rw-r--r--src/value.cc1
-rw-r--r--testdata/scad/bugs/minkowski-crash.scad26
-rw-r--r--tests/CMingw-cross-env.cmake3
16 files changed, 199 insertions, 21 deletions
diff --git a/RELEASE_NOTES b/RELEASE_NOTES
index 295f6f4..e025d9b 100644
--- a/RELEASE_NOTES
+++ b/RELEASE_NOTES
@@ -1,6 +1,12 @@
OpenSCAD 2012.XX
================
+Bugfixes:
+o use'ing an non-existing file sometimes crashed under Windows
+o Better font handling: Ensure a monospace font is chosen as default
+o Division by zero caused hang in some cases (e.g. sin(1/0))
+o Larger minkowski operations sometimes caused a crash after a CGAL assert was thrown
+
Deprecations:
o The old include syntax "<filename.scad>" without the include keyword is no
longer supported and will cause a syntax error.
diff --git a/contrib/BBEdit-TextWrangler.txt b/contrib/BBEdit-TextWrangler.txt
new file mode 100644
index 0000000..e15a980
--- /dev/null
+++ b/contrib/BBEdit-TextWrangler.txt
@@ -0,0 +1,5 @@
+BBEdit:
+Install OpenSCAD.plist into ~/Library/Application Support/BBEdit/Language Modules
+
+TextWrangler:
+Install OpenSCAD.plist into ~/Library/Application Support/TextWrangler/Language Modules
diff --git a/contrib/OpenSCAD.plist b/contrib/OpenSCAD.plist
new file mode 100644
index 0000000..2f8860c
--- /dev/null
+++ b/contrib/OpenSCAD.plist
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>BBEditDocumentType</key>
+ <string>CodelessLanguageModule</string>
+ <key>BBLMCanSpellCheckCodeRuns</key>
+ <true/>
+ <key>BBLMColorsSyntax</key>
+ <true/>
+ <key>BBLMIsCaseSensitive</key>
+ <true/>
+ <key>BBLMKeywordList</key>
+ <array>
+ <string>!</string>
+ <string>#</string>
+ <string>$fa</string>
+ <string>$fn</string>
+ <string>$fs</string>
+ <string>$t</string>
+ <string>%</string>
+ <string>*</string>
+ <string>assign</string>
+ <string>center</string>
+ <string>circle</string>
+ <string>color</string>
+ <string>cube</string>
+ <string>cylinder</string>
+ <string>difference</string>
+ <string>echo</string>
+ <string>for</string>
+ <string>function</string>
+ <string>hull</string>
+ <string>if</string>
+ <string>import_dxf</string>
+ <string>import_stl</string>
+ <string>include</string>
+ <string>intersection</string>
+ <string>intersection_for</string>
+ <string>linear_extrude</string>
+ <string>minkowski</string>
+ <string>mirror</string>
+ <string>module</string>
+ <string>multmatrix</string>
+ <string>polygon</string>
+ <string>polyhedron</string>
+ <string>projection</string>
+ <string>render</string>
+ <string>rotate</string>
+ <string>rotate_extrude</string>
+ <string>scale</string>
+ <string>sphere</string>
+ <string>square</string>
+ <string>str</string>
+ <string>surface</string>
+ <string>translate</string>
+ <string>union</string>
+ <string>use</string>
+ </array>
+ <key>BBLMLanguageCode</key>
+ <string>Oscd</string>
+ <key>BBLMLanguageDisplayName</key>
+ <string>OpenSCAD</string>
+ <key>BBLMScansFunctions</key>
+ <true/>
+ <key>BBLMSuffixMap</key>
+ <array>
+ <dict>
+ <key>BBLMLanguageSuffix</key>
+ <string>.scad</string>
+ </dict>
+ </array>
+ <key>BBLMSupportsTextCompletion</key>
+ <true/>
+ <key>Language Features</key>
+ <dict>
+ <key>Close Block Comments</key>
+ <string>*/</string>
+ <key>Close Parameter Lists</key>
+ <string>)</string>
+ <key>Close Statement Blocks</key>
+ <string>}</string>
+ <key>Close Strings 1</key>
+ <string>"</string>
+ <key>Close Strings 2</key>
+ <string>'</string>
+ <key>End-of-line Ends Strings 1</key>
+ <true/>
+ <key>End-of-line Ends Strings 2</key>
+ <true/>
+ <key>Escape Char in Strings 1</key>
+ <string></string>
+ <key>Escape Char in Strings 2</key>
+ <string></string>
+ <key>Identifier and Keyword Characters</key>
+ <string>!$%*0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz</string>
+ <key>Open Block Comments</key>
+ <string>/*</string>
+ <key>Open Line Comments</key>
+ <string>//</string>
+ <key>Open Parameter Lists</key>
+ <string>(</string>
+ <key>Open Statement Blocks</key>
+ <string>{</string>
+ <key>Open Strings 1</key>
+ <string>"</string>
+ <key>Open Strings 2</key>
+ <string>'</string>
+ <key>Prefix for Functions</key>
+ <string>function</string>
+ <key>Prefix for Procedures</key>
+ <string>module</string>
+ <key>Terminator for Prototypes 1</key>
+ <string></string>
+ <key>Terminator for Prototypes 2</key>
+ <string></string>
+ </dict>
+</dict>
+</plist>
diff --git a/doc/TODO.txt b/doc/TODO.txt
index 8f6d257..9479e69 100644
--- a/doc/TODO.txt
+++ b/doc/TODO.txt
@@ -175,10 +175,12 @@ o Misc
- Is there a reason why modules like echo, empty if, empty for loop returns an
empty AbstractNode instead of being ignored?
- Dependency tracking of libraries (USE'd modules) isn't implemented. See Mail from nophead 20110823.
-o Grammar
+o Grammar/Parser
- dim->name -> dim->label
- A random(seed) function
- linear_extrude()/rotate_extrude(): Cumbersome names? -> (extrude, revolve, lathe, sweep ?)
+ - If a compile error occurs in an included file, line numbers are global
+ and doesn't say in which file the error occurred.
o Hollow donut problem
When extruding a 2D CSG tree (e.g. a polygon with a hole), the hole
information is lost when performing the extrusion. For linear
diff --git a/icons/icon-alpha.png b/icons/icon-alpha.png
index 67b6e63..192e5f1 100644
--- a/icons/icon-alpha.png
+++ b/icons/icon-alpha.png
Binary files differ
diff --git a/icons/icon.png b/icons/icon.png
index 7912038..837ead9 100644
--- a/icons/icon.png
+++ b/icons/icon.png
Binary files differ
diff --git a/icons/mask.png b/icons/mask.png
index eea1027..15ce869 100644
--- a/icons/mask.png
+++ b/icons/mask.png
Binary files differ
diff --git a/icons/openscad.desktop b/icons/openscad.desktop
new file mode 100644
index 0000000..07df5aa
--- /dev/null
+++ b/icons/openscad.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Type=Application
+Version=1.0
+Name=OpenSCAD
+Icon=openscad
+Exec=openscad %f
+Categories=Graphics;3DGraphics;Engineering;
diff --git a/icons/openscad.png b/icons/openscad.png
new file mode 100644
index 0000000..192e5f1
--- /dev/null
+++ b/icons/openscad.png
Binary files differ
diff --git a/openscad.pro b/openscad.pro
index 69386b5..f303ba9 100644
--- a/openscad.pro
+++ b/openscad.pro
@@ -296,3 +296,11 @@ INSTALLS += examples
libraries.path = $$PREFIX/share/openscad/libraries/
libraries.files = libraries/*
INSTALLS += libraries
+
+applications.path = $$PREFIX/share/applications
+applications.files = icons/openscad.desktop
+INSTALLS += applications
+
+icons.path = $$PREFIX/share/pixmaps
+icons.files = icons/openscad.png
+INSTALLS += icons
diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc
index a54fe02..88d1f00 100644
--- a/src/CGALEvaluator.cc
+++ b/src/CGALEvaluator.cc
@@ -85,6 +85,11 @@ void CGALEvaluator::process(CGAL_Nef_polyhedron &target, const CGAL_Nef_polyhedr
// 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());
+
+ // Minkowski errors can result in corrupt polyhedrons
+ if (op == CGE_MINKOWSKI) {
+ target = src;
+ }
}
CGAL::set_error_behaviour(old_behaviour);
}
diff --git a/src/Preferences.cc b/src/Preferences.cc
index 4c43f2d..e05106b 100644
--- a/src/Preferences.cc
+++ b/src/Preferences.cc
@@ -47,16 +47,24 @@ Preferences::Preferences(QWidget *parent) : QMainWindow(parent)
// Setup default settings
this->defaultmap["3dview/colorscheme"] = this->colorSchemeChooser->currentItem()->text();
+ this->defaultmap["advanced/opencsg_show_warning"] = true;
+ this->defaultmap["advanced/enable_opencsg_opengl1x"] = true;
+
+ // Setup default font (Try to use a nice monospace font)
+ QString fontfamily;
#ifdef Q_WS_X11
- this->defaultmap["editor/fontfamily"] = "Mono";
+ fontfamily = "Mono";
#elif defined (Q_WS_WIN)
- this->defaultmap["editor/fontfamily"] = "Console";
+ fontfamily = "Console";
#elif defined (Q_WS_MAC)
- this->defaultmap["editor/fontfamily"] = "Monaco";
+ fontfamily = "Monaco";
#endif
+ QFont font;
+ font.setStyleHint(QFont::TypeWriter);
+ font.setFamily(fontfamily); // this runs Qt's font matching algorithm
+ QString found_family(QFontInfo(font).family());
+ this->defaultmap["editor/fontfamily"] = found_family;
this->defaultmap["editor/fontsize"] = 12;
- this->defaultmap["advanced/opencsg_show_warning"] = true;
- this->defaultmap["advanced/enable_opencsg_opengl1x"] = true;
// Toolbar
QActionGroup *group = new QActionGroup(this);
diff --git a/src/func.cc b/src/func.cc
index 1138173..6686cb9 100644
--- a/src/func.cc
+++ b/src/func.cc
@@ -96,24 +96,14 @@ std::string BuiltinFunction::dump(const std::string &indent, const std::string &
return dump.str();
}
-static double deg2rad(double x)
+static inline double deg2rad(double x)
{
- while (x < 0.0)
- x += 360.0;
- while (x >= 360.0)
- x -= 360.0;
- x = x * M_PI * 2.0 / 360.0;
- return x;
+ return x * M_PI / 180.0;
}
-static double rad2deg(double x)
+static inline double rad2deg(double x)
{
- x = x * 360.0 / (M_PI * 2.0);
- while (x < 0.0)
- x += 360.0;
- while (x >= 360.0)
- x -= 360.0;
- return x;
+ return x * 180.0 / M_PI;
}
Value builtin_abs(const Context *, const std::vector<std::string>&, const std::vector<Value> &args)
diff --git a/src/value.cc b/src/value.cc
index 2cc6244..c9440ae 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -369,6 +369,7 @@ std::string Value::toString() const
{
std::stringstream tmp;
tmp.precision(16);
+ tmp.setf(std::ios_base::fixed);
tmp << this->num;
std::string tmpstr = tmp.str();
if (tmpstr.size() > 16) tmpstr.erase(16);
diff --git a/testdata/scad/bugs/minkowski-crash.scad b/testdata/scad/bugs/minkowski-crash.scad
new file mode 100644
index 0000000..46419ba
--- /dev/null
+++ b/testdata/scad/bugs/minkowski-crash.scad
@@ -0,0 +1,26 @@
+/*
+ Originally reported by nop head 20120107:
+ This causes a CGAL assertion in minkowski on some platforms and CGAL versions:
+ o CGAL-3.6, 3.8 Linux
+ o Windows (OpenSCAD-2011.12 binaries)
+
+ The problem is that minkowski leaves the target polyhedron in a corrupt state
+ causing a crash. This is worked around in CGALEvaluator::process().
+
+ CGAL-3.9 appears to just process forever.
+*/
+$fn = 30;
+minkowski() {
+ union() {
+ cube([10, 10, 10], center=true);
+
+ cylinder(r=2, h=15, center=true);
+
+ rotate([90, 0, 0])
+ cylinder(r=2, h=15, center=true);
+
+ rotate([0, 90, 0])
+ cylinder(r=2, h=15, center=true);
+ }
+ sphere(3);
+}
diff --git a/tests/CMingw-cross-env.cmake b/tests/CMingw-cross-env.cmake
index 09ec1d1..7063be4 100644
--- a/tests/CMingw-cross-env.cmake
+++ b/tests/CMingw-cross-env.cmake
@@ -10,7 +10,7 @@
# http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Cross-compiling_for_Windows_on_Linux_or_Mac_OS_X
# - cross-compile openscad.exe, to verify your installation works properly.
# - cd openscad/tests && mkdir build-mingw32 && cd build-mingw32
-# - cmake .. -DCMAKE_TOOLCHAIN_FILE=CMingw-cross-env.cmake \
+# - cmake .. -DCMAKE_TOOLCHAIN_FILE=../CMingw-cross-env.cmake \
# -DMINGW_CROSS_ENV_DIR=<where mingw-cross-env is installed>
# - make should proceed as normal.
# - now run 'ctest' on your *nix machine.
@@ -78,6 +78,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_C_COMPILER ${MINGW_CROSS_ENV_DIR}/usr/bin/i686-pc-mingw32-gcc)
set(CMAKE_CXX_COMPILER ${MINGW_CROSS_ENV_DIR}/usr/bin/i686-pc-mingw32-g++)
+set(CMAKE_RC_COMPILER ${MINGW_CROSS_ENV_DIR}/usr/bin/i686-pc-mingw32-windres)
set(QT_QMAKE_EXECUTABLE ${MINGW_CROSS_ENV_DIR}/usr/bin/i686-pc-mingw32-qmake)
set(PKG_CONFIG_EXECUTABLE ${MINGW_CROSS_ENV_DIR}/usr/bin/i686-pc-mingw32-pkg-config)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
contact: Jan Huwald // Impressum