solidworks_mcp.adapters.connection_pool¶
solidworks_mcp.adapters.connection_pool ¶
Connection pool adapter for managing multiple SolidWorks connections.
Provides connection pooling capabilities to allow parallel SolidWorks operations when multiple instances are available.
Attributes¶
Classes¶
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. |
Functions¶
__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. |
AdapterResultStatus ¶
Bases: StrEnum
Result status for adapter operations.
Attributes:
| Name | Type | Description |
|---|---|---|
ERROR |
Any
|
The error value. |
SUCCESS |
Any
|
The success value. |
TIMEOUT |
Any
|
The timeout value. |
WARNING |
Any
|
The warning value. |
ConnectionPool ¶
ConnectionPool(create_connection: Callable[[], object | Awaitable[object]], max_size: int = 3, timeout: float = 30.0)
Legacy alias class expected by tests.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
create_connection
|
Callable[[], object | Awaitable[object]]
|
Factory callable used to create a connection. |
required |
max_size
|
int
|
Maximum number of items allowed in the pool. Defaults to 3. |
3
|
timeout
|
float
|
Maximum time to wait in seconds. Defaults to 30.0. |
30.0
|
Attributes:
| Name | Type | Description |
|---|---|---|
_create_connection |
Any
|
The create connection value. |
_max_size |
Any
|
The max size value. |
_timeout |
Any
|
The timeout value. |
Initialize the connection pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
create_connection
|
Callable[[], object | Awaitable[object]]
|
Factory callable used to create a connection. |
required |
max_size
|
int
|
Maximum number of items allowed in the pool. Defaults to 3. |
3
|
timeout
|
float
|
Maximum time to wait in seconds. Defaults to 30.0. |
30.0
|
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.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The computed numeric result. |
size
property
¶
Provide size support for the connection pool.
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The computed numeric result. |
Functions¶
acquire
async
¶
Provide acquire support for the connection pool.
Returns:
| Name | Type | Description |
|---|---|---|
object |
object
|
The result produced by the operation. |
Raises:
| Type | Description |
|---|---|
TimeoutError
|
No connection available within timeout. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
cleanup
async
¶
Provide cleanup support for the connection pool.
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/adapters/connection_pool.py
release
async
¶
Provide release support for the connection pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conn
|
object
|
The conn value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
None. |
Source code in src/solidworks_mcp/adapters/connection_pool.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. |
Functions¶
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
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_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_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_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_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
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_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_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_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
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
is_connected ¶
Check if pool is initialized.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if connected, otherwise False. |
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_features
async
¶
List model features using pool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include_suppressed
|
bool
|
The include suppressed value. Defaults to False. |
False
|
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
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
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
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
ExtrusionParameters ¶
Bases: BaseModel
Parameters for extrusion operations.
Attributes:
| Name | Type | Description |
|---|---|---|
auto_select |
bool
|
The auto select value. |
both_directions |
bool
|
The both directions value. |
depth |
float
|
The depth value. |
draft_angle |
float
|
The draft angle value. |
end_condition |
str
|
The end condition value. |
feature_scope |
bool
|
The feature scope value. |
merge_result |
bool
|
The merge result value. |
reverse_direction |
bool
|
The reverse direction value. |
thin_feature |
bool
|
The thin feature value. |
thin_thickness |
float | None
|
The thin thickness value. |
up_to_surface |
str | None
|
The up to surface value. |
LoftParameters ¶
Bases: BaseModel
Parameters for loft operations.
Attributes:
| Name | Type | Description |
|---|---|---|
end_tangent |
str | None
|
The end tangent value. |
guide_curves |
list[str] | None
|
The guide curves value. |
merge_result |
bool
|
The merge result value. |
profiles |
list[str]
|
The profiles value. |
start_tangent |
str | None
|
The start tangent value. |
MassProperties ¶
Bases: BaseModel
Mass properties information.
Attributes:
| Name | Type | Description |
|---|---|---|
center_of_mass |
list[float]
|
The center of mass value. |
mass |
float
|
The mass value. |
moments_of_inertia |
dict[str, float]
|
The moments of inertia value. |
principal_axes |
dict[str, list[float]] | None
|
The principal axes value. |
surface_area |
float
|
The surface area value. |
volume |
float
|
The volume value. |
RevolveParameters ¶
Bases: BaseModel
Parameters for revolve operations.
Attributes:
| Name | Type | Description |
|---|---|---|
angle |
float
|
The angle value. |
both_directions |
bool
|
The both directions value. |
merge_result |
bool
|
The merge result value. |
reverse_direction |
bool
|
The reverse direction value. |
thin_feature |
bool
|
The thin feature value. |
thin_thickness |
float | None
|
The thin thickness 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
Functions¶
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_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_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_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
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_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_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_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
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. |
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. |
is_connected
abstractmethod
¶
Check if connected to SolidWorks.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if connected, otherwise False. |
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_features
abstractmethod
async
¶
List model features from the feature tree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include_suppressed
|
bool
|
The include suppressed value. Defaults to False. |
False
|
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
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
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
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
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
SolidWorksFeature ¶
Bases: BaseModel
SolidWorks feature information.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str | None
|
The id value. |
name |
str
|
The name value. |
parameters |
dict[str, Any] | None
|
The parameters value. |
parent |
str | None
|
The parent value. |
properties |
dict[str, Any] | None
|
The properties value. |
type |
str
|
The type value. |
SolidWorksModel ¶
Bases: BaseModel
SolidWorks model information.
Attributes:
| Name | Type | Description |
|---|---|---|
configuration |
str | None
|
The configuration value. |
is_active |
bool
|
The is active value. |
name |
str
|
The name value. |
path |
str
|
The path value. |
properties |
dict[str, Any] | None
|
The properties value. |
type |
str
|
The type value. |
SweepParameters ¶
Bases: BaseModel
Parameters for sweep operations.
Attributes:
| Name | Type | Description |
|---|---|---|
merge_result |
bool
|
The merge result value. |
path |
str
|
The path value. |
twist_along_path |
bool
|
The twist along path value. |
twist_angle |
float
|
The twist angle value. |