Fix desktop GUI build for parity reference
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -141,9 +141,6 @@ void GmshWidget::changeEvent(QEvent* e)
|
||||
|
||||
bool GmshWidget::writeProject(QString& inpFile, QString& outFile)
|
||||
{
|
||||
Q_UNUSED(inpFile)
|
||||
Q_UNUSED(outFile)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -249,7 +246,7 @@ void GmshWidget::started()
|
||||
}
|
||||
}
|
||||
|
||||
void GmshWidget::finished(int /*exitCode*/, QProcess::ExitStatus exitStatus)
|
||||
void GmshWidget::finished(int exitCode, QProcess::ExitStatus exitStatus)
|
||||
{
|
||||
d->ui.killButton->setDisabled(true);
|
||||
if (d->label) {
|
||||
@@ -257,7 +254,7 @@ void GmshWidget::finished(int /*exitCode*/, QProcess::ExitStatus exitStatus)
|
||||
}
|
||||
|
||||
d->ui.labelTime->setText(QStringLiteral("%1 %2 ms").arg(tr("Time:")).arg(d->time.elapsed()));
|
||||
if (exitStatus == QProcess::NormalExit) {
|
||||
if (exitStatus == QProcess::NormalExit && exitCode == 0) {
|
||||
loadOutput();
|
||||
}
|
||||
}
|
||||
@@ -309,7 +306,13 @@ RemeshGmsh::RemeshGmsh(Mesh::Feature* mesh, QWidget* parent, Qt::WindowFlags fl)
|
||||
d->geoFile = App::Application::getTempFileName() + "mesh.geo";
|
||||
}
|
||||
|
||||
RemeshGmsh::~RemeshGmsh() = default;
|
||||
RemeshGmsh::~RemeshGmsh()
|
||||
{
|
||||
if (d) {
|
||||
Base::FileInfo(d->stlFile).deleteFile();
|
||||
Base::FileInfo(d->geoFile).deleteFile();
|
||||
}
|
||||
}
|
||||
|
||||
bool RemeshGmsh::writeProject(QString& inpFile, QString& outFile)
|
||||
{
|
||||
@@ -318,6 +321,9 @@ bool RemeshGmsh::writeProject(QString& inpFile, QString& outFile)
|
||||
Base::FileInfo stl(d->stlFile);
|
||||
MeshCore::MeshOutput output(d->copy);
|
||||
Base::ofstream stlOut(stl, std::ios::out | std::ios::binary);
|
||||
if (!stlOut) {
|
||||
return false;
|
||||
}
|
||||
output.SaveBinarySTL(stlOut);
|
||||
stlOut.close();
|
||||
|
||||
@@ -335,6 +341,10 @@ bool RemeshGmsh::writeProject(QString& inpFile, QString& outFile)
|
||||
// Gmsh geo file
|
||||
Base::FileInfo geo(d->geoFile);
|
||||
Base::ofstream geoOut(geo, std::ios::out);
|
||||
if (!geoOut) {
|
||||
stl.deleteFile();
|
||||
return false;
|
||||
}
|
||||
// Examples on how to use Gmsh: https://sfepy.org/doc-devel/preprocessing.html
|
||||
// https://gmsh.info//doc/texinfo/gmsh.html
|
||||
// https://docs.salome-platform.org/latest/gui/GMSHPLUGIN/gmsh_2d_3d_hypo_page.html
|
||||
@@ -390,7 +400,11 @@ bool RemeshGmsh::loadOutput()
|
||||
Mesh::MeshObject kernel;
|
||||
MeshCore::MeshInput input(kernel.getKernel());
|
||||
Base::ifstream stlIn(stl, std::ios::in | std::ios::binary);
|
||||
input.LoadBinarySTL(stlIn);
|
||||
if (!stlIn || !input.LoadBinarySTL(stlIn) || kernel.getKernel().CountFacets() == 0) {
|
||||
stl.deleteFile();
|
||||
geo.deleteFile();
|
||||
return false;
|
||||
}
|
||||
stlIn.close();
|
||||
kernel.harmonizeNormals();
|
||||
|
||||
@@ -398,6 +412,7 @@ bool RemeshGmsh::loadOutput()
|
||||
App::Document* doc = fea->getDocument();
|
||||
doc->openTransaction("Remesh");
|
||||
fea->Mesh.setValue(kernel.getKernel());
|
||||
fea->touch();
|
||||
doc->commitTransaction();
|
||||
stl.deleteFile();
|
||||
geo.deleteFile();
|
||||
|
||||
Reference in New Issue
Block a user