Add a TransformMode property to the pattern features

This property controls wether the selected features tool shapes are
transformed or the whole base feature's shape.
This commit is contained in:
André Althaus
2024-03-25 02:07:26 +01:00
parent 4d9b89e265
commit 45bb606095
4 changed files with 120 additions and 80 deletions

View File

@@ -75,23 +75,20 @@ const std::list<gp_Trsf> MultiTransform::getTransformations(const std::vector<Ap
{
std::vector<App::DocumentObject*> transFeatures = Transformations.getValues();
// Find centre of gravity of first original
// FIXME: This method will NOT give the expected result for more than one original!
Part::Feature* originalFeature = static_cast<Part::Feature*>(originals.front());
TopoDS_Shape original;
gp_Pnt cog;
if (!originals.empty()) {
// Find centre of gravity of first original
// FIXME: This method will NOT give the expected result for more than one original!
if (auto addFeature =
Base::freecad_dynamic_cast<PartDesign::FeatureAddSub>(originals.front())) {
TopoDS_Shape original = addFeature->AddSubShape.getShape().getShape();
if (originalFeature->isDerivedFrom<PartDesign::FeatureAddSub>()) {
PartDesign::FeatureAddSub* addFeature = static_cast<PartDesign::FeatureAddSub*>(originalFeature);
//if (addFeature->getAddSubType() == FeatureAddSub::Additive)
// original = addFeature->AddSubShape.getShape().getShape();
//else
original = addFeature->AddSubShape.getShape().getShape();
GProp_GProps props;
BRepGProp::VolumeProperties(original, props);
cog = props.CentreOfMass();
}
}
GProp_GProps props;
BRepGProp::VolumeProperties(original,props);
gp_Pnt cog = props.CentreOfMass();
std::list<gp_Trsf> result;
std::list<gp_Pnt> cogs;
std::vector<App::DocumentObject*>::const_iterator f;