Added Export as Image

stl_dim
Marius Kintel 2011-06-05 20:05:55 +02:00
parent c807f9bbd1
commit 367dcbcb50
4 changed files with 31 additions and 2 deletions

View File

@ -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
================

View File

@ -109,6 +109,7 @@ private slots:
void actionExportSTL();
void actionExportOFF();
void actionExportDXF();
void actionExportImage();
void actionFlushCaches();
public:

View File

@ -112,7 +112,7 @@
<x>0</x>
<y>0</y>
<width>681</width>
<height>25</height>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menu_File">
@ -178,6 +178,7 @@
<addaction name="designActionExportSTL"/>
<addaction name="designActionExportOFF"/>
<addaction name="designActionExportDXF"/>
<addaction name="designActionExportImage"/>
<addaction name="designActionFlushCaches"/>
</widget>
<widget class="QMenu" name="menu_View">
@ -651,6 +652,11 @@
<string>Automatic Reload and Compile</string>
</property>
</action>
<action name="designActionExportImage">
<property name="text">
<string>Export as Image...</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@ -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();