feat(solver): Phase 1d — refactor AssemblyObject to use SolverRegistry #295
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Refactor AssemblyObject to call through SolverRegistry/IKCSolver instead of directly using OndselSolver. This is the integration seam — after this, AssemblyObject has zero OndselSolver dependencies.
Parent: #287 (Phase 1)
Depends on: #292 (1a), #293 (1b), #294 (1c)
Blocks: #296 (1e — tests)
Scope
Files modified
src/Mod/Assembly/App/AssemblyObject.h— remove MbD forward decls, replace with IKCSolver*src/Mod/Assembly/App/AssemblyObject.cpp— rewrite solver interaction layersrc/Mod/Assembly/App/CMakeLists.txt— link KCSolve instead of OndselSolver directlysrc/Mod/Assembly/CMakeLists.txt— remove OndselSolver include path (moved into KCSolve)AssemblyObject.h changes
Remove:
Remove from private members:
Remove all MbD-specific methods:
makeMbdAssembly(),makeMbdPart(),makeMbdMarker()makeMbdJoint(),makeMbdJointOfType(),makeMbdJointDistance()handleOneSideOfJoint(),getRackPinionMarkers()getMbDPart(),getMbDData(),getMbdPlacement()MbDPartDatastructAdd:
AssemblyObject.cpp rewrite
solve()— currently 30 lines of MbD setup +runPreDrag()call:preDrag()/doDragStep()/postDrag()— rewritten to use IKCSolver drag protocol:generateSimulation()/updateForFrame()— rewritten for simulation protocol:buildSolveContext() — the new core method
This is where the Distance decomposition happens. The current
makeMbdJointDistance()35-case geometry dispatch moves here:updateSolveStatus() rewrite
Currently introspects
mbdSystem->jointsMotionsDo()to find redundant constraints. Replace with:What stays in AssemblyObject (solver-agnostic)
These methods are NOT solver-specific and remain:
ensureIdentityPlacements()— LinkGroup placement normalizationgetJoints(),getGroundedParts(),fixGroundedParts()— FreeCAD document traversalremoveUnconnectedJoints(),traverseAndMarkConnectedParts()— graph connectivityvalidateNewPlacements()— orientation flip detectionsavePlacementsForUndo(),undoSolve(),clearUndo()— undo systemredrawJointPlacements()— Python callback for joint visualizationexportAsASMT()— needs discussion: currently callsmbdAssembly->outputFile(). Could call through solver or stay Ondsel-specific.getJointsOfPart(),isPartGrounded(),isPartConnected()— part/joint queriesgetDownstreamParts(),getUpstreamMovingPart()— kinematic chain traversalCMakeLists.txt changes
GUI callers — NO CHANGES
All GUI code calls AssemblyObject methods which have the same signatures:
ViewProviderAssembly.cpp:solve(),preDrag(),doDragStep(),postDrag()CommandCreateSimulation.py:generateSimulation(),numberOfFrames(),updateForFrame()CommandExportASMT.py:exportAsASMT()JointObject.py:solve()None of these need modification.
Acceptance criteria
#include <OndselSolver/*>in AssemblyObject.cpp or .hMbD::references in AssemblyObject.cpp or .hbuildSolveContext()correctly decomposes Distance into specific BaseJointKind typesexportAsASMT()still functional (Ondsel-specific path acceptable for now)References
src/Mod/Assembly/App/AssemblyObject.cpp— the file being refactoredsrc/Mod/Assembly/App/AssemblyObject.h— header cleanupsrc/Mod/Assembly/Gui/ViewProviderAssembly.cpp— verify no breakagesrc/Mod/Assembly/JointObject.py— verify no breakage