solidworks_mcp.adapters.mock_drawing_pack¶
solidworks_mcp.adapters.mock_drawing_pack ¶
The mock adapter's drawing pack: the real adapter's refusals and replies.
Views get an outline on an A3 sheet, so positions, section lines and picks
are checked the way the real adapter checks them; the rules themselves come
from :mod:.solidworks.drawing_pack.
Attributes¶
PAPER_SIZES
module-attribute
¶
PAPER_SIZES: dict[str, tuple[int, float, float]] = {'a4': (6, 297.0, 210.0), 'a3': (8, 420.0, 297.0), 'a2': (9, 594.0, 420.0), 'a1': (10, 841.0, 594.0), 'a0': (11, 1189.0, 841.0)}
TITLE_BLOCK_FIELDS
module-attribute
¶
TITLE_BLOCK_FIELDS: dict[str, tuple[str, str]] = {'title': ('model', 'Description'), 'drawing_number': ('drawing', 'DrawingNo'), 'drawn_by': ('drawing', 'DrawnBy'), 'drawn_date': ('drawing', 'DrawnDate'), 'revision': ('drawing', 'Revision'), 'company': ('drawing', 'COMPANYNAME')}
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. |
MockDrawingPackMixin ¶
Section and detail views, dimensions, format, title block, report.
Methods:¶
add_dimension
async
¶
add_dimension(dimension_type: str, entity1_point: list[float], position: list[float], entity2_point: list[float] | None = None) -> AdapterResult[dict[str, Any]]
Mock dimension, measured between the points (fixed for circles).
Source code in src/solidworks_mcp/adapters/mock_drawing_pack.py
auto_dimension_view
async
¶
Mock auto-dimension: two more dimensions on the view.
Source code in src/solidworks_mcp/adapters/mock_drawing_pack.py
create_detail_view
async
¶
create_detail_view(view: str, center: list[float], radius: float, position: list[float], scale: str = '2:1', label: str | None = None) -> AdapterResult[dict[str, Any]]
Mock detail view: a new view named Detail View X (s:s).
Source code in src/solidworks_mcp/adapters/mock_drawing_pack.py
create_section_view
async
¶
create_section_view(view: str, line_start: list[float], line_end: list[float], position: list[float], label: str | None = None) -> AdapterResult[dict[str, Any]]
Mock section view: a new view named Section View X-X.
Source code in src/solidworks_mcp/adapters/mock_drawing_pack.py
drawing_report
async
¶
Mock report from the drawing's state.
Source code in src/solidworks_mcp/adapters/mock_drawing_pack.py
update_sheet_format
async
¶
update_sheet_format(sheet_format: str, paper_size: str | None = None) -> AdapterResult[dict[str, Any]]
Mock format change: a0 to a4 ISO or ANSI names exist.
Source code in src/solidworks_mcp/adapters/mock_drawing_pack.py
update_title_block
async
¶
Mock title block: the fields are kept for drawing_report.
Source code in src/solidworks_mcp/adapters/mock_drawing_pack.py
Functions:¶
_error ¶
_ok ¶
inside ¶
Whether point lies in box (edges included).
next_label ¶
The first letter no section or detail view uses yet ("A" when none).
Source code in src/solidworks_mcp/adapters/solidworks/drawing_pack.py
paper_for ¶
The paper size: given, else the format name's (a2 - iso -> a2).
Raises:
| Type | Description |
|---|---|
ValueError
|
When neither names one of :data: |
Source code in src/solidworks_mcp/adapters/solidworks/drawing_pack.py
parse_scale ¶
"3:1" -> (3.0, 1.0).
Raises:
| Type | Description |
|---|---|
ValueError
|
For anything but two positive numbers around a colon. |
Source code in src/solidworks_mcp/adapters/solidworks/drawing_pack.py
segment_crosses_box ¶
Whether the segment from start to end touches the box (Liang-Barsky).