feat(assembly): fixed reference planes + solver docs
Some checks failed
Build and Test / build (pull_request) Failing after 7m52s

Assembly Origin Planes:
- AssemblyObject::setupObject() relabels origin planes to
  Top (XY), Front (XZ), Right (YZ) on assembly creation
- CommandCreateAssembly.py makes origin planes visible by default
- AssemblyUtils.cpp getObjFromRef() resolves LocalCoordinateSystem
  to child datum elements for joint references to origin planes
- TestAssemblyOriginPlanes.py: 9 integration tests covering
  structure, labels, grounding, reference resolution, solver,
  and save/load round-trip

Solver Documentation:
- docs/src/solver/: 7 new pages covering architecture overview,
  expression DAG, constraints, solving algorithms, diagnostics,
  assembly integration, and writing custom solvers
- docs/src/SUMMARY.md: added Kindred Solver section
This commit is contained in:
forbes
2026-02-21 09:09:16 -06:00
parent 311b3ea4f1
commit acc255972d
15 changed files with 1303 additions and 10 deletions

View File

@@ -30,6 +30,7 @@
#include <App/Application.h>
#include <App/Datums.h>
#include <App/Origin.h>
#include <App/Document.h>
#include <App/DocumentObjectGroup.h>
#include <App/FeaturePythonPyImp.h>
@@ -106,6 +107,24 @@ AssemblyObject::AssemblyObject()
AssemblyObject::~AssemblyObject() = default;
void AssemblyObject::setupObject()
{
App::Part::setupObject();
// Relabel origin planes with assembly-friendly names (SolidWorks convention)
if (auto* origin = getOrigin()) {
if (auto* xy = origin->getXY()) {
xy->Label.setValue("Top");
}
if (auto* xz = origin->getXZ()) {
xz->Label.setValue("Front");
}
if (auto* yz = origin->getYZ()) {
yz->Label.setValue("Right");
}
}
}
PyObject* AssemblyObject::getPyObject()
{
if (PythonObject.is(Py::_None())) {
@@ -144,14 +163,39 @@ void AssemblyObject::onChanged(const App::Property* prop)
// ── Solver integration ─────────────────────────────────────────────
void AssemblyObject::resetSolver()
{
solver_.reset();
}
KCSolve::IKCSolver* AssemblyObject::getOrCreateSolver()
{
if (!solver_) {
solver_ = KCSolve::SolverRegistry::instance().get("ondsel");
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Assembly");
std::string solverName = hGrp->GetASCII("Solver", "");
solver_ = KCSolve::SolverRegistry::instance().get(solverName);
// get("") returns the registry default (first registered solver)
}
return solver_.get();
}
KCSolve::SolveContext AssemblyObject::getSolveContext()
{
partIdToObjs_.clear();
objToPartId_.clear();
auto groundedObjs = getGroundedParts();
if (groundedObjs.empty()) {
return {};
}
std::vector<App::DocumentObject*> joints = getJoints(false);
removeUnconnectedJoints(joints, groundedObjs);
return buildSolveContext(joints);
}
int AssemblyObject::solve(bool enableRedo, bool updateJCS)
{
ensureIdentityPlacements();