diff --git a/src/Mod/Mesh/App/AppMesh.cpp b/src/Mod/Mesh/App/AppMesh.cpp
index 2a1e4f64ca..7a6d759612 100644
--- a/src/Mod/Mesh/App/AppMesh.cpp
+++ b/src/Mod/Mesh/App/AppMesh.cpp
@@ -28,6 +28,7 @@
#include
#include
+#include
#include "Mesh.h"
#include "MeshPy.h"
@@ -57,6 +58,11 @@ PyMOD_INIT_FUNC(Mesh)
// NOTE: To finish the initialization of our own type objects we must
// call PyType_Ready, otherwise we run into a segmentation fault, later on.
// This function is responsible for adding inherited slots from a type's base class.
+ ParameterGrp::handle handle = App::GetApplication().GetParameterGroupByPath
+ ("User parameter:BaseApp/Preferences/Mod/Mesh");
+ ParameterGrp::handle asy = handle->GetGroup("Asymptote");
+ MeshCore::MeshOutput::SetAsymptoteSize(asy->GetASCII("Width", "500"),
+ asy->GetASCII("Height"));
// add mesh elements
Base::Interpreter().addType(&Mesh::MeshPointPy ::Type,meshModule,"MeshPoint");
diff --git a/src/Mod/Mesh/App/Core/MeshIO.cpp b/src/Mod/Mesh/App/Core/MeshIO.cpp
index a1be08e45e..4eb56e0d87 100644
--- a/src/Mod/Mesh/App/Core/MeshIO.cpp
+++ b/src/Mod/Mesh/App/Core/MeshIO.cpp
@@ -1755,6 +1755,15 @@ void MeshOutput::SetSTLHeaderData(const std::string& header)
}
}
+std::string MeshOutput::asyWidth = "500";
+std::string MeshOutput::asyHeight = "500";
+
+void MeshOutput::SetAsymptoteSize(const std::string& w, const std::string& h)
+{
+ asyWidth = w;
+ asyHeight = h;
+}
+
void MeshOutput::Transform(const Base::Matrix4D& mat)
{
_transform = mat;
@@ -2404,7 +2413,12 @@ bool MeshOutput::SaveAsymptote(std::ostream &out) const
out << "import three;\n\n";
- out << "size(500);\n\n";
+ if (!asyWidth.empty()) {
+ out << "size(" << asyWidth;
+ if (!asyHeight.empty())
+ out << ", " << asyHeight;
+ out << ");\n\n";
+ }
Base::BoundBox3f bbox = _rclMesh.GetBoundBox();
Base::Vector3f center = bbox.GetCenter();
diff --git a/src/Mod/Mesh/App/Core/MeshIO.h b/src/Mod/Mesh/App/Core/MeshIO.h
index 8e222fc048..937edf62eb 100644
--- a/src/Mod/Mesh/App/Core/MeshIO.h
+++ b/src/Mod/Mesh/App/Core/MeshIO.h
@@ -166,6 +166,10 @@ public:
* automatically filled up with spaces.
*/
static void SetSTLHeaderData(const std::string&);
+ /**
+ * Change the image size of the asymptote output.
+ */
+ static void SetAsymptoteSize(const std::string&, const std::string&);
/// Determine the mesh format by file extension
static MeshIO::Format GetFormat(const char* FileName);
/// Saves the file, decided by extension if not explicitly given
@@ -228,6 +232,7 @@ protected:
std::string objectName;
std::vector _groups;
static std::string stl_header;
+ static std::string asyWidth, asyHeight;
};
/*!
diff --git a/src/Mod/Mesh/Gui/DlgSettingsImportExport.ui b/src/Mod/Mesh/Gui/DlgSettingsImportExport.ui
index 018fa469f1..d4123b4032 100644
--- a/src/Mod/Mesh/Gui/DlgSettingsImportExport.ui
+++ b/src/Mod/Mesh/Gui/DlgSettingsImportExport.ui
@@ -82,6 +82,54 @@
-
+
+
+ Asymptote
+
+
+
-
+
+
-
+
+
+ Width:
+
+
+
+ -
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 61
+ 20
+
+
+
+
+ -
+
+
+ Height:
+
+
+
+ -
+
+
+
+
+
+
+
+
+ -
Qt::Vertical
diff --git a/src/Mod/Mesh/Gui/DlgSettingsImportExportImp.cpp b/src/Mod/Mesh/Gui/DlgSettingsImportExportImp.cpp
index 74f4c00c96..af042f4ba7 100644
--- a/src/Mod/Mesh/Gui/DlgSettingsImportExportImp.cpp
+++ b/src/Mod/Mesh/Gui/DlgSettingsImportExportImp.cpp
@@ -25,6 +25,7 @@
#include "DlgSettingsImportExportImp.h"
#include "ui_DlgSettingsImportExport.h"
#include
+#include
using namespace MeshGui;
@@ -51,6 +52,13 @@ void DlgSettingsImportExport::saveSettings()
handle->SetFloat("MaxDeviationExport", value);
ui->exportAmfCompressed->onSave();
+
+ ParameterGrp::handle asy = handle->GetGroup("Asymptote");
+ asy->SetASCII("Width", ui->asymptoteWidth->text().toLatin1());
+ asy->SetASCII("Height", ui->asymptoteHeight->text().toLatin1());
+
+ MeshCore::MeshOutput::SetAsymptoteSize(ui->asymptoteWidth->text().toStdString(),
+ ui->asymptoteHeight->text().toStdString());
}
void DlgSettingsImportExport::loadSettings()
@@ -62,6 +70,10 @@ void DlgSettingsImportExport::loadSettings()
ui->maxDeviationExport->setValue(value);
ui->exportAmfCompressed->onRestore();
+
+ ParameterGrp::handle asy = handle->GetGroup("Asymptote");
+ ui->asymptoteWidth->setText(QString::fromStdString(asy->GetASCII("Width")));
+ ui->asymptoteHeight->setText(QString::fromStdString(asy->GetASCII("Height")));
}
/**