solidworks_mcp.adapters.vba_adapter¶
solidworks_mcp.adapters.vba_adapter ¶
VBA adapter path for complex operations with generated macro metadata.
Classes¶
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. |
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. |
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. |
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. |
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. |
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
Functions¶
__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
Functions¶
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. |