Skip to content

Improve Assembly collision simulation responsiveness - #164

Merged
10-X-eng merged 1 commit into
mainfrom
bugfix/issue-163-assembly-simulation-progress
Sep 3, 2026
Merged

Improve Assembly collision simulation responsiveness#164
10-X-eng merged 1 commit into
mainfrom
bugfix/issue-163-assembly-simulation-progress

Conversation

@10-X-eng

@10-X-eng 10-X-eng commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Closes #163.

User-visible outcome

  • Runs dynamic collision checks across independent solver frames in parallel while preserving deterministic frame ordering and authenticated collision evidence.
  • Gives each worker its own deep OCCT topology and triangulation copy, preventing unsafe concurrent mutation/read access.
  • Uses at most 75% of logical CPUs and balances concurrency against the cost of cloning the full collision model.
  • Reports collision frame progress, percentage, measured rate, and approximate remaining time through the existing worker progress path and VibeCAD status bar.
  • Adds the optional collision_mode=off Assembly simulation mode for kinematic playback. Existing callers continue to default to full collision analysis.
  • Represents skipped analysis explicitly as not_checked; it can never be reported as collision-free.
  • Uses a positive OCCT proximity tolerance because FreeCAD does not configure OCCT proximity when passed zero.

Performance evidence

Production-sized Windows workload: 27 components and 141 solver-output frames.

  • Previous serial collision phase: 232.469 s
  • New 12-worker collision phase: 35.516 s
  • Collision speedup: approximately 6.5x
  • Serial and parallel collision frame records were byte-for-byte equivalent after deterministic ordering.
  • Trace digest: 731f02277ea814d31f3a59777c8e6d4f5ae37d558dd97468df9ff8b510846f48

The complete clean portable Windows build was launched, exercised by the owner, and confirmed to fix the reported behavior.

Red/green TDD

The new tests were added first and failed on the absent frame-worker API, collision policy, progress metrics, skipped-analysis contract, and status rendering. After implementation:

$env:PYTHONPATH='C:\Users\robit\vibecad-issue-163\src\Mod\VibeCAD;C:\Users\robit\vibecad-issue-163\package\rattler-build\.pixi\envs\default\Lib\site-packages'
C:\Users\robit\vibecad\build\pr-test-venv\Scripts\python.exe -m pytest -q src/Mod/VibeCAD/vibecad_tests/test_mechanism_geometry_parallelism.py src/Mod/VibeCAD/vibecad_tests/test_mechanism_engine.py src/Mod/VibeCAD/vibecad_tests/test_engine_contracts.py src/Mod/VibeCAD/vibecad_tests/test_modeling_surface_architecture.py src/Mod/VibeCAD/vibecad_tests/test_vibescript_file_io.py

Result: 228 passed in 6.85 s.

Additional verification completed during development:

  • Mechanism/geometry focused suite: 28 passed.
  • Engine/file-I/O focused suite: 44 passed.
  • Modeling architecture suite: 156 passed.
  • Provider subprocess suite: 51 passed, 1 skipped.
  • Full Python suite: 4,354 passed, 9 skipped; the initial isolated-worktree run had one missing-Fasteners-license failure caused solely by the submodule not being initialized. After initializing the pinned Fasteners submodule, its packaging contract passed 6/6.
  • Native FreeCAD integration exercised actual overlapping solids, imported STEP geometry, strict containment, deep-copy non-partnership, and both full/off isolated Assembly workers.
  • py_compile passed for every modified runtime and test module.
  • git diff --check passed.

Clean Windows package verification

pixi install -e default --frozen
pixi install -e package --frozen
$env:BUILD_TAG='v26.3.1-RC6-build1'
$env:MAKE_INSTALLER='false'
$env:MAKE_PORTABLE_ARCHIVE='true'
pixi run -e package create_bundle

Result: complete Rattler native compile, portable-bundle startup/dependency smoke tests, provider subprocess smoke, Codex app-server smoke, geometry worker smoke, McMaster WebView2 smoke, and windowless-provider smoke all passed.

Portable archive SHA-256: 1eec8503bb9ae345aadb4d80c68d68b360960a549dc2d1d13102499ac569a032.

Compatibility

  • Existing public functions/APIs remain present and behaviorally compatible.
  • No preference keys, tool names, or schema fields were renamed or removed.
  • Existing simulations still perform full collision analysis by default.
  • New arguments and progress fields are additive and optional.
  • Skipped collision analysis is explicitly non-authoritative.
  • No breaking changes.

Risk and containment

Frame-parallel collision checking increases temporary memory use because safety requires one deep shape/mesh copy per worker. Worker selection is bounded by frame count, 75% of logical CPUs, and the square root of frame count to balance setup cost and throughput. Pair-level parallelism is disabled inside frame workers to avoid nested oversubscription.

@10-X-eng
10-X-eng enabled auto-merge September 3, 2026 23:56
@10-X-eng
10-X-eng merged commit b75942c into main Sep 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show Assembly simulation progress and make exhaustive collision analysis configurable

1 participant