Assembly: Solve on recompute. Fixes #12983

This commit is contained in:
PaddleStroke
2024-03-22 09:58:50 +01:00
committed by Yorik van Havre
parent 670b945347
commit b35e4adc13
2 changed files with 15 additions and 0 deletions

View File

@@ -101,6 +101,17 @@ PyObject* AssemblyObject::getPyObject()
return Py::new_reference_to(PythonObject);
}
App::DocumentObjectExecReturn* AssemblyObject::execute()
{
App::DocumentObjectExecReturn* ret = App::Part::execute();
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Assembly");
if (hGrp->GetBool("SolveOnRecompute", true)) {
solve();
}
return ret;
}
int AssemblyObject::solve(bool enableRedo)
{
@@ -299,6 +310,7 @@ void AssemblyObject::setNewPlacements()
Base::Placement newPlacement = Base::Placement(pos, rot);
propPlacement->setValue(newPlacement);
obj->purgeTouched();
}
}
@@ -316,6 +328,7 @@ void AssemblyObject::redrawJointPlacements(std::vector<App::DocumentObject*> joi
if (propPlacement) {
propPlacement->setValue(propPlacement->getValue());
}
joint->purgeTouched();
}
}

View File

@@ -133,6 +133,8 @@ public:
return "AssemblyGui::ViewProviderAssembly";
}
App::DocumentObjectExecReturn* execute() override;
/* Solve the assembly. It will update first the joints, solve, update placements of the parts
and redraw the joints Args : enableRedo : This store initial positions to enable undo while
being in an active transaction (joint creation).*/