Skip to content

Modelled threads: standard sizes, external and internal, with depth and runout - #285

Merged
andrewbartels1 merged 8 commits into
mainfrom
feat/modelled-threads
Nov 30, 2026
Merged

andrewbartels1 merged 8 commits into
mainfrom
feat/modelled-threads

Conversation

@andrewbartels1

@andrewbartels1 andrewbartels1 commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

Modelled threads (queue item 43). Two new tools, both in beta.

list_thread_sizes (metric or inch)

  • Lists the sizes SolidWorks' own thread profiles hold, read from the installed SolidWorks: 69 metric sizes from M1.2 to M64, and 63 inch sizes from #0 to 4 in.
  • Each size has:
    • its diameter and pitch (and threads per inch for inch);
    • coarse or fine. Metric coarse pitches come from the Hole Wizard library's plain M6-style rows; elsewhere the size list decides;
    • the ISO 68-1 basic depth;
    • the ISO 3508 runout: normal 2.5P, short 1.25P. For inch, the same rule on 1/TPI, labelled as a reasoned default.
  • Inch sizes named in decimals (0.2500-20) also carry their fraction (1/4-20).

create_thread

  • Cuts an external thread (Die profile) or an internal thread (Tap profile) with SolidWorks' Thread feature.
  • The thread starts at the circular edge picked by edge_point, runs for length, and is right- or left-handed.
  • Checked before anything is built:
    • the size must be in the profile (fractional inch sizes are accepted);
    • the edge must be circular;
    • its diameter must suit the size: within one pitch of nominal for a rod, or of the tap drill for a hole.
  • Measured after: a thread that cuts nothing is undone and fails.

create_hole — its description now says to ask about modelling the thread when fasteners matter, and points to these two tools. It still models no thread by default, as decided.

Probe and live tests (SolidWorks 2026 SP4)

  • The probe settled the Thread feature's API and the profiles' sizes; details in design.md. Pictures showed a threaded rod and a threaded hole.
  • The live tests pass:
    • M6 on a 6 mm rod: 63.8 mm³ removed over 12 turns;
    • 1/4-20 on a 6.35 mm rod: 89.3 mm³;
    • create_hole's M6 tapped hole, then an internal M6 thread in its 5 mm tap drill: 40.3 mm³;
    • on purpose, M10 on a 6 mm rod is refused before anything is built.

Spec: openspec/changes/modelled-threads/. Research and the decisions behind it: openspec/research/modelled-threads.md.

Checks

  • ruff and mypy are clean.
  • 4,984 unit tests pass, with coverage at 100%.
  • The strict docs build is clean.

This PR touches the same lists as #284 (tool counts, registration, the core toolset, the layer tests). Whichever merges second needs a small merge; I'll do it.

Open questions

  • Should the runout be modelled as geometry? Yes; see The runout, modelled below.
  • SolidWorks' profiles start at M1.2, so there is no M1. Add it from ISO 261?

The runout, modelled (added after review)

create_thread takes a runout option:

  • fade follows the second video. It sweeps the Thread feature's end face along an arc tangent to the helix, so the groove runs out of the material over DIN 76-1's normal runout x1. It works on any thread.
  • undercut_a and undercut_b cut a DIN 76-1 Form A or Form B thread undercut at the shoulder. The dimensions (dg, g2 and r, with a 30° flank) come from DIN 76-1:2025-10 Table 1. This is for external metric threads only.

The following are refused before anything is built: an undercut on an internal or inch thread, a pitch with no row in the table, an undercut wider than the thread, and an axis that isn't on the Front, Top or Right plane. If SolidWorks doesn't build the runout, the thread is removed as well.

Live test test_thread_runouts passes on SolidWorks 2026:

  • a faded M6 removes 0.26 mm³ over 2.5 mm;
  • an M6 thread to a 10 mm collar ends in a Form A undercut (dg 4.4, g2 3.5, r 0.5), which removes 19.7 mm³;
  • on purpose, an undercut in a tapped hole is refused (invalid_input).

I checked the exported pictures.

…thread, from SolidWorks's die and tap profiles, coarse or fine, ISO 68-1 depth, ISO 3508 runout
…rm A/B undercut

create_thread takes runout: 'fade' sweeps the Thread feature's end face
out of the material along an arc tangent to the helix (any thread);
'undercut_a' / 'undercut_b' revolve a DIN 76-1:2025-10 Table 1 undercut
(dg, g2, r, 30 degree flank) at the shoulder of an external metric thread.
Refused before building: an undercut on an internal or inch thread, a
pitch without a row, one wider than the thread, an axis off the main
planes. A runout SolidWorks doesn't build removes the thread too. Live
test passes on SolidWorks 2026.
…to just under the minor diameter (ISO 4753's chamfered end), made last, so a bolt starts in a nut; the runout stays at the shoulder

The undercut and the lead-in share one sketch-and-revolve step. A lead-in on an internal thread is refused; if SolidWorks builds none, the thread and its runout are removed. The live demos give the M6 rod and the collar rod a lead-in and look at both ends side on.
…ed, length kept), so its groove runs out through the end face instead of starting in a flat-ended pocket, as in a real bolt
…'s end swept straight along the helix's tangent, tapering out of the round rod (M6: 1.72 mm); a tapped hole keeps the arc over DIN 76-1's x1. docs: the thread demos (a bolt-like rod; runouts and a lead-in) in Demos
# Conflicts:
#	CHANGELOG.md
#	README.md
#	docs/assets/progress/progress.json
#	docs/assets/progress/progress.svg
#	docs/assets/progress/tables.html
#	docs/assets/progress/tool-list-size.md
#	docs/getting-started/installation.md
#	docs/index.md
#	docs/llms.txt
#	docs/user-guide/tool-catalog/index.md
#	docs/user-guide/tools-overview.md
#	mkdocs.yml
#	src/solidworks_mcp/adapters/base.py
#	src/solidworks_mcp/adapters/circuit_breaker.py
#	src/solidworks_mcp/adapters/connection_pool.py
#	src/solidworks_mcp/adapters/mock_adapter.py
#	src/solidworks_mcp/adapters/pywin32_adapter.py
#	src/solidworks_mcp/tools/__init__.py
#	src/solidworks_mcp/tools/error_classifier.py
#	src/solidworks_mcp/tools/tool_hints.py
#	src/solidworks_mcp/tools/toolsets.py
#	tests/integration/test_skill_content.py
#	tests/solidworks_mcp/tools/test_error_classifier.py
@andrewbartels1
andrewbartels1 merged commit ed74036 into main Nov 30, 2026
16 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.

1 participant