* add BRepAlgoAPI wrapper files to CMakeList * introduce wrapper for BRepAlgoAPI_BooleanOperation and derivatives, set sensible default Fuzzyness for boolean operations * allow default fuzzyness to be set in settings - including off * backwards compatibility with OCCT 7.3.3 - removed newer paramateres from wrapper * added missing header * reverted src/Mod/Part/App/OpenCascadeAll.h to original state * implement some changes suggested by @wwmayer * removed unneeded destructor definitions * moved getDefaultFuzzyValue into its own helper class * removed unneeded references to base class default constructor * default to SetRunParallel(Standard_True) as suggested by @FlachyJoe * fixed license header as requested * Added new method to autocalculate fuzzyness to BooleanOperation base class and use it for those parts that do not call the obsolete constructor but also do not set precision * implemented static variable solution as suggested by @wwmayer * added helix for test case * Refactoring FCRepAlgoAPI to FCBRepAlgoAPI * Added Test Case (fuse cylinder with helix with different working and non-working Fuzzy values) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * increased default value of FuzzyBoolean and made tests more robust for compatibility with OCCT 7.3 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fixes for FREECAD_USE_PCH - allow testing of FREECAD_USE_PCH on linux with cmake switch (default OFF) * removed surplus line - wasn't needed after all * included precompiled as instructed * set anti-corruption flag in boolean operations, ensures source shape is not damaged in OCCT 7.1 and higher * fix #17085 * disable subtests that were too specific for now * fixed all CLI tests - see comments in Pull Request https://github.com/FreeCAD/FreeCAD/pull/17119#issuecomment-2420772452 * Update src/Mod/PartDesign/PartDesignTests/TestTopologicalNamingProblem.py suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * remove surplus tests from github suggestion interface bug * hide the BooleanFuzzy variable - can now be only set by manually editing the config file i in FCParamGroup "Boolean" <FCFloat Name="BooleanFuzzy" Value="10.000000000000"/> * Suggestion by @FlachyJoe - add validity checks to the base and tool shape in any direct boolean op --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com>
214 lines
6.8 KiB
C++
214 lines
6.8 KiB
C++
/***************************************************************************
|
|
* Copyright (c) 2007 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
|
* *
|
|
* This file is part of the FreeCAD CAx development system. *
|
|
* *
|
|
* This library is free software; you can redistribute it and/or *
|
|
* modify it under the terms of the GNU Library General Public *
|
|
* License as published by the Free Software Foundation; either *
|
|
* version 2 of the License, or (at your option) any later version. *
|
|
* *
|
|
* This library is distributed in the hope that it will be useful, *
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
* GNU Library General Public License for more details. *
|
|
* *
|
|
* You should have received a copy of the GNU Library General Public *
|
|
* License along with this library; see the file COPYING.LIB. If not, *
|
|
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
|
* Suite 330, Boston, MA 02111-1307, USA *
|
|
* *
|
|
***************************************************************************/
|
|
|
|
#include "PreCompiled.h"
|
|
#ifndef _PreComp_
|
|
# include <QButtonGroup>
|
|
# include <QRegularExpression>
|
|
# include <QRegularExpressionValidator>
|
|
# include <QVBoxLayout>
|
|
# include <Interface_Static.hxx>
|
|
#endif
|
|
|
|
#include <Mod/Part/App/Interface.h>
|
|
#include <Mod/Part/App/FuzzyHelper.h>
|
|
#include <Mod/Part/App/IGES/ImportExportSettings.h>
|
|
#include <Mod/Part/App/OCAF/ImportExportSettings.h>
|
|
#include <Mod/Part/App/STEP/ImportExportSettings.h>
|
|
|
|
#include "DlgSettingsGeneral.h"
|
|
#include "ui_DlgSettingsGeneral.h"
|
|
#include "ui_DlgImportExportIges.h"
|
|
#include "DlgExportStep.h"
|
|
#include "DlgImportStep.h"
|
|
|
|
|
|
using namespace PartGui;
|
|
|
|
DlgSettingsGeneral::DlgSettingsGeneral(QWidget* parent)
|
|
: PreferencePage(parent), ui(new Ui_DlgSettingsGeneral)
|
|
{
|
|
ui->setupUi(this);
|
|
}
|
|
|
|
/**
|
|
* Destroys the object and frees any allocated resources
|
|
*/
|
|
DlgSettingsGeneral::~DlgSettingsGeneral() = default;
|
|
|
|
void DlgSettingsGeneral::saveSettings()
|
|
{
|
|
ui->checkBooleanCheck->onSave();
|
|
ui->checkBooleanRefine->onSave();
|
|
ui->checkSketchBaseRefine->onSave();
|
|
ui->checkObjectNaming->onSave();
|
|
ui->checkAllowCompoundBody->onSave();
|
|
}
|
|
|
|
void DlgSettingsGeneral::loadSettings()
|
|
{
|
|
ui->checkBooleanCheck->onRestore();
|
|
ui->checkBooleanRefine->onRestore();
|
|
ui->checkSketchBaseRefine->onRestore();
|
|
ui->checkObjectNaming->onRestore();
|
|
ui->checkAllowCompoundBody->onRestore();
|
|
}
|
|
|
|
/**
|
|
* Sets the strings of the subwidgets using the current language.
|
|
*/
|
|
void DlgSettingsGeneral::changeEvent(QEvent *e)
|
|
{
|
|
if (e->type() == QEvent::LanguageChange) {
|
|
ui->retranslateUi(this);
|
|
}
|
|
else {
|
|
QWidget::changeEvent(e);
|
|
}
|
|
}
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
DlgImportExportIges::DlgImportExportIges(QWidget* parent)
|
|
: PreferencePage(parent), ui(new Ui_DlgImportExportIges)
|
|
{
|
|
ui->setupUi(this);
|
|
ui->lineEditProduct->setReadOnly(true);
|
|
|
|
bg = new QButtonGroup(this);
|
|
bg->addButton(ui->radioButtonBRepOff, 0);
|
|
bg->addButton(ui->radioButtonBRepOn, 1);
|
|
|
|
QRegularExpression rx;
|
|
rx.setPattern(QString::fromLatin1("[\\x00-\\x7F]+"));
|
|
QRegularExpressionValidator* companyValidator = new QRegularExpressionValidator(ui->lineEditCompany);
|
|
companyValidator->setRegularExpression(rx);
|
|
ui->lineEditCompany->setValidator(companyValidator);
|
|
QRegularExpressionValidator* authorValidator = new QRegularExpressionValidator(ui->lineEditAuthor);
|
|
authorValidator->setRegularExpression(rx);
|
|
ui->lineEditAuthor->setValidator(authorValidator);
|
|
}
|
|
|
|
/**
|
|
* Destroys the object and frees any allocated resources
|
|
*/
|
|
DlgImportExportIges::~DlgImportExportIges() = default;
|
|
|
|
void DlgImportExportIges::saveSettings()
|
|
{
|
|
Part::IGES::ImportExportSettings settings;
|
|
|
|
int unit = ui->comboBoxUnits->currentIndex();
|
|
settings.setUnit(static_cast<Part::Interface::Unit>(unit));
|
|
settings.setBRepMode(bg->checkedId() == 1);
|
|
|
|
// Import
|
|
settings.setSkipBlankEntities(ui->checkSkipBlank->isChecked());
|
|
|
|
// header info
|
|
settings.setCompany(ui->lineEditCompany->text().toLatin1());
|
|
settings.setAuthor(ui->lineEditAuthor->text().toLatin1());
|
|
}
|
|
|
|
void DlgImportExportIges::loadSettings()
|
|
{
|
|
Part::IGES::ImportExportSettings settings;
|
|
|
|
ui->comboBoxUnits->setCurrentIndex(static_cast<int>(settings.getUnit()));
|
|
|
|
bool brep = settings.getBRepMode();
|
|
if (brep)
|
|
ui->radioButtonBRepOn->setChecked(true);
|
|
else
|
|
ui->radioButtonBRepOff->setChecked(true);
|
|
|
|
// Import
|
|
ui->checkSkipBlank->setChecked(settings.getSkipBlankEntities());
|
|
|
|
// header info
|
|
ui->lineEditCompany->setText(QString::fromStdString(settings.getCompany()));
|
|
ui->lineEditAuthor->setText(QString::fromStdString(settings.getAuthor()));
|
|
ui->lineEditProduct->setText(QString::fromStdString(settings.getProductName()));
|
|
}
|
|
|
|
/**
|
|
* Sets the strings of the subwidgets using the current language.
|
|
*/
|
|
void DlgImportExportIges::changeEvent(QEvent *e)
|
|
{
|
|
if (e->type() == QEvent::LanguageChange) {
|
|
ui->retranslateUi(this);
|
|
}
|
|
else {
|
|
QWidget::changeEvent(e);
|
|
}
|
|
}
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
DlgImportExportStep::DlgImportExportStep(QWidget* parent)
|
|
: PreferencePage(parent)
|
|
, exportStep(new DlgExportStep(this))
|
|
, importStep(new DlgImportStep(this))
|
|
, headerStep(new DlgExportHeaderStep(this))
|
|
{
|
|
setWindowTitle(QLatin1String("STEP"));
|
|
QVBoxLayout* layout = new QVBoxLayout(this);
|
|
layout->setSpacing(0);
|
|
layout->setContentsMargins(0, 0, 0, 0);
|
|
setLayout(layout);
|
|
|
|
layout->addWidget(exportStep);
|
|
layout->addWidget(importStep);
|
|
layout->addWidget(headerStep);
|
|
|
|
QSpacerItem* verticalSpacer = new QSpacerItem(20, 82, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
|
layout->addItem(verticalSpacer);
|
|
}
|
|
|
|
/**
|
|
* Destroys the object and frees any allocated resources
|
|
*/
|
|
DlgImportExportStep::~DlgImportExportStep() = default;
|
|
|
|
void DlgImportExportStep::saveSettings()
|
|
{
|
|
exportStep->saveSettings();
|
|
importStep->saveSettings();
|
|
headerStep->saveSettings();
|
|
}
|
|
|
|
void DlgImportExportStep::loadSettings()
|
|
{
|
|
exportStep->loadSettings();
|
|
importStep->loadSettings();
|
|
headerStep->loadSettings();
|
|
}
|
|
|
|
void DlgImportExportStep::changeEvent(QEvent *)
|
|
{
|
|
// do nothing
|
|
}
|
|
|
|
|
|
#include "moc_DlgSettingsGeneral.cpp"
|