solidworks_mcp.adapters.solidworks.compat¶
solidworks_mcp.adapters.solidworks.compat ¶
COM calls whose shape differs between SolidWorks releases.
Added in 2.2.0 for #265 (the equation tools on SolidWorks 2024).
The adapter is written and checked live against SolidWorks 2026. Reports from SolidWorks 2024 (#255, #264-#276) show two kinds of difference, and this module handles the first one in one place:
- The same member, another dispatch kind. A member SolidWorks 2026
answers as a method may only answer as a property on another release, or
the reverse; pywin32 then gets
DISP_E_MEMBERNOTFOUND("Member not found", #265, fixed in 2.2.0: every equation tool on 2024). :func:invokeand :func:readmake the call exactly as before, so 2026 is unchanged, and only on "Member not found" retry it throughIDispatch.Invokewith both dispatch kinds allowed. - The same member, another argument list (#255:
FeatureFillet3took 15 arguments on one interface and 14 on another). These are fixed where they occur, by calling the one form every release has; they are listed indocs/agents/com-api-pitfalls.md.
Every member that needed the retry is recorded in :data:fallbacks, which
selftest reports, so a report from a release we don't have names the
members that differ there.
Attributes¶
Functions:¶
_either_kind ¶
Call name through IDispatch.Invoke, method or property get.
Source code in src/solidworks_mcp/adapters/solidworks/compat.py
invoke ¶
Call method name with args on any SolidWorks release.
Made exactly as obj.name(*args) first; on "Member not found" only,
retried with either dispatch kind (an indexed property such as
IEquationMgr.Equation(i) may be property-only there).
Raises:
| Type | Description |
|---|---|
Exception
|
Whatever the call raised, when it isn't "Member not found", or when the retry fails too. |
Source code in src/solidworks_mcp/adapters/solidworks/compat.py
member_not_found ¶
Whether exc is SolidWorks' "Member not found".
Source code in src/solidworks_mcp/adapters/solidworks/compat.py
read ¶
Read property name on any SolidWorks release.
Read exactly as obj.name first; on "Member not found" only, read
with either dispatch kind (it may be a method there).
Raises:
| Type | Description |
|---|---|
Exception
|
Whatever the read raised, when it isn't "Member not found", or when the retry fails too. |
Source code in src/solidworks_mcp/adapters/solidworks/compat.py
release_year ¶
The SolidWorks year from ISldWorks.RevisionNumber ("32.5.0").
Major 32 is 2024, 33 is 2025, 34 is 2026: year = major + 1992.