Merge branch 'main' into bgbsww-toponamingAddFeatureRefine
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
# include <BRep_Builder.hxx>
|
||||
# include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
# include <BRepBuilderAPI_MakeFace.hxx>
|
||||
# include <BRepBuilderAPI_MakeVertex.hxx>
|
||||
#endif
|
||||
|
||||
#include <unordered_map>
|
||||
@@ -38,7 +39,7 @@
|
||||
#include <App/Document.h>
|
||||
#include <App/GroupExtension.h>
|
||||
#include <App/Link.h>
|
||||
#include <App/OriginFeature.h>
|
||||
#include <App/Datums.h>
|
||||
#include <App/ElementNamingUtils.h>
|
||||
#include <Mod/Part/App/TopoShape.h>
|
||||
|
||||
@@ -48,13 +49,14 @@
|
||||
|
||||
FC_LOG_LEVEL_INIT("PartDesign",true,true)
|
||||
|
||||
#ifndef M_PI
|
||||
# define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
using namespace PartDesign;
|
||||
namespace sp = std::placeholders;
|
||||
|
||||
namespace PartDesign
|
||||
{
|
||||
extern bool getPDRefineModelParameter();
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
PROPERTY_SOURCE(PartDesign::ShapeBinder, Part::Feature)
|
||||
@@ -193,6 +195,10 @@ void ShapeBinder::getFilteredReferences(const App::PropertyLinkSubList* prop,
|
||||
obj = plane;
|
||||
break;
|
||||
}
|
||||
if (auto point = dynamic_cast<App::Point*>(it)) {
|
||||
obj = point;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -243,6 +249,13 @@ Part::TopoShape ShapeBinder::buildShapeFromReferences(App::GeoFeature* obj, std:
|
||||
shape.setPlacement(obj->Placement.getValue());
|
||||
return shape;
|
||||
}
|
||||
else if (obj->isDerivedFrom<App::Point>()) {
|
||||
gp_Pnt point;
|
||||
BRepBuilderAPI_MakeVertex mkPoint(point);
|
||||
Part::TopoShape shape(mkPoint.Shape());
|
||||
shape.setPlacement(obj->Placement.getValue());
|
||||
return shape;
|
||||
}
|
||||
|
||||
return TopoDS_Shape();
|
||||
}
|
||||
@@ -602,21 +615,34 @@ void SubShapeBinder::update(SubShapeBinder::UpdateOption options) {
|
||||
if (!copyerror) {
|
||||
std::vector<App::Property*> props;
|
||||
getPropertyList(props);
|
||||
for (auto prop : props) {
|
||||
if (!App::LinkBaseExtension::isCopyOnChangeProperty(this, *prop))
|
||||
continue;
|
||||
auto p = copied->getPropertyByName(prop->getName());
|
||||
if (p && p->getContainer() == copied
|
||||
&& p->getTypeId() == prop->getTypeId()
|
||||
&& !p->isSame(*prop))
|
||||
{
|
||||
recomputeCopy = true;
|
||||
std::unique_ptr<App::Property> pcopy(prop->Copy());
|
||||
p->Paste(*pcopy);
|
||||
// lambda for copying values of copy-on-change properties
|
||||
const auto copyPropertyValues = [this, &recomputeCopy, &props, copied](const bool to_support) {
|
||||
for (auto prop : props) {
|
||||
if (!App::LinkBaseExtension::isCopyOnChangeProperty(this, *prop))
|
||||
continue;
|
||||
// we only copy read-only and output properties from support to binder
|
||||
if (!to_support && !(prop->testStatus(App::Property::Output) && prop->testStatus(App::Property::ReadOnly)))
|
||||
continue;
|
||||
auto p = copied->getPropertyByName(prop->getName());
|
||||
if (p && p->getContainer() == copied
|
||||
&& p->getTypeId() == prop->getTypeId()
|
||||
&& !p->isSame(*prop))
|
||||
{
|
||||
recomputeCopy = true;
|
||||
auto* const from = to_support ? prop : p;
|
||||
auto* const to = to_support ? p : prop;
|
||||
|
||||
std::unique_ptr<App::Property> pcopy(from->Copy());
|
||||
to->Paste(*pcopy);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
copyPropertyValues(true);
|
||||
if (recomputeCopy && !copied->recomputeFeature(true))
|
||||
copyerror = 2;
|
||||
if (!copyerror)
|
||||
copyPropertyValues(false);
|
||||
}
|
||||
obj = copied;
|
||||
_CopiedLink.setValue(copied, l.getSubValues(false));
|
||||
|
||||
Reference in New Issue
Block a user