Commit Graph

757 Commits

Author SHA1 Message Date
0f8fa0be86 Merge pull request 'feat(assembly): fixed reference planes (Top/Front/Right) + solver docs' (#307) from feat/assembly-origin-planes into main
Some checks failed
Deploy Docs / build-and-deploy (push) Successful in 51s
Build and Test / build (push) Has been cancelled
Reviewed-on: #307
2026-02-21 15:09:55 +00:00
forbes
acc255972d 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
2026-02-21 09:09:16 -06:00
forbes
6e7d2b582e fix(assembly): move resetSolver() out-of-line to fix incomplete type error
Some checks failed
Build and Test / build (pull_request) Has been cancelled
unique_ptr::reset() requires the complete type for its deleter, but
IKCSolver is only forward-declared in AssemblyObject.h. Move the
definition to AssemblyObject.cpp where the full header is included.
2026-02-21 07:08:59 -06:00
forbes
72e7e32133 feat(solver): KCSolve solver addon with assembly integration (#289)
Some checks failed
Build and Test / build (pull_request) Has been cancelled
Adds the Kindred constraint solver as a pluggable Assembly workbench
backend, covering phases 3d through 5 of the solver roadmap.

Phase 3d: SolveContext packing
- Pack/unpack SolveContext into .kc archive on document save

Solver addon (mods/solver):
- Phase 1: Expression DAG, Newton-Raphson + BFGS, 3 basic constraints
- Phase 2: Full constraint vocabulary — all 24 BaseJointKind types
- Phase 3: Graph decomposition for cluster-by-cluster solving
- Phase 4: Per-entity DOF diagnostics, overconstrained detection,
  half-space preference tracking, minimum-movement weighting
- Phase 5: _build_system extraction, diagnose(), drag protocol,
  joint limits warning

Assembly workbench integration:
- Preference-driven solver selection (reads Mod/Assembly/Solver param)
- Solver backend combo box in Assembly preferences UI
- resetSolver() on AssemblyObject for live preference switching
- Integration tests (TestKindredSolverIntegration.py)
- In-client console test script (console_test_phase5.py)
2026-02-20 23:47:50 -06:00
forbes
7e766a228e feat(kcsolve): add to_dict()/from_dict() JSON serialization for all types
All checks were successful
Build and Test / build (pull_request) Successful in 31m19s
Phase 3a of the solver server integration: add dict/JSON serialization
to all KCSolve pybind11 types so SolveContext and SolveResult can be
transported as JSON between the Create client, Silo server, and solver
runners.

Implementation:
- Constexpr enum string mapping tables for all 5 enums (BaseJointKind,
  SolveStatus, DiagnosticKind, MotionKind, LimitKind) with template
  bidirectional lookup helpers
- File-local to_dict/from_dict conversion functions for all 10 types
  (Transform, Part, Constraint::Limit, Constraint, MotionDef,
  SimulationParams, SolveContext, ConstraintDiagnostic,
  SolveResult::PartResult, SolveResult)
- .def("to_dict") and .def_static("from_dict") on every py::class_<>
  binding chain

Serialization details per SOLVER.md §3:
- SolveContext.to_dict() includes api_version field
- SolveContext.from_dict() validates api_version, raises ValueError on
  mismatch
- Enums serialize as strings matching pybind11 .value() names
- Transform: {position: [x,y,z], quaternion: [w,x,y,z]}
- Optional simulation serializes as None/null
- Pure pybind11 py::dict construction, no new dependencies

Tests: 16 new tests in TestKCSolveSerialization covering round-trips for
all types, all 24 BaseJointKind values, all 4 SolveStatus values,
json.dumps/loads stdlib round-trip, and error cases (missing key,
invalid enum, bad array length, wrong api_version).
2026-02-20 11:58:18 -06:00
forbes
7ea0078ba3 feat(kcsolve): pybind11 bindings and Python solver support
All checks were successful
Build and Test / build (pull_request) Successful in 29m19s
Add the kcsolve pybind11 module exposing the KCSolve C++ API to Python:

- PyIKCSolver trampoline enabling Python IKCSolver subclasses
- Bindings for all 5 enums, 10 structs, IKCSolver, and OndselAdapter
- Module functions wrapping SolverRegistry (available, load, joints_for,
  set_default, get_default, register_solver)
- PySolverHolder class forwarding virtual calls with GIL acquisition
- register_solver() for runtime Python solver registration

IKCSolver constructor moved from protected to public for pybind11
trampoline access (class remains abstract via 3 pure virtuals).

Includes 16 Python tests covering module import, type bindings, enum
values, registry functions, Python solver subclassing, and full
register/load/solve round-trip.

Closes #288
2026-02-19 18:04:49 -06:00
forbes
934cdf5767 test(assembly): regression tests for KCSolve solver refactor (#296)
All checks were successful
Build and Test / build (pull_request) Successful in 29m11s
Phase 1e: Add C++ gtest and Python unittest coverage for the pluggable
solver system introduced in Phases 1a-1d.

C++ tests (KCSolve_tests_run):
- SolverRegistryTest (8 tests): register/get, duplicates, defaults,
  available list, joints_for capability queries
- OndselAdapterTest (10 tests): identity checks, supported/unsupported
  joints, Fixed/Revolute solve round-trips, no-grounded-parts handling,
  exception safety, drag protocol (pre_drag/drag_step/post_drag),
  redundant constraint diagnostics

Python tests (TestSolverIntegration):
- Full-stack solve via AssemblyObject → IKCSolver → OndselAdapter
- Fixed joint placement matching, revolute joint success
- No-ground error code (-6), redundancy detection (-2)
- ASMT export produces non-empty file
- Deterministic solve stability (solve twice → same result)
2026-02-19 16:56:11 -06:00
forbes
5c33aacecb feat(solver): refactor AssemblyObject to use IKCSolver interface (#295)
Rewire AssemblyObject to call through KCSolve::IKCSolver instead of
directly manipulating OndselSolver ASMT types.

Key changes:
- Remove all 30+ #include <OndselSolver/*> from AssemblyObject.cpp
- Remove MbDPartData, objectPartMap, mbdAssembly members
- Add solver_ (IKCSolver), lastResult_ (SolveResult), partIdToObjs_ maps
- New buildSolveContext() builds SolveContext from FreeCAD document objects
  with JointType/DistanceType -> BaseJointKind decomposition
- New computeMarkerTransform() replaces handleOneSideOfJoint()
- New computeRackPinionMarkers() replaces getRackPinionMarkers()
- Rewrite solve/preDrag/doDragStep/postDrag/generateSimulation to call
  through IKCSolver interface
- Rewrite setNewPlacements/validateNewPlacements to use SolveResult
- Rewrite updateSolveStatus to use ConstraintDiagnostic
- Add export_native() to IKCSolver for ASMT export support
- Register OndselAdapter at Assembly module init in AppAssembly.cpp
- Remove OndselSolver from Assembly_LIBS (linked transitively via KCSolve)

Assembly module now has zero OndselSolver includes. All solver coupling
is confined to KCSolve/OndselAdapter.cpp.
2026-02-19 16:43:52 -06:00
forbes
32dbe20ce0 feat(solver): implement OndselAdapter wrapping OndselSolver behind IKCSolver (#294)
Phase 1c of the pluggable solver system. Creates OndselAdapter — the
concrete IKCSolver implementation that wraps OndselSolver's Lagrangian
MBD engine behind the KCSolve abstraction layer.

The adapter translates KCSolve types (SolveContext, BaseJointKind,
Transform) to OndselSolver's ASMT hierarchy (ASMTAssembly, ASMTPart,
ASMTJoint, ASMTMarker) and extracts results back into SolveResult.
All 30+ OndselSolver #includes are confined to OndselAdapter.cpp.

Key implementation details:
- build_assembly(): creates ASMTAssembly from SolveContext
- create_joint(): maps 20 BaseJointKind values to ASMT joint types
  (eliminates the 35-case DistanceType switch — decomposition done upstream)
- Quaternion-to-rotation-matrix conversion for OndselSolver input
- Direct quaternion extraction for output (both use w,x,y,z convention)
- Drag lifecycle: pre_drag/drag_step/post_drag with stateful assembly
- Simulation lifecycle: run_kinematic/num_frames/update_for_frame
- Diagnostic extraction: iterates MBD system constraints for redundancy
- Static register_solver() for SolverRegistry integration
- ExternalSystem back-pointer NOT set — breaks bidirectional coupling

New files:
- Solver/OndselAdapter.h — class declaration with KCSolveExport
- Solver/OndselAdapter.cpp — full implementation (~530 lines)

Modified:
- Solver/CMakeLists.txt — add sources, link OndselSolver (PRIVATE)
2026-02-19 16:19:44 -06:00
forbes
76b91c6597 feat(solver): implement SolverRegistry with plugin loading (#293)
Phase 1b of the pluggable solver system. Converts KCSolve from a
header-only INTERFACE target to a SHARED library and implements
the SolverRegistry with dynamic plugin discovery.

Changes:
- Add KCSolveGlobal.h export macro header (KCSolveExport)
- Move SolverRegistry method bodies from header to SolverRegistry.cpp
- Implement scan() with dlopen/LoadLibrary plugin loading
- Add scan_default_paths() for KCSOLVE_PLUGIN_PATH + system paths
- Plugin entry points: kcsolve_api_version() + kcsolve_create()
- API version checking (major version compatibility)
- Convert CMakeLists.txt from INTERFACE to SHARED library
- Link FreeCADBase (PRIVATE) for Console logging
- Link dl on POSIX for dynamic loading
- Fix -Wmissing-field-initializers warnings in IKCSolver.h defaults

The registry discovers plugins by scanning directories for shared
libraries that export the kcsolve C entry points. Plugins are
validated for API version compatibility before registration.
Manual registration via register_solver() remains available for
built-in solvers (e.g. OndselAdapter in Phase 1c).
2026-02-19 16:07:37 -06:00
forbes
47e6c14461 feat(solver): define IKCSolver C++ API types and interface (#292)
Add the pluggable solver API as header-only files under
src/Mod/Assembly/Solver/. This is Phase 1a of the pluggable solver
system (INTER_SOLVER.md).

New files:
- Types.h: BaseJointKind enum (24 decomposed constraint types),
  Transform, Part, Constraint, SolveContext, SolveResult, and
  supporting types. Uses standalone types (no FreeCAD dependency)
  for future server worker compatibility.
- IKCSolver.h: Abstract solver interface with solve(), drag protocol
  (pre_drag/drag_step/post_drag), kinematic simulation
  (run_kinematic/num_frames/update_for_frame), and diagnostics.
  Only solve(), name(), and supported_joints() are pure virtual;
  all other methods have default implementations.
- SolverRegistry.h: Thread-safe singleton registry for solver
  backends with factory-based registration and default solver
  selection.
- CMakeLists.txt: INTERFACE library target (header-only for now).

Modified:
- Assembly/CMakeLists.txt: add_subdirectory(Solver)
- Assembly/App/CMakeLists.txt: link KCSolve INTERFACE target
2026-02-19 15:55:57 -06:00
forbes
2fa1672edf fix(assembly): guard onChanged against solver during document restore
Some checks failed
Build and Test / build (pull_request) Has been cancelled
During document restore, PropertyLinkList::Restore sets the Group property
on AssemblyObject, triggering onChanged → updateSolveStatus → solve →
validateNewPlacements. At this point joints reference objects that haven't
been restored yet, causing a null pointer dereference (SIGSEGV).

Add an isRestoring() guard to skip solver invocation during restore,
matching the existing pattern in AssemblyLink::onChanged().
2026-02-15 18:45:00 -06:00
forbes
4a54e9b7cd feat(silo): update silo submodule — DAG API methods (#215)
Some checks failed
Build and Test / build (pull_request) Has been cancelled
Adds push_dag() and get_dag() to SiloClient:
- push_dag: PUT /api/items/{pn}/dag with nodes + edges
- get_dag: GET /api/items/{pn}/dag with optional revision filter

Closes #215
2026-02-14 15:09:08 -06:00
forbes
8f02c0d6f2 fix: Insert Component uses Silo browser when available
All checks were successful
Build and Test / build (pull_request) Successful in 40m7s
When the silo workbench is loaded, Insert Component now opens the
Silo part browser (OpenItemWidget) instead of the OS file dialog.
Users can search both the Silo database and local files to find
components to insert.

Falls back to the OS file dialog if silo-mod is not installed.
Also adds .kc file support to the fallback file dialog filter.

Closes #202
2026-02-14 15:03:13 -06:00
forbes
54f8006e24 cherry-pick #32: MDI pre-document tab for Silo new item (70118201b0) 2026-02-13 14:09:44 -06:00
forbes
9be9f9420a cherry-pick #1: initial Kindred branding + assembly joint fix
Cherry-picked 316d4f4b52 with conflict resolution:
- CMakeLists.txt: merged Kindred version vars with upstream 1.2.0-dev base
- src/Main/*.cpp: applied Kindred branding (banner, copyright, license)
- Resolved add/add conflicts for files already copied in Phase 1
- Includes assembly joint flip overconstrain fix
2026-02-13 14:05:31 -06:00
PaddleStroke
6abb2b447f Assembly: Isolate grounded objects on selection (#24952)
* Assembly: Isolate grounded objects on selection

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update ViewProviderAssembly.cpp

* Update ViewProviderAssembly.cpp

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2026-02-12 09:43:46 +01:00
PaddleStroke
3d0df45cd4 Assembly: BOM: take mirrored state of links in account. (#26113) 2026-02-10 09:10:03 -06:00
freecad-gh-actions-translation-bot
e5d0e5316d Update translations from Crowdin 2026-02-09 05:39:43 +01:00
TomPcz
b441a3b6c1 Assembly: Fix help text height in CreateBom 2026-02-07 18:38:37 +01:00
PaddleStroke
a3486b4dd2 Assembly: Insert flexible assembly grounds the correct part (#27206)
* Assembly: Insert flexible assembly grounds the correct part

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Assembly: Migrate ObjectToGround to PropertyLinkGlobal to support assembly links

* Update JointObject.py

* Assembly: ViewProviderAssembly fix assembly link deletion issue

* Assembly: ViewProviderAssembly: make sure no duplicates in canDelete

* Assembly CommandInsertLink fix typo

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-02-02 17:43:45 +01:00
PaddleStroke
212e4f07af Assembly: Fix isolate not working on sub assembly components 2026-02-02 17:41:41 +01:00
freecad-gh-actions-translation-bot
0b7da82433 Update translations from Crowdin 2026-02-02 11:49:57 +01:00
PaddleStroke
964e7387e3 Assembly: Explode temporarily (#25456) 2026-01-31 15:57:22 +01:00
PaddleStroke
fb4721bcb2 Assembly: Remove solver msg when file is closed (#27210) 2026-01-31 15:19:36 +01:00
PaddleStroke
caff52b1ed Assembly: fix sub assembly joint bug (#27172) 2026-01-26 19:23:07 +01:00
sliptonic
533b1be963 Merge pull request #27107 from PaddleStroke/asm_3patches
Assembly: Fix Assembly activation issues.
2026-01-26 10:51:28 -06:00
PaddleStroke
9b6de80231 Update UtilsAssembly.py 2026-01-26 11:35:38 +01:00
freecad-gh-actions-translation-bot
d574623a2e Update translations from Crowdin 2026-01-26 10:11:06 +01:00
PaddleStroke
b4025abab6 Assembly: Change Joint References to remove cyclic dependency. (#25513)
* Assembly: Change Joint References to remove cyclic dependency.

* Update JointObject.py

* Update TestCore.py

* Update JointObject.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update AssemblyUtils.cpp

* Update UtilsAssembly.py

* Update JointObject.py

* small fix for link groups

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-01-26 09:44:59 +01:00
PaddleStroke
9c6ea80757 Update ViewProviderAssembly.cpp 2026-01-23 17:40:01 +01:00
pre-commit-ci[bot]
b87899f4ca [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2026-01-23 15:19:27 +00:00
paddle
62cbaf7336 Assembly: Fix "deactivated by activating a App::Part, assembly stay in edit"
Fix "Activating a body in a part in an assembly deactivates the assembly and activate the part"
Fix "A manually deactivated assembly is still restoring later"
2026-01-23 16:09:43 +01:00
PaddleStroke
abc5f90466 Assembly: prevent assembly collapse when editing sketch. (#26956)
* Gui: View provider: isAutoCollapseOnDeactivation

* Update ViewProvider.h

* Update ActiveObjectList.cpp

* Update ViewProviderAssembly.cpp

* Update ActiveObjectList.cpp
2026-01-23 16:01:06 +01:00
Kacper Donat
3fdf405ce8 Merge pull request #24951 from PaddleStroke/asm_jointhighlight
Assembly: Highlight joint elements on joint selection
2026-01-22 20:16:56 +01:00
PaddleStroke
bb6832897a Assembly: Solver messages (#24623)
* Assembly: Solver messages

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update ViewProviderAssembly.cpp

* Update src/Mod/Assembly/App/AssemblyUtils.cpp

Co-authored-by: Kacper Donat <kadet1090@gmail.com>

* Update src/Mod/Assembly/App/AssemblyUtils.cpp

Co-authored-by: Kacper Donat <kadet1090@gmail.com>

* Update src/Mod/Assembly/App/AssemblyUtils.cpp

Co-authored-by: Kacper Donat <kadet1090@gmail.com>

* Update src/Mod/Assembly/Gui/Commands.cpp

Co-authored-by: Kacper Donat <kadet1090@gmail.com>

* Update ViewProviderAssembly.cpp

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update src/Mod/Assembly/Gui/TaskAssemblyMessages.cpp

Co-authored-by: Kacper Donat <kadet1090@gmail.com>

* Update AssemblyObject.h

* Update AssemblyObject.cpp

* Update Commands.cpp

* Update ViewProviderAssembly.cpp

* Update AssemblyObject.cpp

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Thank you

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kacper Donat <kadet1090@gmail.com>
2026-01-22 15:21:13 +01:00
freecad-gh-actions-translation-bot
10a540b1bf Update translations from Crowdin 2026-01-19 08:10:24 +01:00
PaddleStroke
c5e9e602d1 Assembly: fix crash when measure active 2026-01-18 11:04:46 +01:00
PaddleStroke
4cc0a1b718 Assembly: Fix error on open doc in insert tool 2026-01-13 23:48:50 +01:00
freecad-gh-actions-translation-bot
7ddee25ec9 Update translations from Crowdin 2026-01-11 19:42:50 -06:00
wmayer
b180728b9d Assembly: Improve const correctness 2026-01-09 18:09:48 +01:00
wmayer
70d8187964 Assembly: Minor refactor in ViewProviderAssembly::findDragMode
Co-Developed-by: PaddleStroke <pierrelouis.boyer@gmail.com>
2026-01-09 18:09:48 +01:00
PaddleStroke
5339f415be Assembly: Explode radially: prevent click on item 2026-01-08 20:42:12 -06:00
Kacper Donat
8dffa07978 Merge pull request #19132 from tritao/base-remove-boost-signals
Base: Remove Boost-based signals and switch to `FastSignals`.
2026-01-08 12:41:29 +01:00
PaddleStroke
73a021ca1a Assembly: Ground joint tooltip update (#25852) 2026-01-08 03:52:41 +00:00
tritao
69058376e6 Base: Remove Boost-based signals and switch to FastSignals. 2026-01-07 21:16:16 +00:00
PaddleStroke
dfbdb2005c Update CommandCreateJoint.py 2026-01-05 16:25:50 +01:00
PaddleStroke
ae075c1a73 Assembly: RackPinion tooltip fix 2026-01-05 16:25:50 +01:00
freecad-gh-actions-translation-bot
2592406b35 Update translations from Crowdin 2026-01-05 08:47:20 +01:00
freecad-gh-actions-translation-bot
7fe10f7436 Update translations from Crowdin 2025-12-29 11:31:39 +01:00