solidworks_mcp.adapters¶
solidworks_mcp.adapters ¶
SolidWorks adapter interfaces and factory.
This module provides the adapter pattern infrastructure for different SolidWorks integration approaches (pywin32, mock, future edge.js, etc.)
Attributes¶
__all__
module-attribute
¶
__all__ = ['SolidWorksAdapter', 'AdapterResult', 'AdapterHealth', 'create_adapter', 'AdapterType', 'AdapterFactory', 'PyWin32Adapter', 'MockSolidWorksAdapter', 'CircuitBreakerAdapter', 'ConnectionPoolAdapter', 'ComplexityAnalyzer', 'RoutingDecision', 'IntelligentRouter', 'VbaGeneratorAdapter', 'VbaMacroExecutor', 'MacroExecutionRequest', 'MacroExecutionResult']
Classes¶
AdapterFactory ¶
Factory-pattern adapter creator with singleton and fallback strategies.
Manages adapter registration and creation with configuration-based selection. Automatically wraps adapters with decorators (circuit breaker, connection pool) based on configuration. Implements singleton pattern for consistency.
Attributes:
| Name | Type | Description |
|---|---|---|
_adapter_registry |
dict[AdapterType, type[SolidWorksAdapter]]
|
The adapter registry value. |
_adapters |
dict[AdapterType, type[SolidWorksAdapter]]
|
The adapters value. |
_instance |
AdapterFactory | None
|
The instance value. |
Example
factory = AdapterFactory() config = SolidWorksMCPConfig(adapter_type=AdapterType.PYWIN32) adapter = factory.create_adapter(config) await adapter.connect()
Methods:¶
__new__ ¶
Initialize or return singleton AdapterFactory instance.
Enforces singleton pattern to ensure single adapter registry and consistent factory behavior across application lifetime.
Returns:
| Name | Type | Description |
|---|---|---|
AdapterFactory |
AdapterFactory
|
The result produced by the operation. |
Example
factory1 = AdapterFactory() factory2 = AdapterFactory() factory1 is factory2 True
Source code in src/solidworks_mcp/adapters/factory.py
create_adapter
classmethod
¶
Create and configure a SolidWorks adapter instance.
Determines the best adapter type based on configuration and environment. Selects implementation, applies wrappers (circuit breaker, connection pool), and returns a fully-initialized adapter ready for connection.
The adapter is automatically downgraded to Mock on non-Windows platforms or when testing is enabled, with fallback to configured type otherwise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
SolidWorksMCPConfig
|
Configuration values for the operation. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
SolidWorksAdapter |
SolidWorksAdapter
|
The result produced by the operation. |
Example
config = SolidWorksMCPConfig(mock_solidworks=True) adapter = AdapterFactory.create_adapter(config) isinstance(adapter, MockSolidWorksAdapter) True
Source code in src/solidworks_mcp/adapters/factory.py
register_adapter
classmethod
¶
Register an adapter class for a given adapter type.
Updates the adapter registry to map a specific AdapterType enum value to a SolidWorksAdapter implementation class. Called during initialization to register built- in adapters (PyWin32, Mock, etc.).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adapter_type
|
AdapterType
|
The adapter type value. |
required |
adapter_class
|
type[SolidWorksAdapter]
|
The adapter class value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Example
from adapters.pywin32_adapter import PyWin32Adapter AdapterFactory.register_adapter( ... AdapterType.PYWIN32, PyWin32Adapter ... )
Source code in src/solidworks_mcp/adapters/factory.py
AdapterHealth ¶
Bases: BaseModel
Health status information for adapters.
Attributes:
| Name | Type | Description |
|---|---|---|
average_response_time |
float
|
The average response time value. |
connection_status |
str
|
The connection status value. |
error_count |
int
|
The error count value. |
healthy |
bool
|
The healthy value. |
last_check |
datetime
|
The last check value. |
metrics |
dict[str, Any] | None
|
The metrics value. |
success_count |
int
|
The success count value. |
Methods:¶
__contains__ ¶
Build internal contains.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The key value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if contains, otherwise False. |
Source code in src/solidworks_mcp/adapters/base.py
__getitem__ ¶
Build internal getitem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The key value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
AdapterResult
dataclass
¶
AdapterResult(status: AdapterResultStatus, data: T | None = None, error: str | None = None, execution_time: float | None = None, metadata: dict[str, Any] | None = None)
Bases: Generic[T]
Result wrapper for adapter operations.
Attributes:
| Name | Type | Description |
|---|---|---|
data |
T | None
|
The data value. |
error |
str | None
|
The error value. |
execution_time |
float | None
|
The execution time value. |
metadata |
dict[str, Any] | None
|
The metadata value. |
status |
AdapterResultStatus
|
The status value. |
AdapterType ¶
Bases: StrEnum
SolidWorks adapter implementation options.
Attributes:
| Name | Type | Description |
|---|---|---|
EDGE_DOTNET |
Any
|
The edge dotnet value. |
MOCK |
Any
|
The mock value. |
POWERSHELL |
Any
|
The powershell value. |
PYWIN32 |
Any
|
The pywin32 value. |
VBA |
Any
|
The vba value. |
CircuitBreakerAdapter ¶
CircuitBreakerAdapter(adapter: SolidWorksAdapter | None = None, failure_threshold: int = 5, recovery_timeout: int = 60, half_open_max_calls: int = 3, config: dict[str, object] | None = None)
Bases: SolidWorksAdapter
Circuit breaker wrapper for SolidWorks adapters.
Each named operation (create_cut_extrude, list_features, ...) gets
its own independent breaker bucket, keyed by the operation_name passed
to _execute_with_circuit_breaker. A run of failures on one tool (e.g.
every create_cut_extrude attempt failing while a wrong argument count
is being worked out) trips only that tool's breaker — unrelated read-only
tools like list_features or get_model_info keep working. Before
this, a single shared CircuitState meant one failing tool blocked
every other tool on the adapter, including reads, until the shared
recovery timeout elapsed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adapter
|
SolidWorksAdapter | None
|
Adapter instance used for the operation. Defaults to None. |
None
|
failure_threshold
|
int
|
The failure threshold value. Defaults to 5. |
5
|
recovery_timeout
|
int
|
The recovery timeout value. Defaults to 60. |
60
|
half_open_max_calls
|
int
|
The half open max calls value. Defaults to 3. |
3
|
config
|
dict[str, object] | None
|
Configuration values for the operation. Defaults to None. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
adapter |
Any
|
The adapter value. |
failure_threshold |
Any
|
The failure threshold value. |
half_open_max_calls |
Any
|
The half open max calls value. |
recovery_timeout |
Any
|
The recovery timeout value. |
Initialize the circuit breaker adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adapter
|
SolidWorksAdapter | None
|
Adapter instance used for the operation. Defaults to None. |
None
|
failure_threshold
|
int
|
The failure threshold value. Defaults to 5. |
5
|
recovery_timeout
|
int
|
The recovery timeout value. Defaults to 60. |
60
|
half_open_max_calls
|
int
|
The half open max calls value. Defaults to 3. |
3
|
config
|
dict[str, object] | None
|
Configuration values for the operation. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
Methods:¶
activate_document
async
¶
Activate an open document through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title_or_path
|
str
|
Title, full path, or file name of an open document. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
add_arc
async
¶
add_arc(center_x: float, center_y: float, start_x: float, start_y: float, end_x: float, end_y: float) -> AdapterResult[str]
Add arc through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
center_x
|
float
|
Arc center X coordinate. |
required |
center_y
|
float
|
Arc center Y coordinate. |
required |
start_x
|
float
|
Arc start X coordinate. |
required |
start_y
|
float
|
Arc start Y coordinate. |
required |
end_x
|
float
|
Arc end X coordinate. |
required |
end_y
|
float
|
Arc end Y coordinate. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
add_centerline
async
¶
Add centerline through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
float
|
The x1 value. |
required |
y1
|
float
|
The y1 value. |
required |
x2
|
float
|
The x2 value. |
required |
y2
|
float
|
The y2 value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
add_chamfer
async
¶
Add chamfer through circuit breaker.
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
add_circle
async
¶
Add circle through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
center_x
|
float
|
The center x value. |
required |
center_y
|
float
|
The center y value. |
required |
radius
|
float
|
The radius value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
add_drawing_view
async
¶
Add a drawing view through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
Any
|
Tool payload for the drawing view. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
add_ellipse
async
¶
add_ellipse(center_x: float, center_y: float, major_axis: float, minor_axis: float) -> AdapterResult[str]
Add ellipse through circuit breaker.
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
add_fillet
async
¶
Add fillet through circuit breaker.
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
add_line
async
¶
Add line through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
float
|
The x1 value. |
required |
y1
|
float
|
The y1 value. |
required |
x2
|
float
|
The x2 value. |
required |
y2
|
float
|
The y2 value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
add_mate
async
¶
add_mate(component_a: str, component_b: str, entity_a: str = 'Front Plane', entity_b: str = 'Front Plane', mate_type: str = 'coincident', alignment: str = 'aligned', distance: float = 0.0, angle: float = 0.0) -> AdapterResult[dict[str, Any]]
Add mate through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component_a
|
str
|
First component instance name. |
required |
component_b
|
str
|
Second component instance name. |
required |
entity_a
|
str
|
Named feature on the first component. Defaults to "Front Plane". |
'Front Plane'
|
entity_b
|
str
|
Named feature on the second component. Defaults to "Front Plane". |
'Front Plane'
|
mate_type
|
str
|
Mate type. Defaults to "coincident". |
'coincident'
|
alignment
|
str
|
Mate alignment. Defaults to "aligned". |
'aligned'
|
distance
|
float
|
Distance in millimetres. Defaults to 0.0. |
0.0
|
angle
|
float
|
Angle in degrees. Defaults to 0.0. |
0.0
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
add_note
async
¶
Add a drawing note through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
Any
|
Tool payload for the note. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
add_polygon
async
¶
Add polygon through circuit breaker.
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
add_rectangle
async
¶
Add rectangle through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
float
|
The x1 value. |
required |
y1
|
float
|
The y1 value. |
required |
x2
|
float
|
The x2 value. |
required |
y2
|
float
|
The y2 value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
add_sketch_constraint
async
¶
add_sketch_constraint(entity1: str, entity2: str | None, relation_type: str, entity3: str | None = None) -> AdapterResult[str]
Add sketch constraint through circuit breaker.
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
add_sketch_dimension
async
¶
add_sketch_dimension(entity1: str, entity2: str | None, dimension_type: str, value: float) -> AdapterResult[str]
Add sketch dimension through circuit breaker.
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
add_spline
async
¶
Add spline through circuit breaker.
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
auto_center_marks
async
¶
auto_center_marks(view_name: str, mark_holes: bool = True, mark_fillets: bool = False, mark_slots: bool = True) -> AdapterResult[dict[str, Any]]
Auto-insert drawing centre marks through circuit breaker.
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
call
async
¶
Legacy call API used by tests.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
operation
|
Callable[[], object | Awaitable[object]]
|
Callable object executed by the helper. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
object |
object
|
The result produced by the operation. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the operation cannot be completed. |
Exception
|
Circuit breaker is open. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
check_interference
async
¶
Check interference through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Any
|
Optional interference-detection settings. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
check_sketch_fully_defined
async
¶
Check sketch definition status through circuit breaker.
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
close_model
async
¶
Close model through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
save
|
bool
|
The save value. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[None]
|
AdapterResult[None]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
connect
async
¶
Connect through circuit breaker.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Raises:
| Type | Description |
|---|---|
Exception
|
If the operation cannot be completed. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
create_assembly
async
¶
Create assembly through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
create_axis
async
¶
Create reference axis through circuit breaker.
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
create_cut_extrude
async
¶
Create cut-extrude through circuit breaker.
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
create_drawing
async
¶
Create drawing through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
create_drawing_view
async
¶
Create a drawing view through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
Any
|
Tool payload for the drawing view. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
create_extrusion
async
¶
Create extrusion through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
ExtrusionParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksFeature]
|
AdapterResult[SolidWorksFeature]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
create_loft
async
¶
Create loft through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
LoftParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksFeature]
|
AdapterResult[SolidWorksFeature]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
create_part
async
¶
Create part through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name value. Defaults to None. |
None
|
units
|
str | None
|
The units value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
create_reference_plane
async
¶
create_reference_plane(reference: str, offset: float = 0.0, angle: float = 0.0, flip: bool = False) -> AdapterResult[dict[str, Any]]
Create reference plane through circuit breaker.
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
create_reference_point
async
¶
create_reference_point(mode: str, x: float, y: float, z: float, distance: float | None = None, percent: float | None = None) -> AdapterResult[dict[str, Any]]
Create a reference point through circuit breaker.
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
create_revolve
async
¶
Create revolve through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
RevolveParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksFeature]
|
AdapterResult[SolidWorksFeature]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
create_sketch
async
¶
Create sketch through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plane
|
str
|
The plane value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
create_sweep
async
¶
Create sweep through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
SweepParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksFeature]
|
AdapterResult[SolidWorksFeature]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
create_technical_drawing
async
¶
Create standard views through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
Any
|
Tool payload for the technical drawing. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
delete_feature
async
¶
Delete a feature through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Feature or sketch name. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
disconnect
async
¶
execute_macro
async
¶
Provide execute macro support for the circuit breaker adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
dict[str, Any]
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
exit_sketch
async
¶
Exit sketch through circuit breaker.
Returns:
| Type | Description |
|---|---|
AdapterResult[None]
|
AdapterResult[None]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
export_file
async
¶
Export file through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the target file. |
required |
format_type
|
str
|
The format type value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[None]
|
AdapterResult[None]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
export_image
async
¶
Export viewport image through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
dict
|
The payload value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict]
|
AdapterResult[dict]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
get_dimension
async
¶
Get dimension through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[float]
|
AdapterResult[float]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
get_mass_properties
async
¶
Get mass properties through circuit breaker.
Returns:
| Type | Description |
|---|---|
AdapterResult[MassProperties]
|
AdapterResult[MassProperties]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
get_model_info
async
¶
Get active model metadata through circuit breaker.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, object]]
|
AdapterResult[dict[str, object]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
health_check
async
¶
Get health check with circuit breaker status.
circuit_breaker reports the legacy/default bucket (used by
connect()), which is what "connection health" means here.
circuit_breaker_operations reports every per-tool bucket, so a
tripped tool-specific breaker is visible even while the connection
itself is healthy.
Returns:
| Name | Type | Description |
|---|---|---|
AdapterHealth |
AdapterHealth
|
The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
insert_component
async
¶
insert_component(file_path: str, x: float = 0.0, y: float = 0.0, z: float = 0.0) -> AdapterResult[dict[str, Any]]
Insert component through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the target file. |
required |
x
|
float
|
X position in millimetres. Defaults to 0.0. |
0.0
|
y
|
float
|
Y position in millimetres. Defaults to 0.0. |
0.0
|
z
|
float
|
Z position in millimetres. Defaults to 0.0. |
0.0
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
is_connected ¶
Check connection status.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if connected, otherwise False. |
list_components
async
¶
List components through circuit breaker.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[str]]
|
AdapterResult[list[str]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
list_configurations
async
¶
List model configurations through circuit breaker.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[str]]
|
AdapterResult[list[str]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
list_drawing_views
async
¶
List drawing views through circuit breaker.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[str]]
|
AdapterResult[list[str]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
list_features
async
¶
list_features(include_suppressed: bool = False, max_assembly_depth: int = 2) -> AdapterResult[list[dict[str, object]]]
List model features through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include_suppressed
|
bool
|
The include suppressed value. Defaults to False. |
False
|
max_assembly_depth
|
int
|
Sub-assembly recursion depth. Defaults to 2. |
2
|
Returns:
| Type | Description |
|---|---|
AdapterResult[list[dict[str, object]]]
|
AdapterResult[list[dict[str, object]]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
list_open_documents
async
¶
List open documents through circuit breaker.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[dict[str, Any]]]
|
AdapterResult[list[dict[str, Any]]]: The result produced by the |
AdapterResult[list[dict[str, Any]]]
|
operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
mirror_feature
async
¶
mirror_feature(features: list[str], mirror_plane: str, merge: bool = True, mirror_bodies: bool = True) -> AdapterResult[dict[str, Any]]
Mirror solid bodies or features through circuit breaker.
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
open_model
async
¶
Open model through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the target file. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
pattern_circular
async
¶
pattern_circular(features: list[str], axis: str, count: int, angle: float = 360.0, equal_spacing: bool = True) -> AdapterResult[dict[str, Any]]
Pattern features around an axis through circuit breaker.
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
rename_feature
async
¶
Rename a feature through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
old_name
|
str
|
Current feature name. |
required |
new_name
|
str
|
New feature name. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
save_body_as_part
async
¶
Save a body to a new part through circuit breaker.
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
save_file
async
¶
Save model through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str | None
|
Path to the target file. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[None]
|
AdapterResult[None]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
set_dimension
async
¶
Set dimension through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name value. |
required |
value
|
float
|
The value value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[None]
|
AdapterResult[None]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
set_units
async
¶
Set document units through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unit_system
|
str
|
One of |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
sketch_circular_pattern
async
¶
Sketch circular pattern through circuit breaker.
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
sketch_linear_pattern
async
¶
sketch_linear_pattern(entities: list[str], direction_x: float, direction_y: float, spacing: float, count: int) -> AdapterResult[str]
Sketch linear pattern through circuit breaker.
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
sketch_mirror
async
¶
Sketch mirror through circuit breaker.
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
sketch_offset
async
¶
sketch_offset(entities: list[str], offset_distance: float, reverse_direction: bool) -> AdapterResult[str]
Sketch offset through circuit breaker.
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
soc_create_checkpoint
async
¶
soc_create_checkpoint(label: str, file_path: str, *, feature_tree: list[dict[str, Any]] | None = None) -> int | None
Create a named SoC checkpoint after saving the model.
Records a SoCCheckpoint row and a ModelStateSnapshot. Call this
immediately after save_file to mark a stable rollback point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
Short human name (e.g. "base-extrude"). |
required |
file_path
|
str
|
Path of the .sldprt that was just saved. |
required |
feature_tree
|
list | None
|
Optional feature list from list_features(). |
None
|
Returns:
| Type | Description |
|---|---|
int | None
|
int | None: The new SoCCheckpoint.id, or None if soc_session_id is unset. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 | |
suppress_feature
async
¶
Suppress or unsuppress a feature through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Feature name. |
required |
suppress
|
bool
|
True to suppress, False to unsuppress. |
True
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
undo
async
¶
Undo through circuit breaker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
count
|
int
|
Number of steps to undo. |
1
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/circuit_breaker.py
ComplexityAnalyzer ¶
Analyze operation complexity and recommend COM or VBA execution path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameter_threshold
|
int
|
The parameter threshold value. Defaults to 12. |
12
|
score_threshold
|
float
|
The score threshold value. Defaults to 0.6. |
0.6
|
Attributes:
| Name | Type | Description |
|---|---|---|
_parameter_threshold |
Any
|
The parameter threshold value. |
_score_threshold |
Any
|
The score threshold value. |
Initialize analyzer state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameter_threshold
|
int
|
The parameter threshold value. Defaults to 12. |
12
|
score_threshold
|
float
|
The score threshold value. Defaults to 0.6. |
0.6
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/adapters/complexity_analyzer.py
Methods:¶
analyze ¶
Produce a routing recommendation for an operation call.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
operation
|
str
|
Callable object executed by the helper. |
required |
payload
|
object
|
The payload value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
RoutingDecision |
RoutingDecision
|
The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/complexity_analyzer.py
record_result ¶
Record operation outcome for future routing influence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
operation
|
str
|
Callable object executed by the helper. |
required |
route
|
str
|
The route value. |
required |
success
|
bool
|
The success value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/adapters/complexity_analyzer.py
ConnectionPoolAdapter ¶
ConnectionPoolAdapter(adapter_factory: Callable[[], SolidWorksAdapter] | None = None, pool_size: int = 3, max_retries: int = 3, create_connection: Callable[[], SolidWorksAdapter] | None = None, max_size: int | None = None, timeout: float | None = None, config: dict[str, object] | None = None)
Bases: SolidWorksAdapter
Connection pool wrapper for SolidWorks adapters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adapter_factory
|
Callable[[], SolidWorksAdapter] | None
|
Factory callable used to create adapter instances. Defaults to None. |
None
|
pool_size
|
int
|
Number of adapters to maintain in the pool. Defaults to 3. |
3
|
max_retries
|
int
|
Maximum number of retry attempts. Defaults to 3. |
3
|
create_connection
|
Callable[[], SolidWorksAdapter] | None
|
Factory callable used to create a connection. Defaults to None. |
None
|
max_size
|
int | None
|
Maximum number of items allowed in the pool. Defaults to None. |
None
|
timeout
|
float | None
|
Maximum time to wait in seconds. Defaults to None. |
None
|
config
|
dict[str, object] | None
|
Configuration values for the operation. Defaults to None. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
_lock |
Any
|
The lock value. |
adapter_factory |
Any
|
The adapter factory value. |
max_retries |
Any
|
The max retries value. |
pool_initialized |
Any
|
The pool initialized value. |
pool_size |
Any
|
The pool size value. |
timeout |
Any
|
The timeout value. |
Initialize the connection pool adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adapter_factory
|
Callable[[], SolidWorksAdapter] | None
|
Factory callable used to create adapter instances. Defaults to None. |
None
|
pool_size
|
int
|
Number of adapters to maintain in the pool. Defaults to 3. |
3
|
max_retries
|
int
|
Maximum number of retry attempts. Defaults to 3. |
3
|
create_connection
|
Callable[[], SolidWorksAdapter] | None
|
Factory callable used to create a connection. Defaults to None. |
None
|
max_size
|
int | None
|
Maximum number of items allowed in the pool. Defaults to None. |
None
|
timeout
|
float | None
|
Maximum time to wait in seconds. Defaults to None. |
None
|
config
|
dict[str, object] | None
|
Configuration values for the operation. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
Attributes¶
active_connections
property
¶
Provide active connections support for the connection pool adapter.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The computed numeric result. |
size
property
¶
Provide size support for the connection pool adapter.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The computed numeric result. |
Methods:¶
acquire
async
¶
Provide acquire support for the connection pool adapter.
Returns:
| Name | Type | Description |
|---|---|---|
SolidWorksAdapter |
SolidWorksAdapter
|
The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
activate_document
async
¶
Activate an open document using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title_or_path
|
str
|
Title, full path, or file name of an open document. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
add_arc
async
¶
add_arc(center_x: float, center_y: float, start_x: float, start_y: float, end_x: float, end_y: float) -> AdapterResult[str]
Add arc using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
center_x
|
float
|
Arc center X coordinate. |
required |
center_y
|
float
|
Arc center Y coordinate. |
required |
start_x
|
float
|
Arc start X coordinate. |
required |
start_y
|
float
|
Arc start Y coordinate. |
required |
end_x
|
float
|
Arc end X coordinate. |
required |
end_y
|
float
|
Arc end Y coordinate. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
add_centerline
async
¶
Add centerline using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
float
|
The x1 value. |
required |
y1
|
float
|
The y1 value. |
required |
x2
|
float
|
The x2 value. |
required |
y2
|
float
|
The y2 value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
add_chamfer
async
¶
Add chamfer using pool.
Source code in src/solidworks_mcp/adapters/connection_pool.py
add_circle
async
¶
Add circle using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
center_x
|
float
|
The center x value. |
required |
center_y
|
float
|
The center y value. |
required |
radius
|
float
|
The radius value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
add_drawing_view
async
¶
Add a drawing view using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
Any
|
Tool payload for the drawing view. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
add_fillet
async
¶
Add fillet using pool.
Source code in src/solidworks_mcp/adapters/connection_pool.py
add_line
async
¶
Add line using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
float
|
The x1 value. |
required |
y1
|
float
|
The y1 value. |
required |
x2
|
float
|
The x2 value. |
required |
y2
|
float
|
The y2 value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
add_mate
async
¶
add_mate(component_a: str, component_b: str, entity_a: str = 'Front Plane', entity_b: str = 'Front Plane', mate_type: str = 'coincident', alignment: str = 'aligned', distance: float = 0.0, angle: float = 0.0) -> AdapterResult[dict[str, Any]]
Add mate using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component_a
|
str
|
First component instance name. |
required |
component_b
|
str
|
Second component instance name. |
required |
entity_a
|
str
|
Named feature on the first component. Defaults to "Front Plane". |
'Front Plane'
|
entity_b
|
str
|
Named feature on the second component. Defaults to "Front Plane". |
'Front Plane'
|
mate_type
|
str
|
Mate type. Defaults to "coincident". |
'coincident'
|
alignment
|
str
|
Mate alignment. Defaults to "aligned". |
'aligned'
|
distance
|
float
|
Distance in millimetres. Defaults to 0.0. |
0.0
|
angle
|
float
|
Angle in degrees. Defaults to 0.0. |
0.0
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
add_note
async
¶
Add a drawing note using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
Any
|
Tool payload for the note. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
add_rectangle
async
¶
Add rectangle using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
float
|
The x1 value. |
required |
y1
|
float
|
The y1 value. |
required |
x2
|
float
|
The x2 value. |
required |
y2
|
float
|
The y2 value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
add_sketch_constraint
async
¶
add_sketch_constraint(entity1: str, entity2: str | None, relation_type: str, entity3: str | None = None) -> AdapterResult[str]
Add sketch constraint using pool.
Source code in src/solidworks_mcp/adapters/connection_pool.py
add_sketch_dimension
async
¶
add_sketch_dimension(entity1: str, entity2: str | None, dimension_type: str, value: float) -> AdapterResult[str]
Add sketch dimension using pool.
Source code in src/solidworks_mcp/adapters/connection_pool.py
auto_center_marks
async
¶
auto_center_marks(view_name: str, mark_holes: bool = True, mark_fillets: bool = False, mark_slots: bool = True) -> AdapterResult[dict[str, Any]]
Auto-insert drawing centre marks using pool.
Source code in src/solidworks_mcp/adapters/connection_pool.py
check_interference
async
¶
Check interference using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Any
|
Optional interference-detection settings. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
check_sketch_fully_defined
async
¶
Check sketch definition status using pool.
Source code in src/solidworks_mcp/adapters/connection_pool.py
cleanup
async
¶
Provide cleanup support for the connection pool adapter.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
close_model
async
¶
Close model using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
save
|
bool
|
The save value. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[None]
|
AdapterResult[None]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
connect
async
¶
create_assembly
async
¶
Create assembly using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
create_axis
async
¶
Create reference axis using pool.
Source code in src/solidworks_mcp/adapters/connection_pool.py
create_cut_extrude
async
¶
Create cut-extrude using pool.
Source code in src/solidworks_mcp/adapters/connection_pool.py
create_drawing
async
¶
Create drawing using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
create_drawing_view
async
¶
Create a drawing view using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
Any
|
Tool payload for the drawing view. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
create_extrusion
async
¶
Create extrusion using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
ExtrusionParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksFeature]
|
AdapterResult[SolidWorksFeature]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
create_loft
async
¶
Create loft using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
LoftParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksFeature]
|
AdapterResult[SolidWorksFeature]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
create_part
async
¶
Create part using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name value. Defaults to None. |
None
|
units
|
str | None
|
The units value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
create_reference_plane
async
¶
create_reference_plane(reference: str, offset: float = 0.0, angle: float = 0.0, flip: bool = False) -> AdapterResult[dict[str, Any]]
Create reference plane using pool.
Source code in src/solidworks_mcp/adapters/connection_pool.py
create_reference_point
async
¶
create_reference_point(mode: str, x: float, y: float, z: float, distance: float | None = None, percent: float | None = None) -> AdapterResult[dict[str, Any]]
Create a reference point using pool.
Source code in src/solidworks_mcp/adapters/connection_pool.py
create_revolve
async
¶
Create revolve using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
RevolveParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksFeature]
|
AdapterResult[SolidWorksFeature]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
create_sketch
async
¶
Create sketch using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plane
|
str
|
The plane value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
create_sweep
async
¶
Create sweep using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
SweepParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksFeature]
|
AdapterResult[SolidWorksFeature]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
create_technical_drawing
async
¶
Create standard views using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
Any
|
Tool payload for the technical drawing. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
delete_feature
async
¶
Delete a feature using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Feature or sketch name. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
disconnect
async
¶
Disconnect all adapters in the pool.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
execute_macro
async
¶
Provide execute macro support for the connection pool adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
dict[str, Any]
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
exit_sketch
async
¶
Exit sketch using pool.
Returns:
| Type | Description |
|---|---|
AdapterResult[None]
|
AdapterResult[None]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
export_file
async
¶
Export file using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the target file. |
required |
format_type
|
str
|
The format type value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[None]
|
AdapterResult[None]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
export_image
async
¶
Export viewport image using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
dict
|
The payload value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict]
|
AdapterResult[dict]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
get_dimension
async
¶
Get dimension using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[float]
|
AdapterResult[float]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
get_mass_properties
async
¶
Get mass properties using pool.
Returns:
| Type | Description |
|---|---|
AdapterResult[MassProperties]
|
AdapterResult[MassProperties]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
get_model_info
async
¶
Get active model metadata using pool.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, object]]
|
AdapterResult[dict[str, object]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
health_check
async
¶
Get health status of the connection pool.
Returns:
| Name | Type | Description |
|---|---|---|
AdapterHealth |
AdapterHealth
|
The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
insert_component
async
¶
insert_component(file_path: str, x: float = 0.0, y: float = 0.0, z: float = 0.0) -> AdapterResult[dict[str, Any]]
Insert component using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the target file. |
required |
x
|
float
|
X position in millimetres. Defaults to 0.0. |
0.0
|
y
|
float
|
Y position in millimetres. Defaults to 0.0. |
0.0
|
z
|
float
|
Z position in millimetres. Defaults to 0.0. |
0.0
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
is_connected ¶
Check if pool is initialized.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if connected, otherwise False. |
list_components
async
¶
List components using pool.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[str]]
|
AdapterResult[list[str]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
list_configurations
async
¶
List model configurations using pool.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[str]]
|
AdapterResult[list[str]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
list_drawing_views
async
¶
List drawing views using pool.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[str]]
|
AdapterResult[list[str]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
list_features
async
¶
list_features(include_suppressed: bool = False, max_assembly_depth: int = 2) -> AdapterResult[list[dict[str, object]]]
List model features using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include_suppressed
|
bool
|
The include suppressed value. Defaults to False. |
False
|
max_assembly_depth
|
int
|
Sub-assembly recursion depth. Defaults to 2. |
2
|
Returns:
| Type | Description |
|---|---|
AdapterResult[list[dict[str, object]]]
|
AdapterResult[list[dict[str, object]]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
list_open_documents
async
¶
List open documents using pool.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[dict[str, Any]]]
|
AdapterResult[list[dict[str, Any]]]: The result produced by the |
AdapterResult[list[dict[str, Any]]]
|
operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
mirror_feature
async
¶
mirror_feature(features: list[str], mirror_plane: str, merge: bool = True, mirror_bodies: bool = True) -> AdapterResult[dict[str, Any]]
Mirror solid bodies or features using pool.
Source code in src/solidworks_mcp/adapters/connection_pool.py
open_model
async
¶
Open model using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the target file. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
pattern_circular
async
¶
pattern_circular(features: list[str], axis: str, count: int, angle: float = 360.0, equal_spacing: bool = True) -> AdapterResult[dict[str, Any]]
Pattern features around an axis using pool.
Source code in src/solidworks_mcp/adapters/connection_pool.py
release
async
¶
Provide release support for the connection pool adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adapter
|
SolidWorksAdapter
|
Adapter instance used for the operation. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
rename_feature
async
¶
Rename a feature using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
old_name
|
str
|
Current feature name. |
required |
new_name
|
str
|
New feature name. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
save_body_as_part
async
¶
Save a body to a new part using pool.
Source code in src/solidworks_mcp/adapters/connection_pool.py
save_file
async
¶
Save model using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str | None
|
Path to the target file. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[None]
|
AdapterResult[None]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
set_dimension
async
¶
Set dimension using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name value. |
required |
value
|
float
|
The value value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[None]
|
AdapterResult[None]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
set_units
async
¶
Set document units using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unit_system
|
str
|
One of |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
suppress_feature
async
¶
Suppress or unsuppress a feature using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Feature name. |
required |
suppress
|
bool
|
True to suppress, False to unsuppress. |
True
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
undo
async
¶
Undo using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
count
|
int
|
Number of steps to undo. |
1
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
IntelligentRouter ¶
IntelligentRouter(analyzer: ComplexityAnalyzer, cache: ResponseCache, cacheable_operations: set[str] | None = None)
Route operations between COM and VBA paths using complexity analysis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
analyzer
|
ComplexityAnalyzer
|
The analyzer value. |
required |
cache
|
ResponseCache
|
The cache value. |
required |
cacheable_operations
|
set[str] | None
|
The cacheable operations value. Defaults to None. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
_analyzer |
Any
|
The analyzer value. |
_cache |
Any
|
The cache value. |
_cacheable_operations |
Any
|
The cacheable operations value. |
Initialize router dependencies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
analyzer
|
ComplexityAnalyzer
|
The analyzer value. |
required |
cache
|
ResponseCache
|
The cache value. |
required |
cacheable_operations
|
set[str] | None
|
The cacheable operations value. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/adapters/intelligent_router.py
Methods:¶
execute
async
¶
execute(operation: str, payload: object, call_args: tuple[Any, ...], call_kwargs: dict[str, Any], com_operation: OperationCallable, vba_operation: OperationCallable | None, cache_ttl_seconds: int | None = None) -> tuple[AdapterResult[Any], RouteResult]
Provide execute support for the intelligent router.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
operation
|
str
|
Callable object executed by the helper. |
required |
payload
|
object
|
The payload value. |
required |
call_args
|
tuple[Any, ...]
|
The call args value. |
required |
call_kwargs
|
dict[str, Any]
|
The call kwargs value. |
required |
com_operation
|
OperationCallable
|
The com operation value. |
required |
vba_operation
|
OperationCallable | None
|
The vba operation value. |
required |
cache_ttl_seconds
|
int | None
|
The cache ttl seconds value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[AdapterResult[Any], RouteResult]
|
tuple[AdapterResult[Any], RouteResult]: A tuple containing the resulting values. |
Source code in src/solidworks_mcp/adapters/intelligent_router.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
MacroExecutionRequest
dataclass
¶
Request to execute a VBA macro.
Attributes:
| Name | Type | Description |
|---|---|---|
macro_code |
str
|
The macro code value. |
macro_name |
str
|
The macro name value. |
subroutine |
str
|
The subroutine value. |
MacroExecutionResult
dataclass
¶
MacroExecutionResult(success: bool, macro_name: str, output: str | dict[str, Any] | None = None, error: str | None = None, duration_seconds: float = 0.0)
Result of VBA macro execution.
Attributes:
| Name | Type | Description |
|---|---|---|
duration_seconds |
float
|
The duration seconds value. |
error |
str | None
|
The error value. |
macro_name |
str
|
The macro name value. |
output |
str | dict[str, Any] | None
|
The output value. |
success |
bool
|
The success value. |
MockSolidWorksAdapter ¶
Bases: SolidWorksAdapter
Mock adapter that simulates SolidWorks operations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
object | None
|
Configuration values for the operation. Defaults to None. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
_connected |
Any
|
The connected value. |
_delays |
Any
|
The delays value. |
_is_connected_proxy |
Any
|
The is connected proxy value. |
_operation_count |
Any
|
The operation count value. |
_simulate_errors |
Any
|
The simulate errors value. |
Initialize the mock solid works adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
object | None
|
Configuration values for the operation. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | |
Methods:¶
__getattribute__ ¶
Build internal getattribute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
activate_document
async
¶
Mock making an already-open document active.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title_or_path
|
str
|
Title, full path, or file name of an open document. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
add_arc
async
¶
add_arc(center_x: float, center_y: float, start_x: float, start_y: float, end_x: float, end_y: float) -> AdapterResult[str]
Mock adding a circular arc to sketch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
center_x
|
float
|
Arc centre X. |
required |
center_y
|
float
|
Arc centre Y. |
required |
start_x
|
float
|
Arc start point X. |
required |
start_y
|
float
|
Arc start point Y. |
required |
end_x
|
float
|
Arc end point X. |
required |
end_y
|
float
|
Arc end point Y. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
add_centerline
async
¶
Mock adding a construction centerline to sketch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
float
|
The x1 value. |
required |
y1
|
float
|
The y1 value. |
required |
x2
|
float
|
The x2 value. |
required |
y2
|
float
|
The y2 value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
add_circle
async
¶
Mock adding a circle to sketch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
center_x
|
float
|
The center x value. |
required |
center_y
|
float
|
The center y value. |
required |
radius
|
float
|
The radius value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
add_drawing_view
async
¶
Mock adding a view of a model to the active drawing sheet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
Any
|
Tool payload carrying the model path and orientation. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
add_ellipse
async
¶
add_ellipse(center_x: float, center_y: float, major_axis: float, minor_axis: float) -> AdapterResult[str]
Mock adding an axis-aligned ellipse to sketch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
center_x
|
float
|
Ellipse centre X in millimetres. |
required |
center_y
|
float
|
Ellipse centre Y in millimetres. |
required |
major_axis
|
float
|
Full major-axis length in millimetres. |
required |
minor_axis
|
float
|
Full minor-axis length in millimetres. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
add_line
async
¶
Mock adding a line to sketch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
float
|
The x1 value. |
required |
y1
|
float
|
The y1 value. |
required |
x2
|
float
|
The x2 value. |
required |
y2
|
float
|
The y2 value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
add_mate
async
¶
add_mate(component_a: str, component_b: str, entity_a: str = 'Front Plane', entity_b: str = 'Front Plane', mate_type: str = 'coincident', alignment: str = 'aligned', distance: float = 0.0, angle: float = 0.0) -> AdapterResult[dict[str, Any]]
Mock mating two components in the active assembly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component_a
|
str
|
First component instance name. |
required |
component_b
|
str
|
Second component instance name. |
required |
entity_a
|
str
|
Named feature on the first component. Defaults to "Front Plane". |
'Front Plane'
|
entity_b
|
str
|
Named feature on the second component. Defaults to "Front Plane". |
'Front Plane'
|
mate_type
|
str
|
Mate type. Defaults to "coincident". |
'coincident'
|
alignment
|
str
|
Mate alignment. Defaults to "aligned". |
'aligned'
|
distance
|
float
|
Distance in millimetres, for a distance mate. Defaults to 0.0. |
0.0
|
angle
|
float
|
Angle in degrees, for an angle mate. Defaults to 0.0. |
0.0
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 | |
add_note
async
¶
Mock placing a text note on the active drawing sheet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
Any
|
Tool payload carrying the text and position. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
add_polygon
async
¶
Mock adding a regular polygon to sketch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
center_x
|
float
|
Polygon centre X in millimetres. |
required |
center_y
|
float
|
Polygon centre Y in millimetres. |
required |
radius
|
float
|
Circumradius in millimetres (distance from centre
to each vertex; matches the real adapter's
|
required |
sides
|
int
|
Number of polygon sides. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
add_rectangle
async
¶
Mock adding a rectangle to sketch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
float
|
The x1 value. |
required |
y1
|
float
|
The y1 value. |
required |
x2
|
float
|
The x2 value. |
required |
y2
|
float
|
The y2 value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
add_sketch_constraint
async
¶
add_sketch_constraint(entity1: str, entity2: str | None, relation_type: str, entity3: str | None = None) -> AdapterResult[str]
Mock adding a geometric constraint between sketch entities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity1
|
str
|
Primary sketch-entity ID. |
required |
entity2
|
str | None
|
Secondary sketch-entity ID, or None for single-entity relations (horizontal, vertical, fix). |
required |
relation_type
|
str
|
Constraint name (see RELATION_NAME_MAP). |
required |
entity3
|
str | None
|
Third entity ID — only used by the
|
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: SUCCESS with a placeholder constraint ID, or ERROR if no active sketch, the relation_type is unsupported, arity is wrong, or an entity ID is unknown. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 | |
add_sketch_line
async
¶
add_sketch_line(x1: float, y1: float, x2: float, y2: float, construction: bool = False) -> AdapterResult[dict[str, Any]]
Legacy compatibility wrapper around add_line.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
float
|
The x1 value. |
required |
y1
|
float
|
The y1 value. |
required |
x2
|
float
|
The x2 value. |
required |
y2
|
float
|
The y2 value. |
required |
construction
|
bool
|
The construction value. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
add_spline
async
¶
Mock adding a NURBS spline through the supplied points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
list[dict[str, float]]
|
Ordered control points with
|
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
auto_center_marks
async
¶
auto_center_marks(view_name: str, mark_holes: bool = True, mark_fillets: bool = False, mark_slots: bool = True) -> AdapterResult[dict[str, Any]]
Mock auto-inserting centre marks on a drawing view.
The mock has no geometry, so it cannot know how many circular features a view holds - it mirrors the live adapter's refusals (not a drawing, no feature type selected, unknown view) and, on a valid request, records a nominal centre-mark increase per view so before/after deltas stay monotonic across calls.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_name
|
str
|
Name of a view on the active drawing. |
required |
mark_holes
|
bool
|
Mark holes / bores. |
True
|
mark_fillets
|
bool
|
Mark fillets. |
False
|
mark_slots
|
bool
|
Mark slots. |
True
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The view, the feature types acted |
AdapterResult[dict[str, Any]]
|
on, and before/after centre-mark counts, or an error. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 | |
check_interference
async
¶
Mock checking the active assembly for interfering components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Any
|
Optional settings; |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
check_sketch_fully_defined
async
¶
Mock check for sketch definition status.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sketch_name
|
str | None
|
Optional sketch name to inspect. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Definition status payload. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
close_model
async
¶
Mock closing the current model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
save
|
bool
|
The save value. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[None]
|
AdapterResult[None]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
connect
async
¶
Mock connection to SolidWorks.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
create_assembly
async
¶
Mock creating a new assembly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
create_axis
async
¶
Mock creating a reference axis along a principal direction.
Mirrors the live adapter's plane-pair mapping (_AXIS_PLANE_PAIRS
in solidworks/features.py, imported here directly so the two can
never drift apart) and validation: only x/y/z
(case-insensitive, leading ± stripped) are accepted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference
|
str
|
"x", "y" or "z" (case-insensitive; leading ± stripped). |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The plane pair used and the |
AdapterResult[dict[str, Any]]
|
feature counter before/after, or error for an unknown reference. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
create_drawing
async
¶
Mock creating a new drawing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
create_drawing_view
async
¶
Mock placing a view of a model on the active drawing sheet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
Any
|
Tool payload carrying the model path and orientation. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
create_extrusion
async
¶
create_extrusion(params: ExtrusionParameters | str, depth: float | None = None, direction: str | None = None) -> AdapterResult[SolidWorksFeature]
Mock creating an extrusion feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
ExtrusionParameters | str
|
The params value. |
required |
depth
|
float | None
|
The depth value. Defaults to None. |
None
|
direction
|
str | None
|
The direction value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksFeature]
|
AdapterResult[SolidWorksFeature]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
create_loft
async
¶
Mock creating a loft feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
LoftParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksFeature]
|
AdapterResult[SolidWorksFeature]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
create_part
async
¶
Mock creating a new part.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name value. Defaults to None. |
None
|
units
|
str | None
|
The units value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
create_reference_plane
async
¶
create_reference_plane(reference: str, offset: float = 0.0, angle: float = 0.0, flip: bool = False) -> AdapterResult[dict[str, Any]]
Mock creating a reference plane offset from an existing plane.
Mirrors the live adapter's refusals rather than fabricating a
result it cannot know: an angled plane needs a second reference this
signature cannot supply, and an offset of zero would be coincident
with its reference. See _create_reference_plane_impl in
solidworks/features.py for the live contract this mirrors.
On success, invents a sequential PlaneN name tracked on
self._reference_planes and advances the shared mock feature-tree
counter so features_before/features_after differ by exactly
one, the same signal the live adapter derives from
IFeatureManager::GetFeatureCount.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference
|
str
|
Name of the reference plane or planar face. |
required |
offset
|
float
|
Offset distance in millimetres. Defaults to 0.0. |
0.0
|
angle
|
float
|
Angle in degrees; unsupported (non-zero errors). Defaults to 0.0. |
0.0
|
flip
|
bool
|
Reverse the offset direction. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The new plane's name and |
AdapterResult[dict[str, Any]]
|
parameters, or error. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 | |
create_reference_point
async
¶
create_reference_point(mode: str, x: float, y: float, z: float, distance: float | None = None, percent: float | None = None) -> AdapterResult[dict[str, Any]]
Mock creating a reference point on the active part.
The mock has no geometry, so it cannot resolve a coordinate to an
edge/face - it mirrors the live adapter's validation (unknown mode,
the distance/percent XOR, range checks) and, on a valid request,
bumps the feature counter the way InsertReferencePoint would.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mode
|
str
|
"along_curve" or "face_center". |
required |
x
|
float
|
X of a point on the target entity, in millimetres. |
required |
y
|
float
|
Y of a point on the target entity, in millimetres. |
required |
z
|
float
|
Z of a point on the target entity, in millimetres. |
required |
distance
|
float | None
|
For "along_curve", offset from the edge start in millimetres. |
None
|
percent
|
float | None
|
For "along_curve", 0-100 of edge length. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The mode and feature counts, or an |
AdapterResult[dict[str, Any]]
|
error matching the live adapter's refusals. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 | |
create_revolve
async
¶
Mock creating a revolve feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
RevolveParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksFeature]
|
AdapterResult[SolidWorksFeature]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
create_sketch
async
¶
Mock creating a sketch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plane
|
str
|
The plane value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
create_sweep
async
¶
Mock creating a sweep feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
SweepParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksFeature]
|
AdapterResult[SolidWorksFeature]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
create_technical_drawing
async
¶
Mock laying out the three standard views of a model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
Any
|
Tool payload carrying the model path and projection. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
delete_feature
async
¶
Mock deleting a named feature from the active model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Feature or sketch name. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
disconnect
async
¶
Mock disconnection from SolidWorks.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
exit_sketch
async
¶
Mock exiting sketch mode.
Returns:
| Type | Description |
|---|---|
AdapterResult[None]
|
AdapterResult[None]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
export_file
async
¶
Mock exporting a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the target file. |
required |
format_type
|
str
|
The format type value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[None]
|
AdapterResult[None]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 | |
export_image
async
¶
Mock export of a PNG/JPG viewport screenshot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
dict
|
The payload value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict]
|
AdapterResult[dict]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
get_dimension
async
¶
Mock getting a dimension value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[float]
|
AdapterResult[float]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
get_mass_properties
async
¶
Mock getting mass properties.
Returns:
| Type | Description |
|---|---|
AdapterResult[MassProperties]
|
AdapterResult[MassProperties]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
get_model_info
async
¶
Mock metadata for the currently active model.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
health_check
async
¶
Get mock health status.
Returns:
| Name | Type | Description |
|---|---|---|
AdapterHealth |
AdapterHealth
|
The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
insert_component
async
¶
insert_component(file_path: str, x: float = 0.0, y: float = 0.0, z: float = 0.0) -> AdapterResult[dict[str, Any]]
Mock inserting a component into the active assembly.
Records the component in self._components so repeated inserts
accumulate and list_components reflects them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the part or sub-assembly to insert. |
required |
x
|
float
|
X position in millimetres. Defaults to 0.0. |
0.0
|
y
|
float
|
Y position in millimetres. Defaults to 0.0. |
0.0
|
z
|
float
|
Z position in millimetres. Defaults to 0.0. |
0.0
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
is_connected ¶
Check if mock connection is active.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if connected, otherwise False. |
list_components
async
¶
Mock listing the top-level components of the active assembly.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[str]]
|
AdapterResult[list[str]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
list_configurations
async
¶
Mock configuration listing for the active model.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[str]]
|
AdapterResult[list[str]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
list_drawing_views
async
¶
Mock listing the views on the active drawing.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[str]]
|
AdapterResult[list[str]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
list_features
async
¶
list_features(include_suppressed: bool = False, max_assembly_depth: int = 2) -> AdapterResult[list[dict[str, Any]]]
Mock feature tree listing for the active model.
For an Assembly model, flattens in every configured component's
features (see _assembly_components) alongside the document's own
features, tagged with component/component_path the same way
the real adapter does. Falls back to a small canned two-component
fixture (plus one nested sub-assembly) when no components have been
configured, mirroring the existing "seed realistic feature names"
behavior for an empty Part.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include_suppressed
|
bool
|
The include suppressed value. Defaults to False. |
False
|
max_assembly_depth
|
int
|
Sub-assembly recursion budget. Ignored for non-Assembly models. Defaults to 2. |
2
|
Returns:
| Type | Description |
|---|---|
AdapterResult[list[dict[str, Any]]]
|
AdapterResult[list[dict[str, Any]]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 | |
list_open_documents
async
¶
Mock enumerating the currently open documents.
Returns every model the mock has created or opened this session, with
is_active reflecting self._current_model.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[dict[str, Any]]]
|
AdapterResult[list[dict[str, Any]]]: The result produced by the |
AdapterResult[list[dict[str, Any]]]
|
operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
mirror_feature
async
¶
mirror_feature(features: list[str], mirror_plane: str, merge: bool = True, mirror_bodies: bool = True) -> AdapterResult[dict[str, Any]]
Mock mirroring solid bodies or features about a plane.
The mock has no geometry engine, so it cannot measure a real volume
change - it mirrors the live adapter's refusals instead of
fabricating a result it cannot know. An empty source list or plane
name is rejected outright (matching _mirror_feature_impl in
solidworks/features.py verbatim), and a source or plane name
that was never created in this session is rejected the same way
_select_named_feature / _select_reference_entity would fail
to select it there.
On success, the tracked self._mirror_volume figure (seeded at
the live-measured 1819569.1 mm^3 wing volume) is doubled, matching
the ~2.0 ratio a correct mirror produces (measured live: 1.998528
for a lofted wing, exactly 2.0 for a boss whose sketch sits on the
plane).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
list[str]
|
Body or feature names to mirror. |
required |
mirror_plane
|
str
|
Plane name to mirror about. |
required |
merge
|
bool
|
Merge the mirrored result with the original. Defaults to True. |
True
|
mirror_bodies
|
bool
|
Mirror whole bodies rather than features. Defaults to True. |
True
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The mirror feature's name, inputs |
AdapterResult[dict[str, Any]]
|
and volume before/after, or error. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 | |
open_model
async
¶
Mock opening a SolidWorks model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the target file. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: The result produced by the operation. |
Raises:
| Type | Description |
|---|---|
SolidWorksOperationError
|
Simulated adapter failure. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
pack_and_go_assembly
async
¶
Mock Pack-and-Go: simulate copying an assembly to a target directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_path
|
str
|
Path to the source .sldasm file. |
required |
target_dir
|
str
|
Directory to copy files into. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict]
|
AdapterResult[dict]: Simulated pack-and-go result. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
pattern_circular
async
¶
pattern_circular(features: list[str], axis: str, count: int, angle: float = 360.0, equal_spacing: bool = True) -> AdapterResult[dict[str, Any]]
Mock patterning features around an axis.
The mock has no geometry engine, so it cannot measure a real volume
change - it mirrors the live adapter's refusals instead of
fabricating a result it cannot know (matching
_pattern_circular_impl in solidworks/features.py verbatim
for the three argument checks below). An axis name that was never
created via create_axis in this session is rejected the same
way SelectByID2 would fail to select it there.
On success, the tracked self._pattern_volume figure (seeded at
the live-measured 48431.5 mm^3 hub+blade volume) grows by
_PATTERN_BLADE_VOLUME * (count - 1), the live-derived
per-instance volume, so volume_before/volume_after/volume_ratio
stay self-consistent and scale with count roughly the way
adding more blades to the hub would - reproducing the live
48431.5 -> 75916.4 mm^3 measurement exactly for count=4.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
list[str]
|
Names of the features to pattern. |
required |
axis
|
str
|
Name of the axis to rotate about. |
required |
count
|
int
|
Total number of instances including the original. |
required |
angle
|
float
|
Total angle in degrees to spread them over. Defaults to 360.0. |
360.0
|
equal_spacing
|
bool
|
Space instances evenly across |
True
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The pattern's name, inputs and |
AdapterResult[dict[str, Any]]
|
volume before/after, or error. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 | |
rename_feature
async
¶
Mock renaming a named feature in the active model.
Mirrors the real adapter: an empty target name, an unknown feature, or a target name already in use are all errors; renaming to the current name is a no-op success.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
old_name
|
str
|
Current feature name. |
required |
new_name
|
str
|
New feature name. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 | |
save_body_as_part
async
¶
Mock extracting a solid body from the active part to a new file.
The mock has no bodies, so it cannot validate body_name against
real geometry - it mirrors the live adapter's other refusals (no
model, not a part, blank arguments, missing parent directory) and, on
a valid request, writes an empty placeholder file so callers and
tests can observe the side effect.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body_name
|
str
|
Name of a solid body in the active part. |
required |
file_path
|
str
|
Absolute path for the new |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The body, the written path, and a |
AdapterResult[dict[str, Any]]
|
single-element body list, or an error. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 | |
save_file
async
¶
Legacy compatibility save operation for tests.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str | None
|
Path to the target file. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
select_feature
async
¶
Mock feature selection/highlight — succeeds without COM side-effects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature_name
|
str
|
The feature name value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
set_dimension
async
¶
Mock setting a dimension value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name value. |
required |
value
|
float
|
The value value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[None]
|
AdapterResult[None]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
set_units
async
¶
Mock setting the active document's linear unit system.
Mirrors the real adapter: an unrecognised token is an error, and the
applied token is recorded on the current model's properties.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unit_system
|
str
|
One of |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
sketch_circular_pattern
async
¶
Mock creating a circular sketch pattern around the sketch origin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entities
|
list[str]
|
Seed entity IDs. |
required |
angle
|
float
|
Total swept angle in degrees. |
required |
count
|
int
|
Total number of instances (including the seed). |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
sketch_linear_pattern
async
¶
sketch_linear_pattern(entities: list[str], direction_x: float, direction_y: float, spacing: float, count: int) -> AdapterResult[str]
Mock creating a linear sketch pattern.
Mirrors the real adapter's validation rules — empty entities, count < 2, non-positive spacing, and a zero direction vector each produce a clear error without "creating" a pattern.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entities
|
list[str]
|
Seed entity IDs. |
required |
direction_x
|
float
|
Pattern direction X component. |
required |
direction_y
|
float
|
Pattern direction Y component. |
required |
spacing
|
float
|
Distance between instances in millimetres. |
required |
count
|
int
|
Total number of instances (including the seed). |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 | |
sketch_mirror
async
¶
Mock mirroring sketch entities about a centerline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entities
|
list[str]
|
IDs of segments to mirror. |
required |
mirror_line
|
str
|
ID of the centerline to mirror across. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 | |
sketch_offset
async
¶
sketch_offset(entities: list[str], offset_distance: float, reverse_direction: bool) -> AdapterResult[str]
Mock offsetting sketch entities by a fixed distance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entities
|
list[str]
|
IDs of segments to offset. |
required |
offset_distance
|
float
|
Distance in millimetres. Must be > 0. |
required |
reverse_direction
|
bool
|
Flip the offset direction. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
suppress_feature
async
¶
Mock suppressing or unsuppressing a named feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Feature name. |
required |
suppress
|
bool
|
True to suppress, False to unsuppress. |
True
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
undo
async
¶
Mock undoing the last operations in the active model.
Removes the most recently added features, mirroring what an undo of
feature-creation steps does to the tree. tree_changed is False
when there was nothing left to undo, which is what the real adapter
reports too - SolidWorks accepts an undo on an empty stack quietly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
count
|
int
|
Number of steps to undo. |
1
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/mock_adapter.py
PyWin32Adapter ¶
Bases: SolidWorksSketchMixin, SolidWorksFeaturesMixin, SolidWorksIOMixin, SolidWorksSelectionMixin, SolidWorksAdapter
SolidWorks adapter using pywin32 COM integration.
This adapter provides direct COM integration with SolidWorks using pywin32, enabling real-time automation and control of SolidWorks applications on Windows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict[str, Any] | None
|
Configuration values for the operation. Defaults to None. |
None
|
Raises:
| Type | Description |
|---|---|
SolidWorksMCPError
|
PyWin32Adapter requires Windows platform. |
Attributes:
| Name | Type | Description |
|---|---|---|
constants |
Any
|
The constants value. |
Example
Initialize PyWin32Adapter with configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict[str, Any] | None
|
Configuration values for the operation. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Raises:
| Type | Description |
|---|---|
SolidWorksMCPError
|
PyWin32Adapter requires Windows platform. |
Example
Source code in src/solidworks_mcp/adapters/pywin32_adapter.py
1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 | |
Methods:¶
connect
async
¶
Connect to SolidWorks COM and prepare automation-safe session state.
Raises:
| Type | Description |
|---|---|
SolidWorksMCPError
|
If connection or readiness checks fail. |
Source code in src/solidworks_mcp/adapters/pywin32_adapter.py
disconnect
async
¶
Disconnect from SolidWorks application.
Properly disconnects from SolidWorks COM interface and cleans up resources. This method should always be called when finished to prevent memory leaks.
Note: - Clears references to current model and application - Uninitialize COM apartment - Does not close SolidWorks application itself
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/adapters/pywin32_adapter.py
execute_macro
async
¶
Provide execute macro support for the py win32 adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
dict[str, Any]
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Raises:
| Type | Description |
|---|---|
SolidWorksMCPError
|
If the operation cannot be completed. |
Source code in src/solidworks_mcp/adapters/pywin32_adapter.py
export_file
async
¶
Export the current model to a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the target file. |
required |
format_type
|
str
|
The format type value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[None]
|
AdapterResult[None]: The result produced by the operation. |
Raises:
| Type | Description |
|---|---|
Exception
|
If the operation cannot be completed. |
RuntimeError
|
No active SolidWorks document for export. |
Source code in src/solidworks_mcp/adapters/pywin32_adapter.py
2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 | |
export_image
async
¶
Export a screenshot of the current model to a PNG/JPG file.
Payload keys (matching ExportImageInput): file_path (str): Output path including extension. format_type (str): "png" or "jpg". Default "png". width (int): Pixel width. Default 1280. height (int): Pixel height. Default 720. view_orientation (str): "front" | "top" | "right" | "isometric" | "current".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
dict
|
The payload value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict]
|
AdapterResult[dict]: The result produced by the operation. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the operation cannot be completed. |
Source code in src/solidworks_mcp/adapters/pywin32_adapter.py
2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 | |
health_check
async
¶
Get adapter health status.
Performs comprehensive health check including connection status, operation metrics, and SolidWorks application responsiveness.
Returns:
| Name | Type | Description |
|---|---|---|
AdapterHealth |
AdapterHealth
|
The result produced by the operation. |
Example
Source code in src/solidworks_mcp/adapters/pywin32_adapter.py
is_connected ¶
Check if connected to SolidWorks.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if connected, otherwise False. |
Example
Source code in src/solidworks_mcp/adapters/pywin32_adapter.py
RoutingDecision ¶
Bases: BaseModel
Complexity-based routing decision.
Attributes:
| Name | Type | Description |
|---|---|---|
complexity_score |
float
|
The complexity score value. |
operation |
str
|
The operation value. |
parameter_count |
int
|
The parameter count value. |
prefer_vba |
bool
|
The prefer vba value. |
reason |
str
|
The reason value. |
SolidWorksAdapter ¶
Bases: ABC
Base adapter interface for SolidWorks integration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
object | None
|
Configuration values for the operation. Defaults to None. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
_metrics |
Any
|
The metrics value. |
config |
Any
|
The config value. |
config_dict |
Any
|
The config dict value. |
Initialize adapter with configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
object | None
|
Configuration values for the operation. Defaults to None. |
None
|
Source code in src/solidworks_mcp/adapters/base.py
Methods:¶
activate_document
async
¶
Make an already-open document the active one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title_or_path
|
str
|
Title, full path, or file name of an open document. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: What was activated, or error. |
Source code in src/solidworks_mcp/adapters/base.py
add_arc
async
¶
add_arc(center_x: float, center_y: float, start_x: float, start_y: float, end_x: float, end_y: float) -> AdapterResult[str]
Add an arc to the current sketch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
center_x
|
float
|
The center x value. |
required |
center_y
|
float
|
The center y value. |
required |
start_x
|
float
|
The start x value. |
required |
start_y
|
float
|
The start y value. |
required |
end_x
|
float
|
The end x value. |
required |
end_y
|
float
|
The end y value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
add_centerline
async
¶
Add a centerline to the current sketch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
float
|
The x1 value. |
required |
y1
|
float
|
The y1 value. |
required |
x2
|
float
|
The x2 value. |
required |
y2
|
float
|
The y2 value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
add_chamfer
async
¶
Add an equal-distance chamfer feature to selected edges.
Chamfers the selected edges of the current solid body by the given distance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
distance
|
float
|
Chamfer distance in millimeters. |
required |
edge_names
|
list[str]
|
List of edge names to chamfer. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
AdapterResult |
AdapterResult[Any]
|
Feature result or error. |
Source code in src/solidworks_mcp/adapters/base.py
add_circle
abstractmethod
async
¶
Add a circle to the current sketch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
center_x
|
float
|
The center x value. |
required |
center_y
|
float
|
The center y value. |
required |
radius
|
float
|
The radius value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
add_drawing_view
async
¶
Add a view of a model to the active drawing sheet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
Any
|
Tool payload carrying the model path, orientation, position in millimetres and optional view scale. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The new view's details, or error. |
Source code in src/solidworks_mcp/adapters/base.py
add_ellipse
async
¶
add_ellipse(center_x: float, center_y: float, major_axis: float, minor_axis: float) -> AdapterResult[str]
Add an ellipse to the current sketch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
center_x
|
float
|
The center x value. |
required |
center_y
|
float
|
The center y value. |
required |
major_axis
|
float
|
The major axis value. |
required |
minor_axis
|
float
|
The minor axis value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
add_fillet
async
¶
Add a fillet feature to selected edges.
Rounds the selected edges of the current solid body with the given radius.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius
|
float
|
Fillet radius in millimeters. |
required |
edge_names
|
list[str]
|
List of edge names to fillet. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
AdapterResult |
AdapterResult[Any]
|
Feature result or error. |
Source code in src/solidworks_mcp/adapters/base.py
add_line
abstractmethod
async
¶
Add a line to the current sketch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
float
|
The x1 value. |
required |
y1
|
float
|
The y1 value. |
required |
x2
|
float
|
The x2 value. |
required |
y2
|
float
|
The y2 value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
add_mate
async
¶
add_mate(component_a: str, component_b: str, entity_a: str = 'Front Plane', entity_b: str = 'Front Plane', mate_type: str = 'coincident', alignment: str = 'aligned', distance: float = 0.0, angle: float = 0.0) -> AdapterResult[dict[str, Any]]
Mate two components together in the active assembly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component_a
|
str
|
First component instance name. |
required |
component_b
|
str
|
Second component instance name. |
required |
entity_a
|
str
|
Named feature on the first component. Defaults to "Front Plane". |
'Front Plane'
|
entity_b
|
str
|
Named feature on the second component. Defaults to "Front Plane". |
'Front Plane'
|
mate_type
|
str
|
Mate type, e.g. |
'coincident'
|
alignment
|
str
|
|
'aligned'
|
distance
|
float
|
Distance in millimetres, for a distance mate. Defaults to 0.0. |
0.0
|
angle
|
float
|
Angle in degrees, for an angle mate. Defaults to 0.0. |
0.0
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Mate details, or error. |
Source code in src/solidworks_mcp/adapters/base.py
add_note
async
¶
Place a text note on the active drawing sheet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
Any
|
Tool payload carrying the note text, its position in millimetres and an optional font size in points. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The note's details, or error. |
Source code in src/solidworks_mcp/adapters/base.py
add_polygon
async
¶
Add a regular polygon to the current sketch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
center_x
|
float
|
The center x value. |
required |
center_y
|
float
|
The center y value. |
required |
radius
|
float
|
The radius value. |
required |
sides
|
int
|
The sides value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
add_rectangle
abstractmethod
async
¶
Add a rectangle to the current sketch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
float
|
The x1 value. |
required |
y1
|
float
|
The y1 value. |
required |
x2
|
float
|
The x2 value. |
required |
y2
|
float
|
The y2 value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
add_sketch_circle
async
¶
add_sketch_circle(center_x: float, center_y: float, radius: float, construction: bool = False) -> AdapterResult[str]
Alias for add_circle used by some tool flows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
center_x
|
float
|
The center x value. |
required |
center_y
|
float
|
The center y value. |
required |
radius
|
float
|
The radius value. |
required |
construction
|
bool
|
The construction value. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
add_sketch_constraint
async
¶
add_sketch_constraint(entity1: str, entity2: str | None, relation_type: str, entity3: str | None = None) -> AdapterResult[str]
Apply a geometric constraint between sketch entities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity1
|
str
|
The entity1 value. |
required |
entity2
|
str | None
|
The entity2 value. |
required |
relation_type
|
str
|
The relation type value. |
required |
entity3
|
str | None
|
Third entity ID — only used by the
|
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
add_sketch_dimension
async
¶
add_sketch_dimension(entity1: str, entity2: str | None, dimension_type: str, value: float) -> AdapterResult[str]
Add a sketch dimension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity1
|
str
|
The entity1 value. |
required |
entity2
|
str | None
|
The entity2 value. |
required |
dimension_type
|
str
|
The dimension type value. |
required |
value
|
float
|
The value value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
add_spline
async
¶
Add a spline through the provided points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
list[dict[str, float]]
|
The points value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
auto_center_marks
async
¶
auto_center_marks(view_name: str, mark_holes: bool = True, mark_fillets: bool = False, mark_slots: bool = True) -> AdapterResult[dict[str, Any]]
Auto-insert centre marks on circular features in a drawing view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_name
|
str
|
Name of a view on the active drawing. |
required |
mark_holes
|
bool
|
Mark holes / bores. |
True
|
mark_fillets
|
bool
|
Mark fillets. |
False
|
mark_slots
|
bool
|
Mark slots. |
True
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The view and before/after centre-mark |
AdapterResult[dict[str, Any]]
|
counts, or error. |
Source code in src/solidworks_mcp/adapters/base.py
check_interference
async
¶
Check the active assembly for interfering components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Any
|
Optional settings; |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Interference details, or error. |
Source code in src/solidworks_mcp/adapters/base.py
check_sketch_fully_defined
async
¶
Check whether a sketch is fully defined.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sketch_name
|
str | None
|
Optional sketch name to inspect. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Definition status payload. |
Source code in src/solidworks_mcp/adapters/base.py
close_model
abstractmethod
async
¶
Close the current model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
save
|
bool
|
The save value. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[None]
|
AdapterResult[None]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
connect
abstractmethod
async
¶
create_assembly
abstractmethod
async
¶
Create a new assembly document.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
create_axis
async
¶
Create a reference axis along a principal direction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference
|
str
|
"x", "y" or "z" (case-insensitive, leading ± stripped). |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The plane pair used and feature counts, or error. |
Source code in src/solidworks_mcp/adapters/base.py
create_cut
async
¶
Create a cut feature from an existing sketch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sketch_name
|
str
|
The sketch name value. |
required |
depth
|
float
|
The depth value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
create_cut_extrude
async
¶
Create a cut-extrude feature from the active sketch.
Cuts material from the current solid body using the active sketch profile. Equivalent to SolidWorks Insert > Cut > Extrude.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
ExtrusionParameters
|
Depth and direction parameters. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
AdapterResult |
AdapterResult[Any]
|
Feature result or error. |
Source code in src/solidworks_mcp/adapters/base.py
create_drawing
abstractmethod
async
¶
Create a new drawing document.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
create_drawing_view
async
¶
Place a view of a model on the active drawing sheet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
Any
|
Tool payload carrying the model path, orientation, position in millimetres and optional view scale. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The new view's details, or error. |
Source code in src/solidworks_mcp/adapters/base.py
create_extrusion
abstractmethod
async
¶
Create an extrusion feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
ExtrusionParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksFeature]
|
AdapterResult[SolidWorksFeature]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
create_loft
abstractmethod
async
¶
Create a loft feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
LoftParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksFeature]
|
AdapterResult[SolidWorksFeature]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
create_part
abstractmethod
async
¶
Create a new part document.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name value. Defaults to None. |
None
|
units
|
str | None
|
The units value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
create_reference_plane
async
¶
create_reference_plane(reference: str, offset: float = 0.0, angle: float = 0.0, flip: bool = False) -> AdapterResult[dict[str, Any]]
Create a reference plane offset from, or angled to, an existing plane.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference
|
str
|
Name of the reference plane or planar face. |
required |
offset
|
float
|
Offset distance in millimetres. Defaults to 0.0. |
0.0
|
angle
|
float
|
Angle in degrees. Defaults to 0.0. |
0.0
|
flip
|
bool
|
Reverse the offset or angle direction. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The new plane's name and parameters, or error. |
Source code in src/solidworks_mcp/adapters/base.py
create_reference_point
async
¶
create_reference_point(mode: str, x: float, y: float, z: float, distance: float | None = None, percent: float | None = None) -> AdapterResult[dict[str, Any]]
Create a reference point on the active part.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mode
|
str
|
"along_curve" or "face_center". |
required |
x
|
float
|
X of a point on the target edge/face, in millimetres. |
required |
y
|
float
|
Y of a point on the target edge/face, in millimetres. |
required |
z
|
float
|
Z of a point on the target edge/face, in millimetres. |
required |
distance
|
float | None
|
For "along_curve", offset from the edge start in millimetres. |
None
|
percent
|
float | None
|
For "along_curve", position as 0-100 of the edge length. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The mode and feature counts, or error. |
Source code in src/solidworks_mcp/adapters/base.py
create_revolve
abstractmethod
async
¶
Create a revolve feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
RevolveParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksFeature]
|
AdapterResult[SolidWorksFeature]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
create_sketch
abstractmethod
async
¶
Create a new sketch on the specified plane.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plane
|
str
|
The plane value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
create_sweep
abstractmethod
async
¶
Create a sweep feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
SweepParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksFeature]
|
AdapterResult[SolidWorksFeature]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
create_technical_drawing
async
¶
Lay out the standard views of a model on the active sheet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
Any
|
Tool payload carrying the model path and the projection angle. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The view names created, or error. |
Source code in src/solidworks_mcp/adapters/base.py
delete_feature
async
¶
Delete a named feature or sketch from the active model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Feature or sketch name. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: What was deleted, or error. |
Source code in src/solidworks_mcp/adapters/base.py
disconnect
abstractmethod
async
¶
exit_sketch
abstractmethod
async
¶
Exit sketch editing mode.
Returns:
| Type | Description |
|---|---|
AdapterResult[None]
|
AdapterResult[None]: The result produced by the operation. |
export_file
abstractmethod
async
¶
Export the current model to a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the target file. |
required |
format_type
|
str
|
The format type value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[None]
|
AdapterResult[None]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
export_image
abstractmethod
async
¶
Export a viewport screenshot (PNG/JPG) of the current model.
Payload keys: file_path (str): Absolute output path. width (int): Image width in pixels. height (int): Image height in pixels. view_orientation (str): One of "isometric", "front", "top", "right", "back", "bottom", "current".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
dict
|
The payload value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict]
|
AdapterResult[dict]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
get_dimension
abstractmethod
async
¶
Get the value of a dimension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[float]
|
AdapterResult[float]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
get_mass_properties
abstractmethod
async
¶
Get mass properties of the current model.
Returns:
| Type | Description |
|---|---|
AdapterResult[MassProperties]
|
AdapterResult[MassProperties]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
get_metrics ¶
Get adapter metrics.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: A dictionary containing the resulting values. |
get_model_info
abstractmethod
async
¶
Get metadata for the active model.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
health_check
abstractmethod
async
¶
Get adapter health status.
Returns:
| Name | Type | Description |
|---|---|---|
AdapterHealth |
AdapterHealth
|
The result produced by the operation. |
insert_component
async
¶
insert_component(file_path: str, x: float = 0.0, y: float = 0.0, z: float = 0.0) -> AdapterResult[dict[str, Any]]
Insert a part or sub-assembly into the active assembly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Absolute path to the |
required |
x
|
float
|
X position in millimetres. Defaults to 0.0. |
0.0
|
y
|
float
|
Y position in millimetres. Defaults to 0.0. |
0.0
|
z
|
float
|
Z position in millimetres. Defaults to 0.0. |
0.0
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Component name and counts, or error. |
Source code in src/solidworks_mcp/adapters/base.py
is_connected
abstractmethod
¶
Check if connected to SolidWorks.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if connected, otherwise False. |
list_components
async
¶
List the top-level components of the active assembly.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[str]]
|
AdapterResult[list[str]]: Component instance names, or error. |
Source code in src/solidworks_mcp/adapters/base.py
list_configurations
abstractmethod
async
¶
List configuration names for the active model.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[str]]
|
AdapterResult[list[str]]: The result produced by the operation. |
list_drawing_views
async
¶
List the views on the active drawing.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[str]]
|
AdapterResult[list[str]]: View names, or error. |
Source code in src/solidworks_mcp/adapters/base.py
list_features
abstractmethod
async
¶
list_features(include_suppressed: bool = False, max_assembly_depth: int = 2) -> AdapterResult[list[dict[str, Any]]]
List model features from the feature tree.
For a Part document, returns that document's own feature list,
unchanged from prior behavior. For an Assembly document, returns a
single flat list containing the assembly's own top-level features
plus every resolved component's features, recursing into
sub-assemblies up to max_assembly_depth. Every descriptor gains
component, component_path, and component_parent keys:
None for a document's own features (Part features, or an Assembly's
top-level features), or the owning component's name/path for a
component-derived feature. component_parent is the immediate parent
component name when the component is nested inside a sub-assembly,
otherwise None. A component that cannot be resolved (suppressed,
lightweight-and-unloaded, missing file) is represented by one descriptor
with type: "UnresolvedComponent" instead of being silently dropped.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include_suppressed
|
bool
|
The include suppressed value. Defaults to False. Applied independently to the assembly's own features and to each component's features. |
False
|
max_assembly_depth
|
int
|
How many levels of sub-assembly to recurse into. Defaults to 2. Ignored for Part documents. A component beyond the configured depth still appears in the result as a single descriptor (name + path), not expanded. |
2
|
Returns:
| Type | Description |
|---|---|
AdapterResult[list[dict[str, Any]]]
|
AdapterResult[list[dict[str, Any]]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
list_open_documents
async
¶
Enumerate every document currently open in SolidWorks.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[dict[str, Any]]]
|
AdapterResult[list[dict[str, Any]]]: One entry per open document |
AdapterResult[list[dict[str, Any]]]
|
( |
Source code in src/solidworks_mcp/adapters/base.py
mirror_feature
async
¶
mirror_feature(features: list[str], mirror_plane: str, merge: bool = True, mirror_bodies: bool = True) -> AdapterResult[dict[str, Any]]
Mirror solid bodies or features about a plane.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
list[str]
|
Body or feature names to mirror. |
required |
mirror_plane
|
str
|
Plane name to mirror about. |
required |
merge
|
bool
|
Merge the mirrored result with the original. Defaults to True. |
True
|
mirror_bodies
|
bool
|
Mirror whole bodies rather than features. Defaults to True. |
True
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The mirror feature's name, inputs and volume |
AdapterResult[dict[str, Any]]
|
before/after, or error. |
Source code in src/solidworks_mcp/adapters/base.py
open_model
abstractmethod
async
¶
Open a SolidWorks model (part, assembly, or drawing).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the target file. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
pattern_circular
async
¶
pattern_circular(features: list[str], axis: str, count: int, angle: float = 360.0, equal_spacing: bool = True) -> AdapterResult[dict[str, Any]]
Pattern features around an axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
list[str]
|
Names of the features to pattern. |
required |
axis
|
str
|
Name of the axis to rotate about. |
required |
count
|
int
|
Total number of instances including the original. |
required |
angle
|
float
|
Total angle in degrees to spread them over. Defaults to 360.0. |
360.0
|
equal_spacing
|
bool
|
Space instances evenly across |
True
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: What was patterned and the volume |
AdapterResult[dict[str, Any]]
|
before/after, or error. |
Source code in src/solidworks_mcp/adapters/base.py
rename_feature
async
¶
Rename an existing feature on the feature tree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
old_name
|
str
|
Current feature name. |
required |
new_name
|
str
|
New feature name. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The old and new names, or error. |
Source code in src/solidworks_mcp/adapters/base.py
save_body_as_part
async
¶
Extract one solid body from the active multibody part to a new file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body_name
|
str
|
Name of a solid body in the active part. |
required |
file_path
|
str
|
Absolute path for the new |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The body, the written path, and the |
AdapterResult[dict[str, Any]]
|
solid-body names found, or error. |
Source code in src/solidworks_mcp/adapters/base.py
save_file
async
¶
Save the active model to the existing path or the provided path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str | None
|
Path to the target file. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[Any]
|
AdapterResult[Any]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
set_dimension
abstractmethod
async
¶
Set the value of a dimension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name value. |
required |
value
|
float
|
The value value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[None]
|
AdapterResult[None]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
set_units
async
¶
Set the active document's linear unit system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unit_system
|
str
|
One of |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: What was applied, or error. |
Source code in src/solidworks_mcp/adapters/base.py
sketch_circular_pattern
async
¶
Create a circular pattern of sketch entities around the sketch origin.
The rotation axis is always the sketch origin — SW's
CreateCircularSketchStepAndRepeat has no pattern-centre
parameter and derives the axis from the seed's geometry. Place
the seed entity at the desired radius from the origin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entities
|
list[str]
|
The entities value. |
required |
angle
|
float
|
The angle value. |
required |
count
|
int
|
The count value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
sketch_linear_pattern
async
¶
sketch_linear_pattern(entities: list[str], direction_x: float, direction_y: float, spacing: float, count: int) -> AdapterResult[str]
Create a linear pattern of sketch entities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entities
|
list[str]
|
The entities value. |
required |
direction_x
|
float
|
The direction x value. |
required |
direction_y
|
float
|
The direction y value. |
required |
spacing
|
float
|
The spacing value. |
required |
count
|
int
|
The count value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
sketch_mirror
async
¶
Mirror sketch entities about a mirror line.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entities
|
list[str]
|
The entities value. |
required |
mirror_line
|
str
|
The mirror line value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
sketch_offset
async
¶
sketch_offset(entities: list[str], offset_distance: float, reverse_direction: bool) -> AdapterResult[str]
Offset sketch entities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entities
|
list[str]
|
The entities value. |
required |
offset_distance
|
float
|
The offset distance value. |
required |
reverse_direction
|
bool
|
The reverse direction value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
suppress_feature
async
¶
Suppress or unsuppress a named feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Feature name. |
required |
suppress
|
bool
|
True to suppress, False to unsuppress. |
True
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The resulting state, or error. |
Source code in src/solidworks_mcp/adapters/base.py
undo
async
¶
Undo the last operations in the active model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
count
|
int
|
Number of steps to undo. |
1
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Whether the tree changed, or error. |
Source code in src/solidworks_mcp/adapters/base.py
update_metrics ¶
Update adapter metrics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
operation_time
|
float
|
The operation time value. |
required |
success
|
bool
|
The success value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/adapters/base.py
VbaGeneratorAdapter ¶
Adapter that executes complex operations through VBA-oriented flow.
This adapter currently uses the wrapped COM adapter for final execution, but annotates responses as VBA-routed and can be extended to execute generated macros directly in future iterations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
backing_adapter
|
Any
|
The backing adapter value. |
required |
macro_executor
|
VbaMacroExecutor | None
|
The macro executor value. Defaults to None. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
_backing_adapter |
Any
|
The backing adapter value. |
_macro_executor |
Any
|
The macro executor value. |
config |
Any
|
The config value. |
Initialize the vba generator adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
backing_adapter
|
Any
|
The backing adapter value. |
required |
macro_executor
|
VbaMacroExecutor | None
|
The macro executor value. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/adapters/vba_adapter.py
Methods:¶
__getattr__ ¶
Delegate unknown members to backing adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
item
|
str
|
The item value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/vba_adapter.py
connect
async
¶
Connect to SolidWorks using wrapped adapter.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
create_extrusion
async
¶
Create the extrusion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
ExtrusionParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[Any]
|
AdapterResult[Any]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/vba_adapter.py
create_loft
async
¶
Create the loft.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
LoftParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[Any]
|
AdapterResult[Any]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/vba_adapter.py
create_revolve
async
¶
Create the revolve.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
RevolveParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[Any]
|
AdapterResult[Any]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/vba_adapter.py
create_sweep
async
¶
Create the sweep.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
SweepParameters
|
The params value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[Any]
|
AdapterResult[Any]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/vba_adapter.py
disconnect
async
¶
execute_macro
async
¶
execute_macro(macro_code: str, macro_name: str = 'GeneratedMacro', subroutine: str = 'Main') -> AdapterResult[Any]
Provide execute macro support for the vba generator adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
macro_code
|
str
|
The macro code value. |
required |
macro_name
|
str
|
The macro name value. Defaults to "GeneratedMacro". |
'GeneratedMacro'
|
subroutine
|
str
|
The subroutine value. Defaults to "Main". |
'Main'
|
Returns:
| Type | Description |
|---|---|
AdapterResult[Any]
|
AdapterResult[Any]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/vba_adapter.py
get_macro_execution_history ¶
Retrieve VBA macro execution history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
macro_name
|
str | None
|
The macro name value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[ str, Any, |
dict[str, Any]
|
]: A dictionary containing the resulting values. |
Source code in src/solidworks_mcp/adapters/vba_adapter.py
health_check
async
¶
Return wrapped adapter health with VBA route marker.
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/vba_adapter.py
is_connected ¶
Return wrapped adapter connection state.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if connected, otherwise False. |
VbaMacroExecutor ¶
Manage VBA macro execution with save and tracking.
This executor handles the full lifecycle: code generation, on-disk persistence, execution via the backing adapter, and result tracking.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
temp_macro_dir
|
Path | None
|
The temp macro dir value. Defaults to None. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
_temp_macro_dir |
Any
|
The temp macro dir value. |
Initialize macro executor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
temp_macro_dir
|
Path | None
|
The temp macro dir value. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/adapters/vba_macro_executor.py
Methods:¶
execute_macro
async
¶
execute_macro(request: MacroExecutionRequest, backing_adapter: Any) -> AdapterResult[MacroExecutionResult]
Provide execute macro support for the vba macro executor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
MacroExecutionRequest
|
The request value. |
required |
backing_adapter
|
Any
|
The backing adapter value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[MacroExecutionResult]
|
AdapterResult[MacroExecutionResult]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/vba_macro_executor.py
get_execution_history ¶
Retrieve macro execution history.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
macro_name
|
str | None
|
The macro name value. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, MacroExecutionResult]
|
dict[ str, MacroExecutionResult, |
dict[str, MacroExecutionResult]
|
]: A dictionary containing the resulting values. |
Source code in src/solidworks_mcp/adapters/vba_macro_executor.py
Functions:¶
create_adapter
async
¶
Async factory function for creating SolidWorks adapters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
SolidWorksMCPConfig
|
Configuration values for the operation. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
SolidWorksAdapter |
SolidWorksAdapter
|
The result produced by the operation. |