solidworks_mcp.adapters.solidworks.drawing_standard¶
solidworks_mcp.adapters.solidworks.drawing_standard ¶
Standard A3 drawing generation for the PyWin32 adapter.
Implements an A3 ISO drafting standard on SolidWorks:
- Sheet - A3 landscape 420 x 297 mm with the SolidWorks
a3 - isosheet format (zoned border, ISO title block). Working area x 15-405, y 15-282 mm; the title block area x 218-412, y 8-72 mm is kept clear. - Title block - TITLE from the model's
Description, DWG NO. from the drawing file name (saved as the drawing number), MATERIAL / WEIGHT linked to the model's real material and mass, DRAWN by/date, revision and company from drawing properties; scale, sheet n of N and size are automatic. - Views - third-angle front, plan and side view plus an isometric, each in
its own cell, at the largest standard scale where the part, its dimension
rows and its caption fit (cells sized from the part, so it fills the sheet).
Each view gets a bold capital caption with its name, e.g.
FRONT VIEW. - Dimensions - imported from the model, each shown once, laid out in rows (first 8 mm out, rows 7 mm, columns 9 mm), trailing zeros removed.
- Notes - a NOTES block in its own cell (material, units, projection, plus caller lines).
- Title-block fields fit their boxes - the DWG NO. (the drawing's file
name) and TITLE notes of the sheet format are shrunk, down to 2 mm, until
they fill at most 90% of the room before the next field in their row; one
that still runs over is an overlap.
title_block_text_height_mmcaps their height for smaller text. - No overlap anywhere - checked against the real read-back geometry. The scale is chosen from measured views and reduced if placement does not fit; annotation overlaps are resolved by moving dimensions.
The drawing is built in separate COM steps (sheet, views, layout,
dimensions, notes, check), each through _handle_com_operation so each
gets its settle pause: one long burst of drawing calls is the pattern that
crashed SolidWorks 2026 in its idle-time refresh (COM pitfall #26).
Attributes¶
CAPTIONS
module-attribute
¶
CAPTIONS = {'front': 'FRONT VIEW', 'plan': 'TOP VIEW', 'side': 'SIDE VIEW', 'iso': 'ISOMETRIC VIEW'}
CELLS
module-attribute
¶
CELLS: dict[str, Box] = {'front': (0.015, 0.075, 0.215, 0.178), 'side': (0.215, 0.075, 0.405, 0.178), 'plan': (0.015, 0.178, 0.215, 0.282), 'iso': (0.215, 0.178, 0.405, 0.282), 'notes': (0.015, 0.015, 0.215, 0.075)}
FIELD_HINT
module-attribute
¶
FIELD_HINT = 'pass title_block_text_height_mm (e.g. 3) for smaller title-block text, or a shorter drawing_number or title'
OTHER_FIELD_NAMES
module-attribute
¶
OTHER_FIELD_NAMES = {'DrawnBy': 'drawn by', 'DrawnDate': 'drawn date', 'Revision': 'revision', 'COMPANYNAME': 'company'}
STANDARD_NOTES
module-attribute
¶
STANDARD_NOTES = ('ALL DIMENSIONS IN MILLIMETRES', 'THIRD ANGLE PROJECTION', 'REMOVE ALL BURRS AND SHARP EDGES')
STANDARD_SCALES
module-attribute
¶
STANDARD_SCALES: list[tuple[float, float]] = [(5, 1), (4, 1), (3, 1), (2.5, 1), (2, 1), (1.5, 1), (1, 1), (1, 2), (1, 2.5), (1, 4), (1, 5), (1, 7.5), (1, 10), (1, 12.5), (1, 15), (1, 20), (1, 25), (1, 30), (1, 40), (1, 50), (1, 60), (1, 75), (1, 100)]
TITLE_BLOCK_FIELDS
module-attribute
¶
_GTOL_MODIFIERS
module-attribute
¶
_GTOL_SYMBOLS
module-attribute
¶
_GTOL_SYMBOLS = {'position': '<IGTOL-POSI>', 'flatness': '<IGTOL-FLAT>', 'perpendicularity': '<IGTOL-PERP>', 'parallelism': '<IGTOL-PARA>', 'profile_surface': '<IGTOL-SPROF>', 'concentricity': '<IGTOL-CONC>'}
_LINKED_PROPERTY
module-attribute
¶
_SW_BOM_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. |
SolidWorksDrawingStandardMixin ¶
Create complete standard A3 drawings, BOM tables and the sheet scale.
Methods:¶
add_datum_tag
async
¶
add_datum_tag(label: str, attach_at_mm: tuple[float, float], x_mm: float, y_mm: float) -> AdapterResult[dict[str, Any]]
Add a datum feature symbol (a datum tag) on a drawing edge.
IModelDoc2::InsertDatumTag2 attaches the tag to the edge picked at
attach_at_mm; IDatumTag::SetLabel names it, and the label is
read back with GetLabel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The datum letter, e.g. |
required |
attach_at_mm
|
tuple[float, float]
|
A sheet point on the edge or face line it marks. |
required |
x_mm
|
float
|
Where the tag goes on the sheet. |
required |
y_mm
|
float
|
Where the tag goes on the sheet. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The label as read back. |
Source code in src/solidworks_mcp/adapters/solidworks/drawing_standard.py
add_gtol
async
¶
add_gtol(characteristic: str, tolerance: float, x_mm: float, y_mm: float, diameter_zone: bool = False, material_condition: str = 'none', datums: list[str] | None = None, attach_at_mm: tuple[float, float] | None = None, dimension: tuple[str, str] | None = None) -> AdapterResult[dict[str, Any]]
Add a feature control frame (GD&T) to the active drawing.
IModelDoc2::InsertGtol creates the frame on whatever is selected:
a drawing dimension (dimension; the frame sits under its text and
moves with it, the usual place for a hole's position tolerance), the
edge picked at attach_at_mm (with a leader), or nothing
(free-standing);
IGtol::SetFrameSymbols2 sets the characteristic, the Ø zone and
the material condition, and IGtol::SetFrameValues the tolerance
and datums. The values are read back with GetFrameValues, so a
frame SolidWorks did not fill in is an error, not a success.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
characteristic
|
str
|
|
required |
tolerance
|
float
|
The tolerance value, in drawing units. |
required |
x_mm
|
float
|
Where the frame goes on the sheet. |
required |
y_mm
|
float
|
Where the frame goes on the sheet. |
required |
diameter_zone
|
bool
|
Prefix the tolerance with Ø (a cylindrical zone). |
False
|
material_condition
|
str
|
|
'none'
|
datums
|
list[str] | None
|
Up to three datum letters, primary first. |
None
|
attach_at_mm
|
tuple[float, float] | None
|
A sheet point on the edge the leader points to. |
None
|
dimension
|
tuple[str, str] | None
|
|
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The frame as read back. |
Source code in src/solidworks_mcp/adapters/solidworks/drawing_standard.py
951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 | |
create_standard_drawing
async
¶
create_standard_drawing(model_path: str, output_dir: str | None = None, title: str | None = None, subtitle: str | None = None, drawing_number: str | None = None, author: str = '', revision: str = 'A', company: str = '', drawn_date: str | None = None, notes: list[str] | None = None, include_isometric: bool = True, write_model_properties: bool = True, title_block_text_height_mm: float | None = None, include_bom: bool = False) -> AdapterResult[dict[str, Any]]
Create a complete A3 drawing that follows the drawing standard.
Opens the model (or uses its open copy), writes the title-block
properties into it, makes a drawing on the A3 ISO format, builds the
sheet in separate COM steps, writes the drawing properties, saves
<drawing_number>.SLDDRW and exports a PDF.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_path
|
str
|
Part (.SLDPRT) or assembly (.SLDASM) to draw. |
required |
output_dir
|
str | None
|
Folder for the .SLDDRW and PDF; the model's folder by default. |
None
|
title
|
str | None
|
Title block TITLE; the model file name by default. |
None
|
subtitle
|
str | None
|
The supplementary title, the TITLE's second line. |
None
|
drawing_number
|
str | None
|
DWG NO.; also the drawing file name. Default
|
None
|
author
|
str
|
DRAWN name. |
''
|
revision
|
str
|
Revision letter. |
'A'
|
company
|
str
|
Company name field. |
''
|
drawn_date
|
str | None
|
DRAWN date; today (e.g. "17 Oct 2026") by default. |
None
|
notes
|
list[str] | None
|
Extra note lines (at most seven lines in total are shown). |
None
|
include_isometric
|
bool
|
Add the isometric view in its cell. |
True
|
write_model_properties
|
bool
|
Write Description/Material/Weight custom properties into the model (the format reads them from there) and save the model. |
True
|
title_block_text_height_mm
|
float | None
|
Largest text height for the DWG NO. and TITLE fields, e.g. 3 for smaller text; they are shrunk further when they still do not fit. |
None
|
include_bom
|
bool
|
Assemblies only: a top-level BOM in the top of the isometric's cell, the isometric fitted below it. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Files, scale, views, dimension |
AdapterResult[dict[str, Any]]
|
counts, the overlap check, every property written and each step's |
AdapterResult[dict[str, Any]]
|
outcome. ERROR, with that data, when a step fails, the drawing or |
AdapterResult[dict[str, Any]]
|
PDF could not be saved, or any overlap remains. |
Source code in src/solidworks_mcp/adapters/solidworks/drawing_standard.py
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 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 | |
insert_bom_table
async
¶
insert_bom_table(view_name: str, template_path: str | None = None, bom_type: str = 'top_level_only', x_mm: float | None = None, y_mm: float | None = None) -> AdapterResult[dict[str, Any]]
Insert a bill-of-materials table anchored to an assembly drawing view.
Wraps IView::InsertBomTable4. With no position the table snaps to
the sheet format's BOM anchor, or to the sheet's bottom-left corner
when the sheet has no format. Its stationary corner is the
bottom-left, so the table grows up onto the sheet; with the top-left
it hung below the sheet (measured live on SW 2026). The table's box is
read back and must lie on the sheet. An anchor near the top of the
sheet (the ISO A3 format's) makes it grow off the top, so a table
placed by the anchor is slid inside the border (BORDER_INSET in
from the edge), or just onto the sheet when it is larger; one placed at a
given x_mm/y_mm is never moved. With no template the library
default bom-standard.sldbomtbt from the BOM templates folder is
used.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_name
|
str
|
A view of an assembly on the active drawing. |
required |
template_path
|
str | None
|
|
None
|
bom_type
|
str
|
|
'top_level_only'
|
x_mm
|
float | None
|
Optional table position on the sheet. |
None
|
y_mm
|
float | None
|
Optional table position on the sheet. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The view, BOM type, template, row |
AdapterResult[dict[str, Any]]
|
count, |
AdapterResult[dict[str, Any]]
|
the box when the table still runs off the sheet. |
Source code in src/solidworks_mcp/adapters/solidworks/drawing_standard.py
set_sheet_scale
async
¶
Set the active drawing sheet's scale, e.g. 1:2 (ISheet::SetScale).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
numerator
|
float
|
Scale numerator. |
required |
denominator
|
float
|
Scale denominator. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The sheet name, the |
AdapterResult[dict[str, Any]]
|
back from the sheet and the |
Source code in src/solidworks_mcp/adapters/solidworks/drawing_standard.py
_Sheet
dataclass
¶
_Sheet(path: str, sheet_format: str, include_isometric: bool = True, include_bom: bool = False, material: str | None = None, extra_notes: list[str] = list(), views: dict[str, Any] = dict(), role: dict[str, str] = dict(), ortho: list[str] = list(), iso_name: str | None = None, scale: tuple[float, float] = (1, 1), cells: dict[str, Box] = dict(), iso_scale: tuple[float, float] | None = None, iso_size: tuple[float, float] | None = None, bom_box: Box | None = None, captions: dict[str, str] = dict(), notes: list[tuple[str, Any]] = list(), note_lines: list[str] = list(), title_block: dict[str, dict[str, Any]] = dict(), format_links: list[str] = list(), field_height: float | None = None, subtitle: str | None = None)
What the generator's steps share while they build one drawing.
Attributes:
| Name | Type | Description |
|---|---|---|
path |
str
|
The model being drawn. |
sheet_format |
str
|
The |
include_isometric |
bool
|
Whether to add the isometric view. |
include_bom |
bool
|
Whether to put a BOM above the isometric. |
material |
str | None
|
The part's material, for the notes. |
extra_notes |
list[str]
|
The caller's note lines. |
views |
dict[str, Any]
|
View name -> |
role |
dict[str, str]
|
View name -> |
ortho |
list[str]
|
The orthographic view names. |
iso_name |
str | None
|
The isometric view's name, when one was made. |
scale |
tuple[float, float]
|
The sheet scale. |
cells |
dict[str, Box]
|
Role -> cell on the sheet. |
iso_scale |
tuple[float, float] | None
|
The isometric view's own scale. |
iso_size |
tuple[float, float] | None
|
The isometric's model size, for fitting it to a cell. |
bom_box |
Box | None
|
The BOM table's box on the sheet, once placed. |
captions |
dict[str, str]
|
View name -> caption text. |
notes |
list[tuple[str, Any]]
|
|
note_lines |
list[str]
|
The NOTES block's text. |
title_block |
dict[str, dict[str, Any]]
|
Field name -> how it was fitted to its box. |
format_links |
list[str]
|
The property links the sheet format's notes show. |
field_height |
float | None
|
The caller's cap on the fitted fields' text height. |
subtitle |
str | None
|
The supplementary title, shown under the TITLE. |
Functions:¶
_as_com ¶
Wrap a raw dispatch and flag its methods for an interface.
Objects handed back inside arrays (GetViews and friends) arrive as raw
PyIDispatch. Method flagging is a no-op on those, so every call
against them raises until they are wrapped through dynamic.Dispatch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adapter
|
Any
|
A connected |
required |
obj
|
Any
|
The raw dispatch. |
required |
interface
|
str
|
Interface name, e.g. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
The wrapped, flagged object, or |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
_double_array ¶
VARIANT(VT_ARRAY | VT_R8) for array-valued COM properties (tuple when pywin32 is absent).
Source code in src/solidworks_mcp/adapters/solidworks/com_utils.py
_grow ¶
_named_view_candidates ¶
Model-owned name first, then English and Chinese fallbacks, without repeats.
Unknown starred names are custom model views and are used verbatim.
Source code in src/solidworks_mcp/adapters/solidworks/io.py
_null_callout ¶
Return a VT_DISPATCH null for SelectByID2's Callout parameter.
A plain Python None marshals as VT_NULL, which SolidWorks rejects
with DISP_E_TYPEMISMATCH - measured as
(-2147352571, 'Type mismatch.', None, 8). See runbook item 11.
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
A |
Any
|
when pywin32 is unavailable (mock/Linux runs, where no real COM call |
|
Any
|
will be made anyway, but the value must still never be bare |
Source code in src/solidworks_mcp/adapters/solidworks/features.py
_resolve_drawing_view ¶
Return the IView on the active drawing whose name matches.
Walks IDrawingDoc::GetViews (a list of sheets, each shaped
(sheet, view, view, ...)) the same way :func:_view_names does. The
match is case-insensitive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adapter
|
Any
|
A connected |
required |
drawing
|
Any
|
The drawing document, flagged for |
required |
view_name
|
str
|
The drawing-view name to look for. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
The flagged |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
_step ¶
Record one step's outcome in the generator's steps list.
Source code in src/solidworks_mcp/adapters/solidworks/drawing_standard.py
_view_names ¶
Return the drawing's view names, excluding sheet formats.
CreateDrawViewFromModelView3 returns None for a model SolidWorks
could not resolve, and Create3rdAngleViews2 returns a bare boolean, so
the view list is the ground truth for whether views were really added.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adapter
|
Any
|
A connected |
required |
drawing
|
Any
|
The drawing document, flagged for |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
list[str]: View names in sheet order. |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
bom_target ¶
Where a BOM the format's anchor placed should go instead, if anywhere.
Inside the border (BORDER_INSET in from the sheet's edge) when it
fits there; else, if it runs off the sheet, just onto the sheet.
Returns:
| Type | Description |
|---|---|
Box | None
|
Box | None: The box to place it at; |
Box | None
|
inside the border, is on the sheet and too large for the border, or |
Box | None
|
can't be measured. |
Source code in src/solidworks_mcp/adapters/solidworks/drawing_standard.py
choose_layout ¶
Largest standard scale whose cells fit, with those cells.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sizes
|
dict[str, tuple[float, float]]
|
Model-space view sizes, as for :func: |
required |
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
tuple[float, float]
|
The scale (num, den) and the cells; the smallest standard scale |
dict[str, Box]
|
(with default cells if even that does not fit) as a last resort. |
Source code in src/solidworks_mcp/adapters/solidworks/drawing_standard.py
content_box ¶
field_room ¶
How far right a title-block field may run: to the next note in its row.
A note is in the field's row when its vertical centre lies within the field's height, and it is to the right when it starts more than 5 mm after the field does (the field's own label sits at about its start).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
box
|
Box
|
The field's text box. |
required |
others
|
list[Box]
|
Every other note's box in the title block. |
required |
limit
|
float
|
The title block's right edge. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The x the field's text must end before. |
Source code in src/solidworks_mcp/adapters/solidworks/drawing_standard.py
find_sheet_format ¶
Locate a sheet format file: SolidWorks' configured folder, then ProgramData.
Source code in src/solidworks_mcp/adapters/solidworks/drawing_standard.py
gtol_problem ¶
gtol_problem(characteristic: str, tolerance: float, material_condition: str, datums: list[str] | None) -> str | None
Why a feature control frame's inputs are invalid, or None when valid.
Shared by the real and mock adapters so both refuse the same inputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
characteristic
|
str
|
The GD&T characteristic name. |
required |
tolerance
|
float
|
The tolerance value. |
required |
material_condition
|
str
|
|
required |
datums
|
list[str] | None
|
Datum letters, primary first. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
str | None: The problem, in words. |
Source code in src/solidworks_mcp/adapters/solidworks/drawing_standard.py
iso_fit_scale ¶
Largest standard scale at which the isometric view fills its cell.
Source code in src/solidworks_mcp/adapters/solidworks/drawing_standard.py
linked_property ¶
The first property a note's linked text shows, or None.
note_lines ¶
The NOTES block: a heading, then at most seven numbered lines.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material
|
str | None
|
The part's material, first when known. |
required |
extra
|
list[str] | None
|
The caller's lines, after the standard ones. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
list[str]: |
Source code in src/solidworks_mcp/adapters/solidworks/drawing_standard.py
plan_cells ¶
plan_cells(sizes: dict[str, tuple[float, float]], scale: tuple[float, float]) -> dict[str, Box] | None
Size the four view cells for one part at one scale, or None if it won't fit.
Third-angle grid: front bottom-left, side to its right, plan above the front, isometric top-right. Column widths follow the part's width and depth, row heights its height and depth; spare space is shared out evenly so every view is centred with room around it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sizes
|
dict[str, tuple[float, float]]
|
|
required |
scale
|
tuple[float, float]
|
Sheet scale (num, den). |
required |
Source code in src/solidworks_mcp/adapters/solidworks/drawing_standard.py
scale_label ¶
shift_into ¶
box moved by the least distance that puts it inside area.
Returns:
| Type | Description |
|---|---|
Box | None
|
Box | None: The moved box, |
Source code in src/solidworks_mcp/adapters/solidworks/drawing_standard.py
title_block_properties ¶
title_block_properties(*, model_file: str, title: str, author: str, drawn_date: str, revision: str, company: str, subtitle: str | None = None) -> tuple[dict[str, str], dict[str, str]]
Map the standard's title-block fields onto the ISO format's properties.
The a3 - iso format reads TITLE, MATERIAL and WEIGHT from the model
($PRPSHEET) and DRAWN, REVISION and the company from the drawing
($PRP). Material and weight are links, so they always show the model's
real values. subtitle is not a property: the title-block step writes it
as the TITLE's second line (ISO 7200's supplementary title).
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
tuple[dict[str, str], dict[str, str]]
|
(model properties, drawing properties). |
Source code in src/solidworks_mcp/adapters/solidworks/drawing_standard.py
view_roles ¶
view_roles(views: dict[str, Any], outlines: dict[str, Box | None], orientations: dict[str, str], front_name: str = '*Front') -> dict[str, str]
Name each orthographic view's role: front, plan or side.
The front is the view whose orientation is the model's front view
(front_name) or says "front" (else the first); a view centred above
the front is the plan, any other is the side.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
views
|
dict[str, Any]
|
View name -> |
required |
outlines
|
dict[str, Box | None]
|
View name -> outline, |
required |
orientations
|
dict[str, str]
|
View name -> orientation name, e.g. |
required |
front_name
|
str
|
The model's own name for its front view ( |
'*Front'
|
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
dict[str, str]: View name -> role; a view whose outline is unknown |
dict[str, str]
|
gets no role. |
Source code in src/solidworks_mcp/adapters/solidworks/drawing_standard.py
walk_feature_tree ¶
Every top-level feature of document, once each, in tree order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adapter
|
Any
|
The adapter, for |
required |
document
|
Any
|
The |
required |
Returns:
| Type | Description |
|---|---|
list[TreeFeature]
|
list[TreeFeature]: The features, sorted by tree position. A feature |
list[TreeFeature]
|
found by both passes (same name and type) is kept once. |