PD: Add onlyHaveRefined() to FeatureRefine
This commit is contained in:
@@ -104,11 +104,7 @@ short Chamfer::mustExecute() const
|
||||
|
||||
App::DocumentObjectExecReturn *Chamfer::execute()
|
||||
{
|
||||
if (onlyHasToRefine()){
|
||||
TopoShape result = refineShapeIfActive(rawShape);
|
||||
Shape.setValue(result);
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
if (onlyHaveRefined()) { return App::DocumentObject::StdReturn; }
|
||||
|
||||
// NOTE: Normally the Base property and the BaseFeature property should point to the same object.
|
||||
// The only difference is that the Base property also stores the edges that are to be chamfered
|
||||
|
||||
@@ -468,11 +468,8 @@ void FeatureExtrude::setupObject()
|
||||
|
||||
App::DocumentObjectExecReturn* FeatureExtrude::buildExtrusion(ExtrudeOptions options)
|
||||
{
|
||||
if (onlyHasToRefine()){
|
||||
TopoShape result = refineShapeIfActive(rawShape);
|
||||
Shape.setValue(result);
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
if (onlyHaveRefined()) { return App::DocumentObject::StdReturn; }
|
||||
|
||||
|
||||
bool makeface = options.testFlag(ExtrudeOption::MakeFace);
|
||||
bool fuse = options.testFlag(ExtrudeOption::MakeFuse);
|
||||
|
||||
@@ -65,11 +65,8 @@ short Fillet::mustExecute() const
|
||||
|
||||
App::DocumentObjectExecReturn *Fillet::execute()
|
||||
{
|
||||
if (onlyHasToRefine()){
|
||||
TopoShape result = refineShapeIfActive(rawShape);
|
||||
Shape.setValue(result);
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
if (onlyHaveRefined()) { return App::DocumentObject::StdReturn; }
|
||||
|
||||
|
||||
Part::TopoShape baseShape;
|
||||
try {
|
||||
|
||||
@@ -81,11 +81,7 @@ short Groove::mustExecute() const
|
||||
|
||||
App::DocumentObjectExecReturn *Groove::execute()
|
||||
{
|
||||
if (onlyHasToRefine()){
|
||||
TopoShape result = refineShapeIfActive(rawShape);
|
||||
Shape.setValue(result);
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
if (onlyHaveRefined()) { return App::DocumentObject::StdReturn; }
|
||||
|
||||
// Validate parameters
|
||||
double angle = Angle.getValue();
|
||||
|
||||
@@ -126,12 +126,7 @@ short Helix::mustExecute() const
|
||||
|
||||
App::DocumentObjectExecReturn* Helix::execute()
|
||||
{
|
||||
|
||||
if (onlyHasToRefine()){
|
||||
TopoShape result = refineShapeIfActive(rawShape, RefineErrorPolicy::Warn);
|
||||
Shape.setValue(result);
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
if (onlyHaveRefined()) { return App::DocumentObject::StdReturn; }
|
||||
|
||||
// Validate and normalize parameters
|
||||
HelixMode mode = static_cast<HelixMode>(Mode.getValue());
|
||||
|
||||
@@ -112,11 +112,7 @@ Loft::getSectionShape(const char *name,
|
||||
|
||||
App::DocumentObjectExecReturn *Loft::execute()
|
||||
{
|
||||
if (onlyHasToRefine()){
|
||||
TopoShape result = refineShapeIfActive(rawShape);
|
||||
Shape.setValue(result);
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
if (onlyHaveRefined()) { return App::DocumentObject::StdReturn; }
|
||||
|
||||
std::vector<TopoShape> wires;
|
||||
try {
|
||||
|
||||
@@ -104,11 +104,7 @@ short Pipe::mustExecute() const
|
||||
|
||||
App::DocumentObjectExecReturn *Pipe::execute()
|
||||
{
|
||||
if (onlyHasToRefine()){
|
||||
TopoShape result = refineShapeIfActive(rawShape);
|
||||
Shape.setValue(result);
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
if (onlyHaveRefined()) { return App::DocumentObject::StdReturn; }
|
||||
|
||||
auto getSectionShape = [](App::DocumentObject* feature,
|
||||
const std::vector<std::string>& subs) -> TopoDS_Shape {
|
||||
|
||||
@@ -68,11 +68,7 @@ FeaturePrimitive::FeaturePrimitive()
|
||||
|
||||
App::DocumentObjectExecReturn* FeaturePrimitive::execute(const TopoDS_Shape& primitive)
|
||||
{
|
||||
if (onlyHasToRefine()){
|
||||
TopoShape result = refineShapeIfActive(rawShape);
|
||||
Shape.setValue(result);
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
if (onlyHaveRefined()) { return App::DocumentObject::StdReturn; }
|
||||
|
||||
try {
|
||||
//transform the primitive in the correct coordinance
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2024<bgbsww@gmail.com> *
|
||||
* *
|
||||
* 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 *
|
||||
* *
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Copyright (c) 2024 <bgbsww@gmail.com> *
|
||||
* *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* FreeCAD 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 *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
@@ -70,6 +71,17 @@ bool FeatureRefine::onlyHasToRefine() const
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool FeatureRefine::onlyHaveRefined()
|
||||
{
|
||||
if (onlyHasToRefine()){
|
||||
TopoShape result = refineShapeIfActive(rawShape);
|
||||
Shape.setValue(result);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
TopoShape FeatureRefine::refineShapeIfActive(const TopoShape& oldShape, const RefineErrorPolicy onError) const
|
||||
{
|
||||
if (this->Refine.getValue()) {
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2024 <bgbsww@gmail.com> *
|
||||
* *
|
||||
* 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 *
|
||||
* *
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Copyright (c) 2024 <bgbsww@gmail.com> *
|
||||
* *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* FreeCAD 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 *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
@@ -50,6 +51,7 @@ protected:
|
||||
TopoShape rawShape;
|
||||
|
||||
bool onlyHasToRefine() const;
|
||||
bool onlyHaveRefined();
|
||||
TopoShape refineShapeIfActive(const TopoShape& oldShape, const RefineErrorPolicy onError = RefineErrorPolicy::Raise) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -80,11 +80,8 @@ short Revolution::mustExecute() const
|
||||
|
||||
App::DocumentObjectExecReturn* Revolution::execute()
|
||||
{
|
||||
if (onlyHasToRefine()){
|
||||
TopoShape result = refineShapeIfActive(rawShape);
|
||||
Shape.setValue(result);
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
if (onlyHaveRefined()) { return App::DocumentObject::StdReturn; }
|
||||
|
||||
|
||||
// Validate parameters
|
||||
// All angles are in radians unless explicitly stated
|
||||
|
||||
@@ -65,11 +65,7 @@ int16_t Thickness::mustExecute() const {
|
||||
}
|
||||
|
||||
App::DocumentObjectExecReturn *Thickness::execute() {
|
||||
if (onlyHasToRefine()){
|
||||
TopoShape result = refineShapeIfActive(rawShape);
|
||||
Shape.setValue(result);
|
||||
return App::DocumentObject::StdReturn;
|
||||
}
|
||||
if (onlyHaveRefined()) { return App::DocumentObject::StdReturn; }
|
||||
|
||||
// Base shape
|
||||
Part::TopoShape TopShape;
|
||||
|
||||
Reference in New Issue
Block a user