solidworks_mcp.adapters.solidworks.com_utils¶
solidworks_mcp.adapters.solidworks.com_utils ¶
Small COM helpers shared by the selection / face / rebuild modules.
One copy of each, so error-handling and flagging behaviour cannot drift between modules.
Functions:¶
as_list ¶
Normalise a COM array/scalar/None return into a list.
attempt ¶
Run fn through the adapter's _attempt (exceptions -> default).
flag ¶
Flag just names as methods on obj (no-op for None/fakes).
Flagging a whole interface costs ~27 ms per fresh dispatch (see
_WALK_MEMBERS in pywin32_adapter); SolidWorks hands back a fresh
dispatch on most calls, so flag only what is about to be read.
Source code in src/solidworks_mcp/adapters/solidworks/com_utils.py
selection_count ¶
Number of entities currently selected in model, or None.
Source code in src/solidworks_mcp/adapters/solidworks/com_utils.py
strip_op_prefix ¶
Drop _handle_com_operation's generic "Error in <op>: " prefix.
Expected failures (not found, nothing to select, rebuild errors) then read as plain sentences for the LLM caller.