solidworks_mcp.adapters.mock_templates¶
solidworks_mcp.adapters.mock_templates ¶
The mock adapter's templates: saved in memory, carried into new documents.
A template records the document's units, material and custom properties,
which is what a real template carries; create_part with that template
starts the new part with them, as SolidWorks' NewDocument does.
Attributes¶
TEMPLATE_EXTENSIONS
module-attribute
¶
_MOCK_TYPES
module-attribute
¶
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)
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. |
MockTemplatesMixin ¶
get_template_folders and save_as_template for the mock.
Methods:¶
get_template_folders
async
¶
The mock's template folders and the active document's extension.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
|
Source code in src/solidworks_mcp/adapters/mock_templates.py
save_as_template
async
¶
Record the active document's settings as a template at file_path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
The template's path, with the document's extension. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The same shape as the real adapter's. |
Source code in src/solidworks_mcp/adapters/mock_templates.py
Functions:¶
in_folders ¶
Whether path sits directly in one of folders.
Compared as Windows paths (case and separators ignored), on any OS.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
A file path. |
required |
folders
|
list[str]
|
Folder paths. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True when the file's folder is one of them. |