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.
Attributes¶
Functions:¶
as_list ¶
Normalise a COM array/scalar/None return into a list.
attempt ¶
Run fn through the adapter's _attempt (exceptions -> default).
dispatch_array ¶
VARIANT(VT_ARRAY | VT_DISPATCH), e.g. edges for a flange (tuple when pywin32 is absent).
Source code in src/solidworks_mcp/adapters/solidworks/com_utils.py
double_array ¶
VARIANT(VT_ARRAY | VT_R8) for array-valued COM properties (tuple when pywin32 is absent).
Source code in src/solidworks_mcp/adapters/solidworks/com_utils.py
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 feature_walk); 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
long_array ¶
VARIANT(VT_ARRAY | VT_I4), e.g. one orientation per component (tuple when pywin32 is absent).
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
string_array ¶
VARIANT(VT_ARRAY | VT_BSTR), e.g. configuration names (tuple when pywin32 is absent).
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.