solidworks_mcp.adapters.solidworks¶
solidworks_mcp.adapters.solidworks ¶
Grouped SolidWorks mixins for the PyWin32 adapter.
Attributes¶
__all__
module-attribute
¶
__all__ = ['SolidWorksAssemblyMixin', 'SolidWorksConfigurationsMixin', 'SolidWorksDocumentationMixin', 'SolidWorksDrawingPackMixin', 'SolidWorksDrawingStandardMixin', 'SolidWorksEquationsMixin', 'SolidWorksFeaturesMixin', 'SolidWorksIOMixin', 'SolidWorksPartFeaturesMixin', 'SolidWorksSelectionMixin', 'SolidWorksSheetMetalMixin', 'SolidWorksSketchMixin', 'SolidWorksTemplatesMixin']
Classes¶
SolidWorksAssemblyMixin ¶
Exploded views, component patterns, mirrors, replace and balloons.
Methods:¶
add_balloons
async
¶
Number a drawing view's parts with balloons, one per part.
Selects the view and calls IDrawingDoc.AutoBalloon5 with
options from CreateAutoBalloonOptions: the layout,
circular balloons, one per part (IgnoreMultiple).
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The |
AdapterResult[dict[str, Any]]
|
balloon |
Source code in src/solidworks_mcp/adapters/solidworks/assembly.py
create_exploded_view
async
¶
Explode the active assembly, automatically or step by step, and show it.
With no steps, IAssemblyDoc.AutoExplode. Each step moves its
components distance mm along x, y or z
(reverse for the other way): the components are selected under
mark 1 and the default plane normal to the direction under mark 2,
then IConfiguration.AddExplodeStep2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
steps
|
list[dict[str, Any]] | None
|
|
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The exploded view's |
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
|
Source code in src/solidworks_mcp/adapters/solidworks/assembly.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
mirror_components
async
¶
Mirror components about a plane, as instances of the same parts.
IAssemblyDoc.MirrorComponents3 with the components as
ComponentsToInstance and nothing mirrored into new files.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The |
AdapterResult[dict[str, Any]]
|
instances' names. |
Source code in src/solidworks_mcp/adapters/solidworks/assembly.py
pattern_components
async
¶
pattern_components(components: list[str], axis: str, count: int, kind: str = 'linear', spacing: float | None = None, angle: float | None = None) -> AdapterResult[dict[str, Any]]
Repeat components along or around a reference axis.
A component pattern feature from a definition
(IFeatureManager.CreateDefinition, local linear or circular):
the seeds, the axis, count (seeds included) and the spacing (mm)
or the angle (degrees; 360 spaces them equally).
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The |
AdapterResult[dict[str, Any]]
|
counts before and after, and the |
Source code in src/solidworks_mcp/adapters/solidworks/assembly.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | |
replace_component
async
¶
replace_component(component: str, file_path: str, all_instances: bool = False) -> AdapterResult[dict[str, Any]]
Swap a component for another part or assembly file.
Selects the component and calls IAssemblyDoc.ReplaceComponents2
(the file's active configuration, mates re-attached). The file must
exist; names and files are read back afterwards.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
names before and after. |
Source code in src/solidworks_mcp/adapters/solidworks/assembly.py
set_component_appearance
async
¶
set_component_appearance(component: str, visible: bool | None = None, transparent: bool | None = None) -> AdapterResult[dict[str, Any]]
Hide or show a component, and make it transparent or opaque.
Visibility is IComponent2.Visible (1 shown, 0 hidden);
transparency selects the component and calls
IAssemblyDoc.SetComponentTransparent. Both are read back.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
after. |
Source code in src/solidworks_mcp/adapters/solidworks/assembly.py
set_exploded_view
async
¶
Show the active configuration's exploded view, or collapse it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exploded
|
bool
|
|
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The |
AdapterResult[dict[str, Any]]
|
( |
Source code in src/solidworks_mcp/adapters/solidworks/assembly.py
SolidWorksConfigurationsMixin ¶
Create, activate and delete configurations, and read the active one.
Methods:¶
activate_configuration
async
¶
Make name the active configuration and rebuild.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The configuration to show. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The active configuration and the one before it. |
Source code in src/solidworks_mcp/adapters/solidworks/configurations.py
active_configuration
async
¶
The active configuration's name.
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
The name, or an error when no model is open or it can't be read. |
Source code in src/solidworks_mcp/adapters/solidworks/configurations.py
create_configuration
async
¶
create_configuration(name: str, parent: str | None = None, description: str = '', activate: bool = False) -> AdapterResult[dict[str, Any]]
Add a configuration, optionally derived from parent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The new configuration's name. |
required |
parent
|
str | None
|
A configuration to derive it from, or None. |
None
|
description
|
str
|
Its description. |
''
|
activate
|
bool
|
Leave it active; otherwise the previous one is shown again. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The configuration, its parent, the active one and every name. |
Source code in src/solidworks_mcp/adapters/solidworks/configurations.py
delete_configuration
async
¶
Delete a configuration that isn't active and isn't the only one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The configuration to delete. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The deleted name and the configurations left. |
Source code in src/solidworks_mcp/adapters/solidworks/configurations.py
SolidWorksDocumentationMixin ¶
Expose model-data and drawing-documentation methods through a mixin.
Methods:¶
arrange_dimensions
async
¶
Move drawing dimensions so none overlaps another, then verify.
Reads every dimension's text box and lines, plans positions outside
the views with :func:dimension_layout.plan_layout, applies them with
IAnnotation::SetPosition, rebuilds, then re-reads the real
geometry and checks the rule with :func:dimension_layout.find_overlaps.
The check covers every view on the sheet, even when only one view is
rearranged, because neighbouring views' dimensions can collide.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_name
|
str | None
|
Only move this view's dimensions; all views when omitted. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
(each violation listed), |
AdapterResult[dict[str, Any]]
|
overlap remains - the rule is not met - with the same data, so the |
AdapterResult[dict[str, Any]]
|
caller can see which dimensions still collide. |
Source code in src/solidworks_mcp/adapters/solidworks/documentation.py
export_flat_pattern
async
¶
Export the active sheet-metal part's flat pattern to DXF or DWG.
Wraps IPartDoc::ExportToDWG2 with swExportToDWG_ExportSheetMetal.
SheetMetalOptions 1 exports the flat-pattern geometry only (no bend
lines or sketches).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Output |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The written path and its size. |
Source code in src/solidworks_mcp/adapters/solidworks/documentation.py
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 | |
get_custom_properties
async
¶
Read the custom properties of the active document.
Wraps IModelDocExtension::CustomPropertyManager(config) with
GetNames + Get6. "" reads the file-level properties a
drawing title block usually links to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
configuration
|
str | None
|
Configuration name; file-level when omitted. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
|
Source code in src/solidworks_mcp/adapters/solidworks/documentation.py
get_material
async
¶
get_material(configuration: str | None = None, material: str | None = None, database: str | None = None) -> AdapterResult[dict[str, Any]]
Read the active part's material, or a library material by name.
The part's material comes from IPartDoc::GetMaterialPropertyName2
(see :func:_read_material); its properties from its entry in the
.sldmat library, which SolidWorks reads too (no COM call returns
a part material's modulus or strengths outside Simulation).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
configuration
|
str | None
|
Configuration name; the active one when omitted. |
None
|
material
|
str | None
|
A library material to read instead of the part's; no document is needed and none is changed. |
None
|
database
|
str | None
|
The library to look in first for |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
data: |
AdapterResult[dict[str, Any]]
|
( |
Source code in src/solidworks_mcp/adapters/solidworks/documentation.py
insert_model_dimensions
async
¶
insert_model_dimensions(view_name: str | None = None, include_hole_wizard: bool = True) -> AdapterResult[dict[str, Any]]
Bring model dimensions into drawing views, each dimension shown once.
Imports the model's "marked for drawing" dimensions view by view with
IDrawingDoc::InsertModelAnnotations3 (UsePlacementInSketch off,
so SolidWorks places them rather than copying sketch positions).
Drafting rules applied:
- pictorial views (isometric, dimetric, trimetric) are not dimensioned unless named explicitly;
- a model dimension already shown in an earlier view is deleted from later views, so each dimension appears exactly once on the sheet.
Falls back to IDrawingDoc::AutoDimension only when nothing at all
could be imported. Placement is then made overlap-free by
:meth:arrange_dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_name
|
str | None
|
One view to dimension; every orthographic view when omitted. |
None
|
include_hole_wizard
|
bool
|
Also import Hole Wizard location dimensions. |
True
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Per-view counts, duplicates removed, |
AdapterResult[dict[str, Any]]
|
skipped pictorial views and the |
Source code in src/solidworks_mcp/adapters/solidworks/documentation.py
list_available_materials
async
¶
List materials from the configured SolidWorks material libraries.
Reads the custom library folders from
swFileLocationsMaterialDatabases (a ;-separated list) plus the
install's built-in sldmaterials folder, and parses every
.sldmat file in them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
search
|
str | None
|
Case-insensitive substring filter on name or classification. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[list[dict[str, str]]]
|
AdapterResult[list[dict[str, str]]]: |
AdapterResult[list[dict[str, str]]]
|
and |
AdapterResult[list[dict[str, str]]]
|
read and the |
AdapterResult[list[dict[str, str]]]
|
told apart from an unexpected library location. |
Source code in src/solidworks_mcp/adapters/solidworks/documentation.py
list_model_dimensions
async
¶
List every dimension in the active part or assembly, once each.
Reads the features with the same two-pass walk as list_features
(:func:~.feature_walk.walk_feature_tree), skips folder rows, and
reads each feature's GetFirstDisplayDimension chain. SolidWorks
can show one dimension under several features (a plane's offset under
the cut sketched on it), so each full_name (e.g. "D1@Sketch1",
the name set_dimension accepts) is kept once, with feature set
from the part after the @.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature_name
|
str | None
|
Only list dimensions owned by this feature
(case-insensitive), by the |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[list[dict[str, Any]]]
|
AdapterResult[list[dict[str, Any]]]: |
AdapterResult[list[dict[str, Any]]]
|
|
AdapterResult[list[dict[str, Any]]]
|
and |
Source code in src/solidworks_mcp/adapters/solidworks/documentation.py
measure_entities
async
¶
Measure one or more entities with SolidWorks' Measure tool.
Selects each entity by spec (see :func:_parse_measure_spec), then runs
IModelDocExtension::CreateMeasure + IMeasure::Calculate(None),
which measures the current selection. Values SolidWorks reports as
-1 (not applicable to the selection) are dropped.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entities
|
list[str]
|
One or two entity specs, e.g. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Measured values in metres, square |
AdapterResult[dict[str, Any]]
|
metres and radians, plus |
AdapterResult[dict[str, Any]]
|
two entities. |
Source code in src/solidworks_mcp/adapters/solidworks/documentation.py
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 | |
set_custom_property
async
¶
set_custom_property(name: str, value: str, configuration: str | None = None) -> AdapterResult[dict[str, Any]]
Create or overwrite one text custom property on the active document.
Wraps ICustomPropertyManager::Add3(name, swCustomInfoText, value,
swCustomPropertyReplaceValue) and reads the value back.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Property name, e.g. |
required |
value
|
str
|
Text value; may be a |
required |
configuration
|
str | None
|
Configuration name; file-level when omitted. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The stored and resolved value. |
Source code in src/solidworks_mcp/adapters/solidworks/documentation.py
set_material
async
¶
set_material(material_name: str, database: str | None = None, configuration: str | None = None) -> AdapterResult[dict[str, Any]]
Assign a material to the active part.
Wraps IPartDoc::SetMaterialPropertyName2 (a void call), then
reads the material back - the read-back is the only proof it applied.
A name the library does not hold leaves the part unchanged and is
reported as not found.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_name
|
str
|
Material name exactly as in the library, e.g.
|
required |
database
|
str | None
|
Library name; |
None
|
configuration
|
str | None
|
Configuration name; |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Requested and applied material. |
Source code in src/solidworks_mcp/adapters/solidworks/documentation.py
SolidWorksDrawingPackMixin ¶
Section and detail views, title block and format, dimensions, 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]]
One dimension on the entities picked at sheet points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dimension_type
|
str
|
horizontal, vertical, aligned, radial, diameter or angular. |
required |
entity1_point
|
list[float]
|
|
required |
position
|
list[float]
|
|
required |
entity2_point
|
list[float] | None
|
The second entity, for linear and angular types. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The dimension's name and value (mm, degrees for angular). |
Source code in src/solidworks_mcp/adapters/solidworks/drawing_pack.py
auto_dimension_view
async
¶
SolidWorks' auto-dimension on one view, counted before and after.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view
|
str
|
The view's name. |
required |
scheme
|
str
|
|
'baseline'
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The view, the scheme, and the dimensions before, after and added. |
Source code in src/solidworks_mcp/adapters/solidworks/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]]
A detail view of the circle at center in view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view
|
str
|
The parent view's name. |
required |
center
|
list[float]
|
|
required |
radius
|
float
|
The circle's radius on the sheet, mm. |
required |
position
|
list[float]
|
|
required |
scale
|
str
|
The detail's scale, e.g. |
'2:1'
|
label
|
str | None
|
The detail's letter; the next free one when |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The new view's name, label, scale and outline. |
Source code in src/solidworks_mcp/adapters/solidworks/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]]
A section view cut along a line across view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view
|
str
|
The parent view's name. |
required |
line_start
|
list[float]
|
|
required |
line_end
|
list[float]
|
|
required |
position
|
list[float]
|
|
required |
label
|
str | None
|
The section's letter; the next free one when |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The new view's name, label and outline. |
Source code in src/solidworks_mcp/adapters/solidworks/drawing_pack.py
drawing_report
async
¶
What check_drawing judges: views, sheet, title block, BOM, dangling.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
|
Source code in src/solidworks_mcp/adapters/solidworks/drawing_pack.py
update_sheet_format
async
¶
update_sheet_format(sheet_format: str, paper_size: str | None = None) -> AdapterResult[dict[str, Any]]
Change the active sheet's format and paper size, keeping its views.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sheet_format
|
str
|
A format name ( |
required |
paper_size
|
str | None
|
a4 to a0; read from the format name when |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The format's path, the paper size and the views before and after. |
Source code in src/solidworks_mcp/adapters/solidworks/drawing_pack.py
update_title_block
async
¶
Write title-block fields to the properties the sheet format reads.
title goes to the drawn model's Description (the ISO format reads
it with $PRPSHEET); the rest are the drawing's own properties.
Fields not given keep their values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fields
|
dict[str, str]
|
Field name (a key of :data: |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
Each field with the property it was written to. |
Source code in src/solidworks_mcp/adapters/solidworks/drawing_pack.py
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
SolidWorksEquationsMixin ¶
List, add or change, and delete equations and global variables.
Methods:¶
delete_equation
async
¶
Delete the equation for name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The equation's name (its left-hand side). |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The deleted name and the names left. |
Source code in src/solidworks_mcp/adapters/solidworks/equations.py
list_equations
async
¶
Every equation and global variable of the active model.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[dict[str, Any]]]
|
Each with |
AdapterResult[list[dict[str, Any]]]
|
|
Source code in src/solidworks_mcp/adapters/solidworks/equations.py
set_equation
async
¶
set_equation(name: str, expression: str, configurations: str | list[str] = 'all') -> AdapterResult[dict[str, Any]]
Add an equation for name, or change the one there is.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
A global variable, or a dimension such as |
required |
expression
|
str
|
The right-hand side, e.g. |
required |
configurations
|
str | list[str]
|
|
'all'
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The stored equation, its value, |
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
configurations, the expression set and |
AdapterResult[dict[str, Any]]
|
value in each of them. |
Source code in src/solidworks_mcp/adapters/solidworks/equations.py
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
SolidWorksFeaturesMixin ¶
Expose SolidWorks feature methods via mixin-local implementation helpers.
Methods:¶
add_fillet
async
¶
Fillet edges, then confirm the model's volume actually changed.
IModelDoc2.FeatureFillet3 can report success without building
anything, so besides the feature-count check inside
:func:_add_fillet_impl the volume is compared before and after,
here in the async layer for the same reason as mirror_feature.
An unreadable volume is not treated as failure. With no edge_names
(the current selection) the volume is not read: see the comment below.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius
|
float
|
Fillet radius in millimetres. |
required |
edge_names
|
list[str]
|
Edge names, |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksFeature]
|
AdapterResult[SolidWorksFeature]: The fillet, with |
AdapterResult[SolidWorksFeature]
|
|
AdapterResult[SolidWorksFeature]
|
could be read. |
Source code in src/solidworks_mcp/adapters/solidworks/features.py
create_reference_point
async
¶
create_reference_point(mode: str, x: float, y: float, z: float, distance: float | None = None, percent: float | None = None) -> AdapterResult[dict[str, Any]]
Create a reference point on the active part.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mode
|
str
|
|
required |
x
|
float
|
X of a point on the target edge/face, in millimetres. |
required |
y
|
float
|
Y of a point on the target edge/face, in millimetres. |
required |
z
|
float
|
Z of a point on the target edge/face, in millimetres. |
required |
distance
|
float | None
|
For |
None
|
percent
|
float | None
|
For |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Delegates to |
AdapterResult[dict[str, Any]]
|
func: |
Source code in src/solidworks_mcp/adapters/solidworks/features.py
delete_feature
async
¶
Delete a feature and report every feature that went with it.
The tree is listed before and after with list_features, the read
path that works on SolidWorks, and the names that disappeared become
removed_features: the named feature and its dependents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The feature or sketch to delete. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The delete's data plus |
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
can't be listed). |
Source code in src/solidworks_mcp/adapters/solidworks/features.py
mirror_feature
async
¶
mirror_feature(features: list[str], mirror_plane: str, merge: bool = True, mirror_bodies: bool = True) -> AdapterResult[dict[str, Any]]
Mirror solid bodies or features about a plane.
InsertMirrorFeature returns a Feature object even when it mirrored
nothing, so the model's volume is measured before and after and the
call is reported as failed if the volume did not change (a mirrored
cut lowers it, a mirrored boss or body raises it). That check runs
here rather than inside the COM closure because get_mass_properties
is the read path known to work - reading CreateMassProperty().Volume
inline returns None when a plane is still in the selection set,
which silently disables the check.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
list[str]
|
Names of the bodies (or features) to mirror. For a body mirror these are the names as they appear under Solid Bodies, which for a lofted wing is the loft's own name. |
required |
mirror_plane
|
str
|
Plane to mirror about, e.g. |
required |
merge
|
bool
|
Merge the mirrored result with the original. |
True
|
mirror_bodies
|
bool
|
Mirror whole solid bodies rather than features.
Defaults to |
True
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: What was mirrored, and the volume |
AdapterResult[dict[str, Any]]
|
before, after and its change. |
AdapterResult[dict[str, Any]]
|
the call failed, or the volume did not change. |
Source code in src/solidworks_mcp/adapters/solidworks/features.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | |
pattern_circular
async
¶
pattern_circular(features: list[str], axis: str, count: int, angle: float = 360.0, equal_spacing: bool = True) -> AdapterResult[dict[str, Any]]
Pattern features around an axis.
FeatureCircularPattern5 returns a Feature object whether or not it
produced anything, so the model volume is measured before and after
here - in the async layer, using get_mass_properties, which is the
read path that works. Reading volume inline inside the COM closure
returns None while a selection is active.
Note that instances landing off the parent body are silently dropped
by SolidWorks, so the volume changes by less than count - 1 times
the seed. That is correct behaviour, not a failure - only no change
at all means the pattern did nothing. A pattern of a cut lowers the
volume, a pattern of a boss raises it; both count.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
list[str]
|
Names of the features to pattern. |
required |
axis
|
str
|
Name of the axis to rotate about, e.g. |
required |
count
|
int
|
Total number of instances including the original. |
required |
angle
|
float
|
Total angle in degrees to spread them over. Defaults to a full 360. |
360.0
|
equal_spacing
|
bool
|
Space instances evenly across |
True
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: What was patterned and the volume |
AdapterResult[dict[str, Any]]
|
before, after and its change. |
AdapterResult[dict[str, Any]]
|
selected or the volume did not change. |
Source code in src/solidworks_mcp/adapters/solidworks/features.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | |
rename_feature
async
¶
Rename a feature on the active model's tree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
old_name
|
str
|
The feature's current name. |
required |
new_name
|
str
|
The name to give it. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Delegates to |
AdapterResult[dict[str, Any]]
|
func: |
Source code in src/solidworks_mcp/adapters/solidworks/features.py
SolidWorksIOMixin ¶
Expose model open/save/create/configuration methods through a mixin.
Methods:¶
activate_document
async
¶
Make an already-open document the active one.
Matches title_or_path against the open documents by exact title,
by full path, or by file name (all case-insensitive), then calls
ISldWorks::ActivateDoc3 and updates the adapter's tracked
currentModel. The resulting ActiveDoc is read back and a
mismatch is reported as an error.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title_or_path
|
str
|
A window title ( |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
to) and |
AdapterResult[dict[str, Any]]
|
not be performed). |
AdapterResult[dict[str, Any]]
|
blank, or nothing open matches. |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 | |
add_drawing_view
async
¶
Add a view of a model to the active drawing sheet.
The same operation as create_drawing_view; both tool entry points
exist upstream and reach this one implementation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
Any
|
Tool payload; see |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The new view's name and position. |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
add_mate
async
¶
add_mate(component_a: str, component_b: str, entity_a: str = 'Front Plane', entity_b: str = 'Front Plane', mate_type: str = 'coincident', alignment: str = 'aligned', distance: float = 0.0, angle: float = 0.0, face_a: list[float] | None = None, face_b: list[float] | None = None) -> AdapterResult[dict[str, Any]]
Mate two components together.
Wraps IAssemblyDoc::AddMate5. A named entity (a reference plane or
axis) is selected via IComponent2::FeatureByName +
IFeature::Select2. A face is given as a point on it in the
component's own part coordinates: the face is found among that
component's faces only (IComponent2::GetBodies2, which report
part coordinates; measured on SW 2026) and selected with
IEntity::Select4. Searching one component means a pin and the
hole it sits in, whose surfaces share points, can't be confused.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component_a
|
str
|
First component instance name, as reported by
:meth: |
required |
component_b
|
str
|
Second component instance name. |
required |
entity_a
|
str
|
Named feature on the first component. |
'Front Plane'
|
entity_b
|
str
|
Named feature on the second component. |
'Front Plane'
|
mate_type
|
str
|
|
'coincident'
|
alignment
|
str
|
|
'aligned'
|
distance
|
float
|
Distance in millimetres, for a distance mate. |
0.0
|
angle
|
float
|
Angle in degrees, for an angle mate. |
0.0
|
face_a
|
list[float] | None
|
|
None
|
face_b
|
list[float] | None
|
The same for the second component. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The mate created, plus the bounding |
AdapterResult[dict[str, Any]]
|
box before and after so the caller can see what moved. |
AdapterResult[dict[str, Any]]
|
when the entities cannot be selected or SolidWorks rejects the |
AdapterResult[dict[str, Any]]
|
mate. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagated through |
Example::
await adapter.add_mate("plate-1", "plate-2")
Source code in src/solidworks_mcp/adapters/solidworks/io.py
3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 | |
add_note
async
¶
Place a text note on the active drawing sheet.
Wraps IModelDoc2::InsertNote(Text) and then positions the returned
annotation: InsertNote places the note wherever SolidWorks likes,
so the position is applied afterwards via IAnnotation::SetPosition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
Any
|
Tool payload. Reads |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The note text and where it landed. |
Example::
await adapter.add_note(
{"text": "MATERIAL: AISI 1018", "position_x": 200.0,
"position_y": 50.0}
)
Source code in src/solidworks_mcp/adapters/solidworks/io.py
3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 | |
auto_center_marks
async
¶
auto_center_marks(view_name: str, mark_holes: bool = True, mark_fillets: bool = False, mark_slots: bool = True) -> AdapterResult[dict[str, Any]]
Auto-insert centre marks on circular features in a drawing view.
Wraps IView::AutoInsertCenterMarks2 (falling back to
AutoInsertCenterMarks on older builds) using the document's
default size/gap/font. IView::GetCenterMarkCount() returns 0
regardless of marks actually present on SW 3DEXPERIENCE R2026x, so
the count is derived instead from IView::GetAnnotations(): the
view's annotations are enumerated and those flagged as
swCenterMarkSym (swAnnotationType_e) are counted.
center_marks_before == center_marks_after == 0 is reported when
the annotation enumeration cannot be performed (COM unavailable or
older builds).
Adding nothing is still a success - the view may simply have no un-marked circular features.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_name
|
str
|
Name of a view on the active drawing. |
required |
mark_holes
|
bool
|
Mark holes / bores. Defaults to |
True
|
mark_fillets
|
bool
|
Mark fillets. Defaults to |
False
|
mark_slots
|
bool
|
Mark slots. Defaults to |
True
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The view, the feature types acted |
AdapterResult[dict[str, Any]]
|
on, and |
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
a drawing, no feature type is selected, or the view is not found. |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 | |
check_interference
async
¶
Run SolidWorks' interference detection on the active assembly.
Uses IAssemblyDoc::InterferenceDetectionManager
(IInterferenceDetectionMgr), not the older
ToolsCheckInterference2. That call is declared Sub with two
ByRef out-parameters, and on SW 2025 through pywin32 late binding
it could not be made to report anything: pythoncom.Missing raises
PyOleMissing can not be converted to a COM VARIANT, a plain
None or a typed array VARIANT raises Type mismatch, passing a
component array throws server-side, and a byref VT_VARIANT pair is
accepted but leaves both out-parameters None for an assembly that
demonstrably interferes. An inspection tool that always answers "no
interference" is worse than one that refuses.
GetInterferenceCount is an ordinary return value, so 0 is a
real measurement rather than a swallowed failure, and each
IInterference carries the overlap Volume.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Any
|
Optional settings. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
overlap volumes in mm^3. |
AdapterResult[dict[str, Any]]
|
or the active document is not an assembly. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagated through |
Example::
await adapter.check_interference({"coincident": False})
Source code in src/solidworks_mcp/adapters/solidworks/io.py
4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 | |
close_model
async
¶
Close the current SolidWorks model and optionally save first.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
save
|
bool
|
When |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[None]
|
AdapterResult[None]: Result of the close operation. |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
create_assembly
async
¶
create_assembly(name: str | None = None, template: str | None = None) -> AdapterResult[SolidWorksModel]
Create a new assembly document and set it as active.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
Reserved for future naming policy. |
None
|
template
|
str | None
|
Optional |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: Metadata for the new assembly document. |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 | |
create_drawing
async
¶
create_drawing(name: str | None = None, template: str | None = None) -> AdapterResult[SolidWorksModel]
Create a new drawing document and set it as active.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
Reserved for future naming policy. |
None
|
template
|
str | None
|
Optional |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: Metadata for the new drawing document. |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 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 | |
create_drawing_view
async
¶
Place a view of a model on the active drawing sheet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
Any
|
Tool payload; see |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The new view's name and position. |
Example::
await adapter.create_drawing_view(
{"model_path": r"C:\parts\bracket.sldprt", "orientation": "front"}
)
Source code in src/solidworks_mcp/adapters/solidworks/io.py
create_part
async
¶
create_part(name: str | None = None, units: str | None = None, template: str | None = None) -> AdapterResult[SolidWorksModel]
Create a new part document and set it as active.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
Reserved for future naming policy. |
None
|
units
|
str | None
|
Optional linear unit system for the new part - |
None
|
template
|
str | None
|
Optional |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: Metadata for the new part document. |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 | |
create_technical_drawing
async
¶
Lay out the three standard views of a model on the active sheet.
Wraps IDrawingDoc::Create3rdAngleViews2 (or
Create1stAngleViews2), which places front, top and side in one
call. Both return a bare boolean, so the view list before and after is
what actually confirms the views exist.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
Any
|
Tool payload. Reads |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The view names that appeared. |
Example::
await adapter.create_technical_drawing(
{"model_file": r"C:\parts\bracket.sldprt"}
)
Source code in src/solidworks_mcp/adapters/solidworks/io.py
3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 | |
get_application_info
async
¶
Read SolidWorks' revision, language and default templates.
Each value is read on its own, so one unreadable value is None
and the rest still come back. Templates are reported by file name
only, so no path under the user's profile leaves the adapter.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: See |
AdapterResult[dict[str, Any]]
|
|
Source code in src/solidworks_mcp/adapters/solidworks/io.py
get_dimension
async
¶
Read a named model dimension in the unit its type gives it.
IDimension.SystemValue is metres for a length, radians for an
angle and the number itself for a count; IDimension.GetType says
which (:func:_dimension_reading). GetValue3 is not used: it is
in the document's units, which this can't convert without reading
the document's unit system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Fully-qualified dimension name, e.g. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
"deg", or |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
get_mass_properties
async
¶
Get mass properties for the active model.
Returns:
| Type | Description |
|---|---|
AdapterResult[MassProperties]
|
AdapterResult[MassProperties]: Computed mass, volume, area, COM, and inertia. |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 | |
get_model_geometry_summary
async
¶
Summarise the active part or assembly without rebuilding it.
Unlike get_mass_properties this never calls ForceRebuild3, so
it leaves the live selection intact (COM pitfall #23) and can be read
right before a feature call. A value that cannot be read is None.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: See |
AdapterResult[dict[str, Any]]
|
|
Source code in src/solidworks_mcp/adapters/solidworks/io.py
2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 | |
get_model_info
async
¶
Collect summary metadata about the active model.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Model information payload. |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 | |
insert_component
async
¶
insert_component(file_path: str, x: float = 0.0, y: float = 0.0, z: float = 0.0) -> AdapterResult[dict[str, Any]]
Insert a part or sub-assembly into the active assembly.
Wraps IAssemblyDoc::AddComponent4(CompName, ConfigName, X, Y, Z),
falling back to AddComponent5. Position is in millimetres.
The component file must contain solid geometry. SolidWorks
silently refuses to insert an empty part — every overload returns
None and the component count stays put. That behaviour is what
made this look unimplementable until the save_file bug that was
writing empty parts got fixed.
Success is confirmed by the assembly's component count going up, since
AddComponent* gives no usable failure signal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Absolute path to the |
required |
x
|
float
|
X position in millimetres. |
0.0
|
y
|
float
|
Y position in millimetres. |
0.0
|
z
|
float
|
Z position in millimetres. |
0.0
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Component name and before/after |
AdapterResult[dict[str, Any]]
|
counts. |
AdapterResult[dict[str, Any]]
|
file is missing, or nothing was inserted. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagated through |
Example::
await adapter.insert_component(r"C:\parts\bracket.sldprt", 0, 0, 0)
Source code in src/solidworks_mcp/adapters/solidworks/io.py
2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 | |
list_components
async
¶
List the top-level components of the active assembly.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[str]]
|
AdapterResult[list[str]]: Component names, or an error when the |
AdapterResult[list[str]]
|
active document is not an assembly. |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
list_configurations
async
¶
List all configuration names on the active model.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[str]]
|
AdapterResult[list[str]]: Configuration names, or empty list when unavailable. |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
list_drawing_views
async
¶
List the views on the active drawing.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[str]]
|
AdapterResult[list[str]]: View names, sheet formats excluded. |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
list_open_documents
async
¶
Enumerate every document currently open in SolidWorks.
Read-only: uses ISldWorks::GetDocuments and does not touch the
active-document selection. Each entry carries title, path,
type (Part / Assembly / Drawing / Unknown) and
is_active.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[dict[str, Any]]]
|
AdapterResult[list[dict[str, Any]]]: One entry per open document |
AdapterResult[list[dict[str, Any]]]
|
(possibly empty). |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
open_model
async
¶
Open a SolidWorks model file and set it as active on the adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to a |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: Model metadata for the opened document. |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 | |
pack_and_go_assembly
async
¶
Copy an assembly and every file it uses into one folder.
SolidWorks lists the files (IModelDoc2.GetDependencies2) and each
is copied, as saved on disk, into target_dir under its own name.
The copy opens with its own parts: SolidWorks looks for a referenced
file in the assembly's folder before the stored path. (SolidWorks'
own Pack and Go, IPackAndGo, listed only the assembly on
SolidWorks 2026.) No document is closed or changed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_path
|
str
|
The |
required |
target_dir
|
str
|
The folder to copy into; created if needed. A file already there with a copied file's name is replaced. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict]: |
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
files open with changes the copy doesn't have). |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 | |
rebuild_model
async
¶
Force a rebuild and report exactly which features fail and why.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
top_level_only
|
bool
|
Rebuild only the top level of an assembly. Defaults to False (full rebuild). |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
carrying that |
AdapterResult[dict[str, Any]]
|
SolidWorks reports the rebuild itself failed. |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 | |
save_body_as_part
async
¶
Extract one solid body from the active multibody part to a new file.
Wraps IFeatureManager::CreateSaveBodyFeature - the API behind
Insert > Features > Save Bodies. body_name is matched against
IPartDoc::GetBodies2(swSolidBody) by IBody2::Name; a Save
Bodies feature is added and the standalone part is written to
file_path. CreateSaveBodyFeature returns the feature (or
None) but no write status, so success is confirmed by the file
existing afterwards.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body_name
|
str
|
Name of a solid body in the active part. |
required |
file_path
|
str
|
Absolute path for the new |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The body, the written path, the new |
AdapterResult[dict[str, Any]]
|
feature's name, every solid-body name found, and |
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
alongside, which is closed (issue #101). |
AdapterResult[dict[str, Any]]
|
the active document is not a part, the body is absent, the parent |
AdapterResult[dict[str, Any]]
|
directory is missing, or no file was written. |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 | |
save_copy
async
¶
Write a copy of the active document and keep working on the original.
IModelDoc2.SaveAs3(path, 0, swSaveAsOptions_Copy): File > Save As
with "Save as copy and continue" (#276, fixed in 2.2.0). The open document keeps its
own path, so an assembly using it still uses it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Where to write the copy; not the document's own path. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
(the path the open document has afterwards) and |
AdapterResult[dict[str, Any]]
|
|
Source code in src/solidworks_mcp/adapters/solidworks/io.py
2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 | |
save_file
async
¶
Save the active model to its current path or to a new file path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str | None
|
Optional target path for Save As. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[None]
|
AdapterResult[None]: Result of the save operation. |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
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 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 | |
set_component_state
async
¶
set_component_state(component: str, fixed: bool | None = None, flexible: bool | None = None) -> AdapterResult[dict[str, Any]]
Fix or float a component, and make a sub-assembly rigid or flexible.
Fixing selects the component and calls IAssemblyDoc::FixComponent
or UnfixComponent. Solving goes through
IAssemblyDoc::CompConfigProperties5, which also sets suppression,
visibility, configuration, BOM and envelope for the selected
component: each is read from the component first and passed back, so
only solving changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
str
|
Instance name, as |
required |
fixed
|
bool | None
|
True fixes it, False floats it. |
None
|
flexible
|
bool | None
|
True flexible, False rigid (sub-assemblies). |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The state before and after. |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 | |
set_dimension
async
¶
set_dimension(name: str, value: float, configurations: str | list[str] = 'this') -> AdapterResult[dict[str, Any]]
Set a named model dimension in millimetres and rebuild.
In the active configuration the proven SystemValue write is kept;
"all" or a list of names goes through
IDimension.SetSystemValue3(value, option, names).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Fully-qualified dimension name. |
required |
value
|
float
|
New value in millimetres. |
required |
configurations
|
str | list[str]
|
|
'this'
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
value was set in. |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
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 | |
set_units
async
¶
Set the active document's linear unit system.
Accepts mm, cm, m, in or ft (plus common aliases
such as inch / millimeters). The choice is applied by setting
both swUnitSystem and the exact swUnitsLinear preference, then
reading the linear unit back - a mismatch is reported as an error.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unit_system
|
str
|
The target unit token. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: What was applied and whether the |
AdapterResult[dict[str, Any]]
|
readback confirmed it. |
AdapterResult[dict[str, Any]]
|
the token is not recognised. |
Source code in src/solidworks_mcp/adapters/solidworks/io.py
SolidWorksPartFeaturesMixin ¶
Holes, threads, linear patterns, shell, draft, rib and convert entities.
Methods:¶
add_cosmetic_thread
async
¶
add_cosmetic_thread(edge_point: list[float], size: str, diameter: float, end_type: str = 'blind', depth: float | None = None, standard: str = 'iso') -> AdapterResult[dict[str, Any]]
A cosmetic thread on a circular edge (InsertCosmeticThread3).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edge_point
|
list[float]
|
A point (mm) on the circular edge. |
required |
size
|
str
|
The thread size, e.g. |
required |
diameter
|
float
|
The major diameter, mm. |
required |
end_type
|
str
|
A key of :data: |
'blind'
|
depth
|
float | None
|
Thread length for a blind thread, mm. |
None
|
standard
|
str
|
A key of :data: |
'iso'
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The thread's name; the volume is unchanged. |
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
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 | |
add_draft
async
¶
add_draft(angle: float, faces: list[list[float]], neutral_face: list[float], reverse: bool = False) -> AdapterResult[dict[str, Any]]
Draft faces by an angle against a neutral face (InsertMultiFaceDraft).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
angle
|
float
|
Draft angle, degrees. |
required |
faces
|
list[list[float]]
|
A point (mm) on each face to draft. |
required |
neutral_face
|
list[float]
|
A point (mm) on the neutral face. |
required |
reverse
|
bool
|
Draft the other way. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The draft's name and volume change. |
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
create_hole
async
¶
create_hole(face_point: list[float], hole_type: str, standard: str, size: str, end_condition: str = 'through_all', depth: float | None = None, positions: list[list[float]] | None = None, fastener: str | None = None) -> AdapterResult[dict[str, Any]]
Hole Wizard holes at points on a flat face (HoleWizard5).
The face is selected at face_point with SelectByID2, and
SolidWorks puts the hole where the pick landed, about 0.04 mm off; the
hole's position sketch point is then moved exactly onto
face_point. Dimensions not given are -1, which leaves them to the
standard's table for the size. Each point of positions is added to
the same position sketch, so one feature holds every hole
(:func:_place_holes). A simple hole that
SolidWorks won't make through all is made blind through the part
(:func:_through_depth_m).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
face_point
|
list[float]
|
|
required |
hole_type
|
str
|
A key of :data: |
required |
standard
|
str
|
A key of :data: |
required |
size
|
str
|
The size as the library lists it ( |
required |
end_condition
|
str
|
A key of :data: |
'through_all'
|
depth
|
float | None
|
Hole depth for a blind hole, mm. |
None
|
positions
|
list[list[float]] | None
|
Further |
None
|
fastener
|
str | None
|
The hole type's name from |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The hole's name, inputs, |
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
lacks is refused before any COM call, with the nearest sizes. |
AdapterResult[dict[str, Any]]
|
When adding the positions fails, the hole is removed again and |
AdapterResult[dict[str, Any]]
|
the error says why. |
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 | |
create_rib
async
¶
create_rib(sketch: str, thickness: float, both_sides: bool = True, flip_material: bool = False, normal_to_sketch: bool = False) -> AdapterResult[dict[str, Any]]
A rib from an open sketch (InsertRib).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sketch
|
str
|
The rib sketch's name. |
required |
thickness
|
float
|
Rib thickness, mm. |
required |
both_sides
|
bool
|
Add the thickness to both sides of the sketch. |
True
|
flip_material
|
bool
|
Extend the rib the other way. |
False
|
normal_to_sketch
|
bool
|
Extrude normal to the sketch instead of parallel. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The rib's name and volume change. |
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
create_shell
async
¶
create_shell(thickness: float, faces: list[list[float]], outward: bool = False) -> AdapterResult[dict[str, Any]]
Hollow the body to a wall thickness, removing the faces picked.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
thickness
|
float
|
Wall thickness, mm. |
required |
faces
|
list[list[float]]
|
A point (mm) on each face to remove; empty for a closed shell. |
required |
outward
|
bool
|
Add the wall outside the body instead of inside. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The shell's name and volume change. |
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
list_hole_sizes
async
¶
list_hole_sizes(standard: str, hole_type: str, fastener: str | None = None, size: str | None = None) -> AdapterResult[dict[str, Any]]
The Hole Wizard hole types and sizes, read from the installed library.
A file read (:mod:.hole_library), no COM: it works whether or not
SolidWorks is running.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
standard
|
str
|
A key of :data: |
required |
hole_type
|
str
|
|
required |
fastener
|
str | None
|
One hole type's name, to list only its sizes. |
None
|
size
|
str | None
|
One size, to read its dimensions. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The hole types with their sizes, or one size's dimensions; an |
AdapterResult[dict[str, Any]]
|
error naming where the library was looked for, or the nearest |
AdapterResult[dict[str, Any]]
|
sizes. |
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
pattern_linear
async
¶
pattern_linear(features: list[str], direction: list[float] | str, count: int, spacing: float, direction2: list[float] | str | None = None, count2: int = 1, spacing2: float = 0.0, reverse: bool = False, reverse2: bool = False) -> AdapterResult[dict[str, Any]]
Repeat features along one or two directions (FeatureLinearPattern5).
A direction is a point (mm) on a straight edge, or the name of an axis or edge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
list[str]
|
Names of the features to repeat. |
required |
direction
|
list[float] | str
|
The first direction. |
required |
count
|
int
|
Instances along it, the original included. |
required |
spacing
|
float
|
Distance between instances, mm. |
required |
direction2
|
list[float] | str | None
|
The second direction, or None for one direction. |
None
|
count2
|
int
|
Instances along the second direction. |
1
|
spacing2
|
float
|
Spacing along the second direction, mm. |
0.0
|
reverse
|
bool
|
Flip the first direction. |
False
|
reverse2
|
bool
|
Flip the second direction. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The pattern's name, inputs and volume change. |
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 | |
sketch_convert_entities
async
¶
sketch_convert_entities(edge_points: list[list[float]] | None = None, face_point: list[float] | None = None, construction: bool = False) -> AdapterResult[dict[str, Any]]
Copy model edges, or a face's outline, into the open sketch.
SketchUseEdge3 returns only a Boolean, so the sketch's segments
are read before and after and the new ones registered under ids the
other sketch tools accept.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edge_points
|
list[list[float]] | None
|
A point (mm) on each edge to copy. |
None
|
face_point
|
list[float] | None
|
A point (mm) on a face whose outline to copy. |
None
|
construction
|
bool
|
Make the copies construction geometry. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The new entities' ids. |
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
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 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 | |
SolidWorksSelectionMixin ¶
Expose feature-selection and feature-list methods through a mixin.
Methods:¶
get_selected_entities
async
¶
Report the faces/edges/vertices currently highlighted in the live SolidWorks UI, so an agent can see exactly what the user clicked on instead of guessing from a screenshot (see com-api-pitfalls.md #21 for why a screenshot alone is not reliable proof of document/view state).
Refreshes currentModel from swApp.ActiveDoc first, the same
way list_features does, since the user's selection lives on
whatever document is actually active in the UI right now -- which
may not be the document this adapter last created or touched.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[dict[str, Any]]]
|
AdapterResult[list[dict[str, Any]]]: One entry per selected |
AdapterResult[list[dict[str, Any]]]
|
entity, each with at least |
AdapterResult[list[dict[str, Any]]]
|
( |
AdapterResult[list[dict[str, Any]]]
|
additionally carry |
AdapterResult[list[dict[str, Any]]]
|
|
AdapterResult[list[dict[str, Any]]]
|
|
AdapterResult[list[dict[str, Any]]]
|
(the true length of a curved edge will be longer). Vertices |
AdapterResult[list[dict[str, Any]]]
|
carry |
AdapterResult[list[dict[str, Any]]]
|
omitted rather than failing the whole call -- a partial |
AdapterResult[list[dict[str, Any]]]
|
description is more useful than none. |
Source code in src/solidworks_mcp/adapters/solidworks/selection.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | |
select_face_edges
async
¶
select_face_edges(point: list[float] | None = None, side: str | None = None, plane: str | None = None, edge_type: str = 'all', append: bool = False) -> AdapterResult[dict[str, Any]]
Multi-select every edge bounding one face of the active part.
See SolidWorksAdapter.select_face_edges for the contract; the face
resolution and selection live in face_selection.FaceEdgeSelector.
Source code in src/solidworks_mcp/adapters/solidworks/selection.py
select_feature
async
¶
Select a named feature, sketch, plane or component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature_name
|
str
|
Feature name, optionally |
required |
append
|
bool
|
Add to the current selection instead of replacing it. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The selector payload plus |
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
|
Source code in src/solidworks_mcp/adapters/solidworks/selection.py
SolidWorksSheetMetalMixin ¶
create_base_flange, add_edge_flange, create_sketched_bend, set_flat_pattern.
Methods:¶
add_edge_flange
async
¶
add_edge_flange(edge_point: list[float], length: float, angle: float = 90.0, bend_radius: float | None = None, flip: bool = False) -> AdapterResult[dict[str, Any]]
A flange off the sheet edge nearest edge_point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edge_point
|
list[float]
|
|
required |
length
|
float
|
The flange's length, mm. |
required |
angle
|
float
|
The flange's angle from the sheet, degrees. |
90.0
|
bend_radius
|
float | None
|
Inside bend radius, mm; the sheet's when omitted. |
None
|
flip
|
bool
|
Put the flange on the other side. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
volume change. |
Source code in src/solidworks_mcp/adapters/solidworks/sheet_metal.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | |
create_base_flange
async
¶
create_base_flange(thickness: float, bend_radius: float, k_factor: float = 0.5, depth: float | None = None, sketch: str | None = None, reverse: bool = False) -> AdapterResult[dict[str, Any]]
A base flange from a sketch: a plate, or an open profile extruded by depth.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
thickness
|
float
|
Sheet thickness, mm. |
required |
bend_radius
|
float
|
Inside bend radius, mm. |
required |
k_factor
|
float
|
The bend allowance's K-factor. |
0.5
|
depth
|
float | None
|
How far an open profile is extruded, mm; not used for a closed one. |
None
|
sketch
|
str | None
|
The sketch's name; the last closed sketch when omitted. |
None
|
reverse
|
bool
|
Thicken to the other side of the sketch. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
the volume before, after and change. |
Source code in src/solidworks_mcp/adapters/solidworks/sheet_metal.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
create_sketched_bend
async
¶
create_sketched_bend(angle: float = 90.0, bend_radius: float | None = None, sketch: str | None = None, reverse: bool = False) -> AdapterResult[dict[str, Any]]
Bend the sheet along a sketched line.
SolidWorks chooses which side of the line stays put:
ISketchedBendFeatureData.SetFixedFace made no difference live on
SolidWorks 2026, with or without the face selected. The reply's
bounding box shows which side moved.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
angle
|
float
|
The bend angle, degrees. |
90.0
|
bend_radius
|
float | None
|
Inside bend radius, mm; the sheet's when omitted. |
None
|
sketch
|
str | None
|
The bend line's sketch; the last closed sketch when omitted. |
None
|
reverse
|
bool
|
Bend the other way. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
Source code in src/solidworks_mcp/adapters/solidworks/sheet_metal.py
set_flat_pattern
async
¶
Flatten the sheet-metal part, or fold it back, and measure it.
As SolidWorks' Flatten command does, this unsuppresses the part's
Flat-Pattern feature (suppresses it to fold). IModelDoc2.SetBendState
returned success and changed nothing (seen live, SolidWorks 2026).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
flat
|
bool
|
True to flatten, False to fold. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
pattern's name) and |
AdapterResult[dict[str, Any]]
|
the blank's size). |
Source code in src/solidworks_mcp/adapters/solidworks/sheet_metal.py
SolidWorksSketchMixin ¶
Expose sketch creation and editing methods via mixin-local implementation.
SolidWorksTemplatesMixin ¶
get_template_folders and save_as_template for the real adapter.
Methods:¶
get_template_folders
async
¶
The template folders, and the active document's template extension.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
and |
Source code in src/solidworks_mcp/adapters/solidworks/templates.py
save_as_template
async
¶
Save the active document as a template at file_path.
SolidWorks then has the template open in place of the document (see the module docstring); the document's file, if it had one, is left as last saved. The title and path are read before and after, so the reply says what is open now.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
The template's full path, with the document's template extension. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
(the open document's path before the save, |
AdapterResult[dict[str, Any]]
|
saved) and |