From 367dcbcb506b5bc5d7131894c69ec255aaf325e6 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Sun, 5 Jun 2011 20:05:55 +0200 Subject: Added Export as Image diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 11ceb98..3ab6e49 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -1,8 +1,9 @@ OpenSCAD 2011.06 ================ -Bugfix release: +o Added "Export as Image" menu. +Bugfixes: o Cylinder tesselation broke existing models which are using cylinders for e.g. captured nut slots and are dependent on the orientation not changing. @@ -10,6 +11,8 @@ o DXF output couldn't be imported into e.g. AutoCAD and Solidworks after updatin to using the AutoCAD 2000 (AC1015) format. Reverted to the old entity-only output, causing LWPOLYLINES to not exported allowed anmore. + + OpenSCAD 2011.04 ================ diff --git a/src/MainWindow.h b/src/MainWindow.h index c0a9844..23daf44 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -109,6 +109,7 @@ private slots: void actionExportSTL(); void actionExportOFF(); void actionExportDXF(); + void actionExportImage(); void actionFlushCaches(); public: diff --git a/src/MainWindow.ui b/src/MainWindow.ui index f61d240..6548c8e 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -112,7 +112,7 @@ 0 0 681 - 25 + 22 @@ -178,6 +178,7 @@ + @@ -651,6 +652,11 @@ Automatic Reload and Compile + + + Export as Image... + + diff --git a/src/mainwin.cc b/src/mainwin.cc index e217b1f..6ea98be 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -259,6 +259,7 @@ MainWindow::MainWindow(const QString &filename) connect(this->designActionExportSTL, SIGNAL(triggered()), this, SLOT(actionExportSTL())); connect(this->designActionExportOFF, SIGNAL(triggered()), this, SLOT(actionExportOFF())); connect(this->designActionExportDXF, SIGNAL(triggered()), this, SLOT(actionExportDXF())); + connect(this->designActionExportImage, SIGNAL(triggered()), this, SLOT(actionExportImage())); connect(this->designActionFlushCaches, SIGNAL(triggered()), this, SLOT(actionFlushCaches())); // View menu @@ -1342,6 +1343,24 @@ void MainWindow::actionExportDXF() #endif /* ENABLE_CGAL */ } +void MainWindow::actionExportImage() +{ + QImage img = screen->grabFrameBuffer(); + setCurrentOutput(); + + QString img_filename = QFileDialog::getSaveFileName(this, + "Export Image", "", "PNG Files (*.png)"); + if (img_filename.isEmpty()) { + PRINTF("No filename specified. Image export aborted."); + clearCurrentOutput(); + return; + } + + img.save(img_filename, "PNG"); + + clearCurrentOutput(); +} + void MainWindow::actionFlushCaches() { PolySet::ps_cache.clear(); -- cgit v0.10.1