SolidWorks MCP Python
Provides tools for interacting with SolidWorks 2026, enabling CAD automation such as creating and modifying parts, assemblies, and drawings, generating drawing packages with localized view names, validating layouts, and exporting PDFs and STEP files.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@SolidWorks MCP Python Generate a drawing package for this part with auto-layout, validate views, and export PDF."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
SolidWorks MCP Python — 中文本地化补丁版
本仓库是 andrewbartels1/SolidworksMCP-python 的补丁版本,增加了对简体中文 SolidWorks 的视图名称兼容,并加强了一键工程图的布局校验。
这是非官方补丁仓库,与 Dassault Systèmes 及上游仓库维护者没有隶属关系。
完整的上游功能说明请参阅上游项目 README。
补丁内容
SolidWorks 英文视图名失败时,自动尝试简体中文名称:
*Front→*前视*Back→*后视*Left→*左视*Right→*右视*Top→*上视*Bottom→*下视*Isometric→*等轴测*Trimetric→*三轴测*Dimetric→*二轴测*Current→*当前视图
单个工程图视图与
generate_drawing_package共用本地化名称回退。中文视图方向可以正确识别为前视图、俯视图和侧视图。
自动布局会读取实际视图边界;视图移动失败或超出图纸时自动降低比例。
保存和导出 PDF 前强制重建图纸,并再次验证所有视图仍在规划区域内。
无法得到合格版面时返回明确错误,不再静默生成“看似成功”的图纸。
Related MCP server: SolidPilot
已验证环境
Windows 11
SolidWorks 2026 SP0.0,简体中文
Python 3.13.4
solidworks-mcp-python2.1.0 + 本仓库补丁
验证结果:
上游相关适配器测试:496 项通过
工程图与本地化专项测试:102 项通过
实机自检:零件、装配体、工程图和 STEP 导出 4/4 通过
安装
需要 Windows、Python 3.13+、uv,以及至少启动过一次的 SolidWorks。
git clone https://github.com/locense/solidworks-mcp-python-patched.git
cd solidworks-mcp-python-patched
uv venv .venv --python 3.13
uv pip install --python .venv\Scripts\python.exe -e .运行实机自检:
.\.venv\Scripts\solidworks-mcp-python.exe selftest --year 2026运行测试依赖:
uv pip install --python .venv\Scripts\python.exe -e ".[test]"Codex MCP 配置
将路径替换为本仓库的实际位置:
[mcp_servers.solidworks]
command = 'C:\path\to\solidworks-mcp-python-patched\.venv\Scripts\solidworks-mcp-python.exe'
args = ["--year", "2026"]
cwd = 'C:\path\to\solidworks-mcp-python-patched'
startup_timeout_sec = 240.0
tool_timeout_sec = 1800.0
[mcp_servers.solidworks.env]
SOLIDWORKS_MCP_TOOL_MODE = "search"
PYTHONIOENCODING = "utf-8"
PYTHONUNBUFFERED = "1"
PYTHONUTF8 = "1"SOLIDWORKS_MCP_TOOL_MODE="search" 只向模型暴露四个入口工具,避免一次加载全部 150 多个工具。删除该环境变量可恢复完整工具列表。
配置变更后需要完全退出并重新打开 Codex。
已知限制
一键工程图遇到极小的尺寸标注时,仍可能报告
line_through_own_view等标注冲突。此类冲突现在会明确返回错误,不会将存在排版问题的图纸标记为成功。
建议生成图纸后打开 PDF 做一次视觉检查,尤其是尺寸密集的小型零件。
来源与许可
本项目基于上游 MIT 许可代码修改。原始版权声明保留在 LICENSE 中。 本仓库同样以 MIT License 发布。
Available Tools
157 toolsactivate_configurationActivate ConfigurationAIdempotent
Make a configuration of the active model the active one, and rebuild.
Dimensions and suppression then read and change in that configuration.
Needs: an open part or assembly with that configuration. Changes: the
active configuration. Returns: active and previous.
Inputs: input_data (required). Returns: object
activate_documentActivate DocumentAIdempotent
Make an already-open document the active one, so the next tools act on it.
Match it by window title, full path or file name (not case-sensitive); see
list_open_documents. To open a file that isn't open yet, use open_model.
Needs: the document open in SolidWorks. Changes: the active document. Returns:
data with activated (the title) and verified (read back from SolidWorks;
null when it couldn't be read). No match is an error that lists the open
documents.
Inputs: input_data (required). Returns: object
add_arcAdd Sketch ArcA
Draw a circular arc in the open sketch: from its centre, through three points, or tangent.
Use it for rounded ends and curved edges of a profile. kind center (the
default) takes the centre, start and end, counter-clockwise; three_point
takes start, end and a point the arc passes through (through_x,
through_y); tangent starts at the end of an existing entity (start) and
leaves tangent to it. Needs: an open sketch (create_sketch). Changes: adds an
arc. Returns: arc with id, kind, center, start_point and
end_point. Its id is what add_sketch_constraint and
add_sketch_dimension take.
Inputs: input_data (required). Returns: object
add_balloonsAdd BalloonsA
Number the parts in a drawing view with balloons, one per part.
Use it on an assembly drawing, with a BOM (insert_bom_table): the
balloons carry the BOM's item numbers. Works best on an exploded view
(create_drawing_view with exploded). Needs: an open drawing with a view
of an assembly. Changes: adds balloons around the view. Returns:
balloons with the view, layout, count and the items shown. A
view that isn't there fails as not_found.
Inputs: input_data (required). Returns: object
add_centerlineAdd Sketch CenterlineA
Draw a centreline (construction line) in the open sketch, in mm.
Use it as the axis for create_revolve, or as the line for sketch_mirror and
symmetric relations. It is never part of the profile. Needs: an open sketch
(create_sketch). Changes: adds a centreline. Returns: centerline with id,
start_point and end_point.
Inputs: input_data (required). Returns: object
add_chamferAdd ChamferA
Bevel edges of the active part with a chamfer: distance along one face at angle (45 by default).
Name the edges as "Edge<1>", a point "x,y,z" (metres) or "face:x,y,z" for every
edge of a face; or leave edge_names empty to use the current selection (e.g.
from select_face_edges). At 45 degrees both legs equal distance; at another
angle, flip swaps which face distance is measured on. Needs: an open part
with a solid body. Changes: adds a Chamfer feature. Returns: chamfer with
name, distance, angle, flip and edges.
Inputs: input_data (required). Returns: object
add_circleAdd Sketch CircleA
Draw a circle in the open sketch from its centre and radius, in mm.
Use it for holes and round bosses. Needs: an open sketch (create_sketch).
Changes: adds a circle (a construction circle with construction). Returns:
circle with id, center, radius and diameter. Its id is what
add_sketch_constraint and add_sketch_dimension take.
Inputs: input_data (required). Returns: object
add_cosmetic_threadCosmetic ThreadA
Add a cosmetic thread to a hole or shaft, so drawings show the thread callout.
Pick the circular edge where the thread starts with a point on it (mm). The
thread is drawn, not modelled, so the volume must not change; it fails if it
does. Needs: an open part with a round edge at edge_point. Changes: adds a
Cosmetic Thread feature. Returns: thread with name, size,
diameter_mm, end_type and depth_mm.
Inputs: input_data (required). Returns: object
add_datum_tagAdd Datum TagA
Add a datum feature symbol (A, B, C, ...) on an edge of the active drawing.
Use it to mark the datums a feature control frame from add_gtol refers to.
Needs: an open, active drawing with an edge at the attach point. Changes: adds
the datum tag. Returns: data with the label as read back. No edge at the
point is not_found.
Inputs: input_data. Returns: object
add_dimensionAdd Drawing DimensionA
Add one dimension to a drawing view, between edges picked by points on the sheet.
Give points in sheet mm on a view's edges or vertices (read view outlines with
check_drawing). Two parallel edges give their distance; one edge its length;
a circle's edge its radius or diameter; two lines their angle. For the model's
own dimensions use insert_model_dimensions instead. Needs: an open, active
drawing. Changes: adds a reference dimension. Returns: dimension with name,
value and units (mm, deg for angular).
Inputs: input_data (required). Returns: object
add_draftDraft FacesA
Draft faces of the active part by an angle, e.g. for a moulded part.
Pick each face to draft and the neutral face it pivots on (usually the
parting or bottom face) with a point on each (mm). It fails when the volume
doesn't change. Needs: an open part. Changes: adds a Draft feature.
Returns: draft with name, angle, faces_drafted, and
volume_before, volume_after and volume_change (mm³).
Inputs: input_data (required). Returns: object
add_drawing_viewAdd Drawing ViewA
Deprecated: use create_drawing_view.
Place one named view of a part or assembly on the active drawing sheet; the same as create_drawing_view.
Prefer create_drawing_view; this tool reaches the same code and is kept for
existing callers. It only adds views: an operation other than "add" is
refused. Needs: an open, active drawing and the model file on
disk. Changes: adds a view to the sheet. Returns: data with the view's name,
orientation, position, scale and the view counts.
Inputs: input_data (required). Returns: object
add_edge_flangeEdge FlangeA
Add a flange to one edge of a sheet-metal part, at a length and angle.
Pick the edge with a point on it in mm (edge_point), e.g. on the top
face's long edge. length is measured from that edge, so on a 2 mm sheet a
20 mm flange stands 22 mm above the bottom face. It fails when the volume
doesn't change. Needs: a sheet-metal part (create_base_flange first).
Changes: adds an Edge-Flange feature. Returns: flange with name,
edge_length_mm (to check the pick) and volume_change (mm³).
Inputs: input_data (required). Returns: object
add_ellipseAdd Sketch EllipseA
Draw an ellipse in the open sketch from its centre and axis lengths, in mm.
Use it for oval holes and bosses. Needs: an open sketch (create_sketch).
Changes: adds an ellipse. Returns: ellipse with id, center, major_axis,
minor_axis and angle.
Inputs: input_data (required). Returns: object
add_filletAdd FilletA
Round edges of the active part with a constant-radius fillet.
Name the edges as "Edge<1>", a point "x,y,z" (metres) or "face:x,y,z" for every
edge of a face; or leave edge_names empty to use the current selection (e.g.
from select_face_edges). A fillet that leaves the volume unchanged is an
error. Needs: an open part with a solid body. Changes: adds a Fillet feature.
Returns: fillet with name, radius and edges.
Inputs: input_data (required). Returns: object
add_gtolAdd GD&T FrameA
Add a GD&T feature control frame to the active drawing, e.g. position Ø0.2 (M) to A|B|C.
Attach it to a drawing dimension (dimension_view + dimension_name; the frame
sits under the dimension's text, the usual place for a hole's position
tolerance), or place it at x_mm/y_mm with an optional leader to the edge at
attach_x_mm/attach_y_mm. Add the datums it refers to with add_datum_tag.
Needs: an open, active drawing. Changes: adds the frame. Returns: data, the
frame as read back from SolidWorks. No edge at the attach point is not_found.
Inputs: input_data. Returns: object
add_lineAdd Sketch LineA
Draw a straight line between two points in the open sketch, in mm.
Use it for profiles made of straight edges; for a closed box, use
add_rectangle, and for a revolve axis, add_centerline. Needs: an open sketch
(create_sketch). Changes: adds a line (a construction line with
construction). Returns: line with id, start, end and length. Its
id is what add_sketch_constraint and add_sketch_dimension take.
Inputs: input_data (required). Returns: object
add_mateAdd MateA
Mate two components of the active assembly: coincident, concentric, parallel, perpendicular, tangent, distance or angle.
Each side is a named reference plane or axis (entity_a, e.g. "Front Plane"),
or a face given by a point on it (face_a, mm, in that part's own coordinates):
a pin's round face and a hole's face make a concentric mate. Get instance names
from list_components. Needs: an open assembly with both components. Changes:
adds a mate and may move components. Returns: mate with mate_type,
components, entities, geometry_moved and moved_components.
Inputs: input_data (required). Returns: object
add_noteAdd Drawing NoteA
Place a text note on the active drawing sheet at a position in millimetres.
Use it for general notes such as material or finish. For a title block, use
generate_drawing_package, which fills one. Needs: an open, active drawing.
Changes: adds a note to the sheet. Returns: data with text, position,
positioned (whether the position was applied) and font_size_points.
Inputs: input_data (required). Returns: object
add_polygonAdd Sketch PolygonA
Draw a regular polygon (e.g. a hexagon) in the open sketch from its centre, radius and number of sides.
Use it for nuts, hex bosses and pockets. Needs: an open sketch
(create_sketch). Changes: adds the polygon's sides. Returns: polygon with
id, center, radius, sides and angle. A diameter dimension
(add_sketch_dimension) on its id sizes it by the circle drawn inside it.
Inputs: input_data (required). Returns: object
add_rectangleAdd Sketch RectangleA
Draw a closed, axis-aligned rectangle in the open sketch from two opposite corners, in mm.
Use it for blocks, plates and rectangular cut-outs. Needs: an open sketch
(create_sketch). Changes: adds four connected lines. Returns: rectangle with
id, corner1, corner2, width, height and area. Its id is what
add_sketch_constraint and add_sketch_dimension take.
Inputs: input_data (required). Returns: object
add_sketch_chamferAdd Sketch ChamferA
Bevel corners of the open sketch, picking each corner by its point.
Use it for bevelled corners of a 2D profile; bevel a solid's edges with
add_chamfer instead, last in the feature tree. distance alone cuts the same
distance along both sides; add distance2 for a different second side, or
angle (degrees) for a distance and an angle. Needs: an open sketch with
entities meeting at each corner ([x, y] in sketch mm). Changes: each corner
becomes a line and the entities either side are trimmed back to it. Returns:
chamfer with one id per corner, the corners and the sizes. A corner
with no sketch point fails as invalid_input and nothing changes.
Inputs: input_data (required). Returns: object
add_sketch_constraintAdd Sketch RelationA
Add a geometric relation between sketch entities: horizontal, vertical, parallel, perpendicular, tangent, coincident, concentric, equal, symmetric, collinear or fix.
Use it to hold design intent, then check with check_sketch_fully_defined.
Entities are the ids the add_* tools returned. Needs: an open sketch
(create_sketch). Changes: adds the relation. Returns: constraint with id,
type and the entities.
Inputs: input_data (required). Returns: object
add_sketch_dimensionAdd Sketch DimensionA
Add a driving dimension to sketch entities: linear, angular, radial, diameter or an ellipse axis.
Use it to fix a size so the sketch is fully defined and can be changed later
with set_dimension. Entities are the ids the add_* tools returned; two
connected lines for angular, a circle or arc for radial or diameter, an
ellipse for major_axis or minor_axis (value is the whole axis; the
dimension runs from the centre, so it shows half). No dialog opens. Needs: an open sketch (create_sketch). Changes: adds the dimension and
resizes the geometry to value. Returns: dimension with id, type, value
and the entities.
Inputs: input_data (required). Returns: object
add_sketch_filletAdd Sketch FilletA
Round corners of the open sketch to a radius, picking each corner by its point.
Use it for rounded corners of a 2D profile, such as a cut's outline; round a
solid's edges with add_fillet instead, last in the feature tree. Give
each corner's [x, y] in sketch mm, where two entities meet (for a rectangle,
its corners). Needs: an open sketch (create_sketch) with entities meeting at
each corner. Changes: each corner becomes an arc and the entities either side
are trimmed back to it. Returns: fillet with one id per corner, the
corners and the radius. A corner with no sketch point fails as
invalid_input and nothing changes.
Inputs: input_data (required). Returns: object
add_sketch_textAdd Sketch TextA
Write text in the open sketch, at a point or centred on one, to deboss or emboss it.
Use it for lettering, then cut (create_cut_extrude) or extrude the sketch.
center_at (a model point in mm) puts the text's middle there; otherwise it
starts at x, y. $PRP:"name" in the text shows a custom property;
one holding a dimension's name ("D1@Sketch3", set with set_custom_property)
makes the text follow that dimension. To read from a face's own side, such as
an underside, open the sketch on that face (create_sketch face_point).
Needs: an open sketch (create_sketch). Changes: adds text. Returns: the
text's id, the text as SolidWorks shows it (links resolved) and its
height.
Inputs: input_data (required). Returns: object
add_slotAdd SlotA
Draw a slot in the open sketch: straight between two centres, or along an arc.
Use it for adjustment slots and keyways, then cut it (create_cut_extrude).
A straight slot takes its two end centres, start and end. An arc slot
(kind arc) takes the center of the arc it follows and start and end
on that arc, counter-clockwise. Needs: an open sketch (create_sketch).
Changes: adds one closed slot. Returns: slot with its id, the points, the
width and its area (mm²).
Inputs: input_data (required). Returns: object
add_splineAdd Sketch SplineA
Draw a smooth spline through a list of points in the open sketch, in mm.
Use it for free-form curves such as an aerofoil or a handle profile. Needs: an
open sketch (create_sketch). Changes: adds a spline. Returns: spline with
id, control_points and point_count.
Inputs: input_data (required). Returns: object
arrange_dimensionsArrange Drawing DimensionsAIdempotent
Move drawing dimensions out of their views into tidy rows so nothing overlaps, then check the sheet.
Rows start 8 mm outside each view, 7 mm apart, shortest span nearest the view. A
dimension with no room stays put and is listed in unplaced. The check reads
back every text box and line: no text on text, no line through text or across a
view, nothing off the sheet. Use it after insert_model_dimensions. Needs: an
open, active drawing. Changes: moves dimensions on the sheet. Returns: data
with dimensions, moved, overlaps_before, overlaps_after and unplaced.
If any overlap remains the call is an error whose data lists
remaining_overlaps; try a smaller sheet scale (set_sheet_scale).
Inputs: input_data. Returns: object
auto_center_marksAdd Centre MarksA
Insert centre marks on the holes, slots and (optionally) fillets of one drawing view.
Use it after placing views, before dimensioning holes. Adding none is still a
success: the view may have no unmarked circular edges. Needs: an open drawing
with the named view (see list_drawing_views). Changes: adds centre-mark
annotations to the view. Returns: data with center_marks_added and the
counts before and after.
Inputs: input_data (required). Returns: object
auto_dimension_viewAuto-Dimension Drawing ViewA
Dimension one drawing view with SolidWorks' auto-dimension (baseline or chain).
It adds reference dimensions measured from the view's edges; prefer
insert_model_dimensions, which shows the model's own (driving) dimensions, and
use this for a view that has none to bring in. Dimensions may overlap: run
arrange_dimensions after. It fails when nothing is added. Needs: an open,
active drawing with that view. Changes: adds dimensions. Returns: data with
added and the counts before and after.
Inputs: input_data (required). Returns: object
calculate_mass_propertiesCalculate Mass PropertiesARead-onlyIdempotent
Deprecated: use get_mass_properties.
Measure the active part or assembly's mass properties (the old name of get_mass_properties).
It returns exactly what get_mass_properties returns; use that instead. Needs:
an open part or assembly. Read-only. It rebuilds first. Returns:
mass_properties with volume (mm³), surface_area (mm²), mass (kg),
center_of_mass (mm), moments_of_inertia (kg·mm²) and principal_axes.
Inputs: input_data (required). Returns: object
check_drawingCheck Drawing CompletenessARead-onlyIdempotent
Check the active drawing is complete before exporting it: views, dimensions, title block, BOM.
Read-only. Findings: view_off_sheet (error), view_not_dimensioned
(warning; isometric and detail views excepted), title_block_field_empty
(warning: title, drawn by, revision), dangling_annotation (error) and
bom_missing (warning, an assembly with no BOM). Each names the tool that
fixes it. It checks completeness, not a drafting standard. Needs: an open,
active drawing. Returns: passed (no errors), errors, warnings,
findings (each rule, severity, message, maybe view), views and
report (the facts read).
Inputs: no named parameters. Returns: object
check_interferenceCheck Assembly InterferenceARead-onlyIdempotent
Find where the components of the active assembly overlap (Tools > Interference Detection).
Use it after inserting and mating components. A count of 0 is a real
measurement. To fail a build on interference, use verify_model with
no_interference. Needs: an open, active assembly. Read-only. Returns: data
with interference_found, interference_count, interferences (component
pairs and overlap volume in mm³) and scope.
Inputs: input_data (required). Returns: object
check_sketch_fully_definedCheck Sketch Fully DefinedARead-onlyIdempotent
Check whether a sketch is fully defined, under-defined or over-defined.
Use it after adding relations and dimensions, to see if the sketch still has
free geometry. Needs: an open part with the sketch. Read-only. Returns: sketch
with sketch_name, is_fully_defined (null when unknown), definition_state
and where the answer came from (source).
Inputs: input_data. Returns: object
classify_feature_treeClassify Feature TreeARead-onlyIdempotent
Classify the active model's kind (part, sheet metal, assembly, drawing and so on) from its feature tree, and suggest how to work on it.
Use it before rebuilding or editing an unfamiliar model, to pick a workflow. It
reads the model unless you pass model_info and features you already have
(from get_model_info and list_features). Needs: an open document, unless
both are passed. Read-only. Returns: classification with family,
recommended_workflow, confidence, needs_vba, evidence, warnings,
next_actions and feature_count, plus the model_info and features used.
Inputs: input_data (required). Returns: object
close_modelClose ModelADestructive
Close the active document, saving it first only if asked.
Use it when you are done with a document. Unsaved changes are lost unless save
is on. Needs: an open, active document. Changes: closes the document, and with
save writes it first. Returns: saved, whether a save was asked for.
Inputs: input_data (required). Returns: object
compare_drawing_versionsCompare Drawing FilesARead-onlyIdempotent
Compare two drawing files on disk: whether they are byte-identical, and how their sizes differ.
Use it to tell whether a drawing changed between two saved versions. It does not
open SolidWorks, so it can't say which views, dimensions or notes differ.
Identical files mean nothing changed, but different files may not: SolidWorks
writes a different file each time it saves, even with no change. Needs:
both files on disk. Read-only. Returns: comparison with file_1 and file_2
(size, modified time, SHA-256), identical and size_delta_bytes.
Inputs: input_data (required). Returns: object
compare_templatesCompare TemplatesARead-onlyIdempotent
Compare two template files on disk: whether they are byte-identical, and how their sizes differ.
Use it to tell whether two templates are the same file. It does not read the
templates' settings, so it can't say which properties or dimensions differ.
Needs: both files on disk. Read-only. Returns: comparison with file_1 and
file_2 (size, modified time, SHA-256), identical and size_delta_bytes.
Inputs: input_data (required). Returns: object
create_assemblyCreate AssemblyA
Create a new, empty assembly document and make it active, ready for insert_component.
Uses template (an .asmdot) or the default assembly template. It is not saved
until save_file. Needs: SolidWorks running. Changes: opens a new assembly
document. Returns: assembly with name and template. Then call
insert_component for each part.
Inputs: input_data (required). Returns: object
create_axisCreate Reference AxisA
Add a reference axis along the model's x, y or z direction, through the origin.
Use it before pattern_circular, which rotates features about an axis. It is
built where two default planes meet. Needs: an open part. Changes: adds an axis
feature. Returns: axis with name (e.g. "Axis1", for
create_reference_plane's axis), reference, planes and the feature counts.
Inputs: input_data (required). Returns: object
create_base_flangeBase FlangeA
Start a sheet-metal part: a base flange from a sketch, with its thickness, bend radius and K-factor.
A closed sketch (a rectangle) makes a flat plate; an open one (a line or an L)
makes a bent profile extruded by depth. Use it as a sheet-metal part's
first feature, then add_edge_flange, create_sketched_bend and
set_flat_pattern; export the blank with export_flat_pattern. The values
are read back from the feature. Needs: an open part with the profile sketch
closed. Changes: adds a Base-Flange feature and makes the part sheet metal.
Returns: flange with name, thickness_mm, bend_radius_mm, k_factor
and volume_after (mm³).
Inputs: input_data (required). Returns: object
create_configurationAdd ConfigurationA
Add a configuration to the active part or assembly, e.g. a long and a short version of one part.
A configuration holds its own dimension values and suppressed features;
give parent to derive it from another. The configuration that was active
stays active unless activate is on. Needs: an open part or assembly.
Changes: adds a configuration. Returns: configuration with name,
parent, active and every name in configurations.
Inputs: input_data (required). Returns: object
create_cut_extrudeCreate Extruded CutA
Cut material from the active part with a closed sketch profile: holes, slots, windows.
Use it after exit_sketch. Pass sketch_name unless the sketch you just closed
is the one: with no name only that sketch is used, and any doubt is an error
naming the sketches found. A one-way cut that finds no material is retried the
other way (direction_flipped). For a sketch inside the body, use
ThroughAllBoth. Needs: an open part with a solid body. Changes: adds a
Cut-Extrude feature. Returns: cut_extrude (name, sketch_name,
direction_flipped) and measured_change (volume, bounding box and solid-body
count before and after; left out when the model can't be read).
Inputs: input_data (required). Returns: object
create_detail_viewCreate Detail ViewA
Magnify a circular area of a drawing view as a detail view, at a scale.
Give the circle's centre (sheet mm, inside the view) and radius, where the new
view goes, and its scale. A centre outside the view or a position off the sheet
is refused before anything changes. Needs: an open, active drawing with that
view. Changes: adds a detail view and its circle. Returns: view with name,
label, scale, parent and outline_mm.
Inputs: input_data (required). Returns: object
create_drawingCreate DrawingA
Create a new, empty drawing document and make it active.
Uses template (a .drwdot) or the default drawing template. Then place views
with create_drawing_view; for a whole drawing from a model in one call, use
generate_drawing_package instead (both in the drawing toolset). Needs: SolidWorks running. Changes: opens a
new drawing document. Returns: drawing with name and template.
Inputs: input_data (required). Returns: object
create_drawing_viewCreate Drawing ViewA
Place one named view of a part or assembly on the active drawing sheet.
Use it to add views one at a time; for the three standard views in one call, use
create_technical_drawing, and for a whole drawing from a model, use
generate_drawing_package.
Needs: an open, active drawing and the model file on disk. Changes: adds a view
to the sheet. Returns: data with the view's name, orientation, position,
scale and the view counts before and after.
Inputs: input_data (required). Returns: object
create_exploded_viewCreate Exploded ViewA
Explode the active assembly, automatically or step by step, and show it.
Use it to show how an assembly goes together, and before an exploded
drawing view (create_drawing_view with exploded, drawing toolset). With no steps SolidWorks
explodes it automatically; each step moves named components a distance
along x, y or z. Needs: an open assembly. Changes: adds an exploded view
to the active configuration and shows it. Returns: exploded_view with
its view name, steps, and the bounding box size_before_mm and
size_after_mm. A component it doesn't hold fails as not_found.
Inputs: input_data (required). Returns: object
create_extrusionCreate ExtrusionA
Extrude the sketch you just closed into a solid boss, added to the active part.
Use it after exit_sketch; to remove material, use create_cut_extrude. It
extrudes the sketch sketch_name names, or the one exit_sketch closed last;
a name that isn't in the feature tree fails before anything is built. End
conditions: Blind (default), MidPlane, ThroughAll, UpToNext; both_directions
means MidPlane. With thin_feature and thin_thickness it makes a wall from the
sketch's outline, and an open chain works (a bent plate from its centreline).
Needs: an open part and a closed profile (open is fine when thin). Changes:
adds a Boss-Extrude feature. Returns: extrusion (name, sketch when one
was named, depth, the end_condition SolidWorks used, both_directions,
and thin when thin) and
measured_change (volume, bounding box and solid-body count before and after;
left out when the model can't be read).
Inputs: input_data (required). Returns: object
create_holeHole Wizard HoleA
Add a standard Hole Wizard hole (simple, counterbored, countersunk or tapped) at a point on a flat face.
Use it instead of sketching a circle and cutting: the hole is sized from the
standard, so it fits the fastener and a drawing shows its callout. Several
holes on one face: give the rest as positions (one feature, a hole at each
point); a regular grid can also use pattern_linear. Sizes come from the
Hole Wizard library (list_hole_sizes): an unknown size is refused, with the
nearest ones, before anything is made. A simple hole can't be through all in
SolidWorks, so it is made blind through the part (end_condition_used, with
a warning). It fails when the volume doesn't change. Needs: an open part with
a flat face at face_point. Changes: adds a hole feature. Returns: hole
with name, hole_count, hole_type, standard, fastener (the hole type
used), size, end_condition, end_condition_used, and volume_before,
volume_after and volume_change (mm³).
Inputs: input_data (required). Returns: object
create_loftCreate LoftA
Loft a solid through two or more closed profile sketches, in order (Insert > Boss/Base > Loft).
Use it for shapes that change section, such as a wing or a transition duct. Put
each profile on its own plane (see create_reference_plane). Needs: an open
part with the profile sketches. Changes: adds a Loft feature. Returns: loft
with name, profiles and guide_curves.
Inputs: input_data (required). Returns: object
create_partCreate PartA
Create a new, empty part document and make it active, ready for create_sketch.
Uses template (a .prtdot) or the default part template, then sets units if
given, and assigns material if given. The part is not saved until
save_file. Needs: SolidWorks running. Changes: opens a new part document.
Returns: part with name, units, template and material (the one
assigned, or null), plus a warning when the material couldn't be assigned;
the part is created either way.
Inputs: input_data (required). Returns: object
create_reference_planeCreate Reference PlaneA
Add a reference plane offset from, at an angle to, or on a plane or flat face.
Use it to sketch somewhere other than the three default planes: pass the new
plane's name to create_sketch. Offset: reference and a non-zero offset
(mm). Angle: reference, angle (degrees) and axis, an axis lying in the
reference (make one with create_axis). Face: face_point, a point on a flat
face (sloped or not), with an offset or 0 for a plane on the face. Needs: an
open part. Changes: adds a plane feature. Returns: plane with name and the
inputs used.
Inputs: input_data (required). Returns: object
create_reference_pointCreate Reference PointA
Add a reference point on an edge (at a distance or percentage along it) or at the centre of a face.
Use it to mark a position for a later feature or measurement. Pick the edge or
face with a point on it in mm. Needs: an open part with that edge or face.
Changes: adds a point feature. Returns: point with mode, at_mm,
distance_mm or percent, and the feature counts.
Inputs: input_data (required). Returns: object
create_revolveCreate RevolveA
Revolve a closed sketch around an axis, adding a solid to the active part.
Use it for turned shapes (shafts, knobs). It revolves the sketch sketch_name
names, or the one exit_sketch closed last, about the reference axis
axis_entity names (from create_axis), or about the centreline drawn in the
sketch with add_centerline. A sketch or axis that isn't in the model fails
before anything is built. Needs: an open part and a closed profile with a
centreline or a reference axis. Changes: adds a Revolve feature. Returns:
revolve (name, sketch and axis_entity when named, angle) and
measured_change (volume, bounding box and solid-body count before and
after; left out when the model can't be read).
Inputs: input_data (required). Returns: object
create_ribRibA
Add a rib from a sketched line, stiffening a wall or the inside of a shell.
Sketch an open line where the rib goes (it can stop short of the walls; the
rib extends to meet them), close the sketch, then call this with its name.
It fails when the volume doesn't change. Needs: an open part and the rib
sketch. Changes: adds a Rib feature. Returns: rib with name, sketch,
thickness_mm, and volume_before, volume_after and volume_change (mm³).
Inputs: input_data (required). Returns: object
create_section_viewCreate Section ViewA
Cut a section view along a line across a drawing view, and place it on the sheet.
Give the line's ends in sheet mm so it crosses the view (e.g. through a hole's
centre), and where the new view goes. A line that misses the view, or a position
off the sheet, is refused before anything changes. Needs: an open, active drawing
with that view. Changes: adds a section view and its section line. Returns:
view with name, label, parent and outline_mm.
Inputs: input_data (required). Returns: object
create_shellShellA
Hollow the active part to a wall thickness, opening the faces picked.
Use it for boxes, housings and cups: pick the face to open with a point on
it (mm). It fails when the volume doesn't change. Needs: an open part with a
solid body. Changes: adds a Shell feature. Returns: shell with name,
thickness_mm, faces_removed, and volume_before, volume_after and
volume_change (mm³).
Inputs: input_data (required). Returns: object
create_sketchCreate SketchA
Open a new sketch on a plane or a flat face of the active part, ready for lines, circles and other sketch entities.
Use it first in every feature: sketch, draw, exit_sketch, then
create_extrusion or create_cut_extrude. Planes: Front, Top, Right (or XY,
XZ, YZ), or a plane made by create_reference_plane. Or give face_point, a
point in mm on a flat face of the body: the sketch opens on that face and moves
with it when the model changes. Coordinates in the sketch are mm from the
origin. Needs: an open part. Changes: adds a sketch and opens it for editing;
give sketch_name and exit_sketch names it that when it closes it (SolidWorks
won't rename an open sketch). Returns: sketch with name (the name in the
feature tree now) and plane (or face_point), plus name_on_exit when you
gave sketch_name. A face_point not on a flat face fails with
invalid_input.
Inputs: input_data (required). Returns: object
create_sketched_bendSketched BendA
Bend a sheet-metal part along a line sketched on one of its faces.
Sketch a line across a face of the sheet (create_sketch with face_point,
then add_line), close the sketch, then call this. SolidWorks chooses which
side of the line stays put; the reply's bounding_box_mm shows which side
moved, and reverse bends the other way. Needs: a sheet-metal part and the
bend-line sketch. Changes: adds a Sketched Bend feature. Returns: bend
with name and bounding_box_mm.
Inputs: input_data. Returns: object
create_sweepCreate SweepA
Sweep a closed profile sketch along a path sketch to make a solid (Insert > Boss/Base > Sweep).
Draw the closed profile and the open path as two sketches first. The profile is
the sketch you closed last that isn't the path. Needs: an open part with both
sketches. Changes: adds a Sweep feature. Returns: sweep with name, path,
twist_along_path and twist_angle.
Inputs: input_data (required). Returns: object
create_technical_drawingCreate Technical DrawingA
Place a model's three standard views (front, top and side) on the active drawing sheet in one call.
Use it to start a drawing's views quickly; for one view, use
create_drawing_view, and to create and save a complete drawing from a model
file, use generate_drawing_package. Views are laid out in projection
(third-angle by default). Needs: an open, active drawing and the model file on
disk. Changes: adds three views to the sheet. Returns: data with views (the
names added), model_path, projection and the view counts.
Inputs: input_data (required). Returns: object
delete_configurationDelete ConfigurationADestructive
Delete a configuration of the active model; not the active one or the only one.
Activate another configuration first to delete the active one. Needs: an
open part or assembly with that configuration. Changes: removes it.
Returns: deleted and the configurations left.
Inputs: input_data (required). Returns: object
delete_equationDelete EquationADestructive
Delete an equation or global variable of the active part or assembly, by name.
A dimension the equation drove keeps its last value; an equation that
used a deleted global variable stops solving, so check
list_equations afterwards. Needs: an open part or assembly with that
equation. Changes: removes the equation. Returns: deleted and the
equations left (names).
Inputs: input_data (required). Returns: object
delete_featureDelete FeatureADestructive
Delete a feature or sketch from the active model, along with the features that depend on it.
Ask the user before you call it: deleting a sketch also deletes every feature
built from it (a cut, a boss), and deleting a feature deletes everything that
depends on it. Use suppress_feature instead when you might want it back. Find
names and dependents with list_features. Needs: an open part or assembly.
Changes: removes the feature and its dependents (undo can restore them).
Returns: data with deleted, removed_features (every feature that went,
dependents included), features_before and features_after; the message names
the dependents, and a warning says so whenever more than the named feature
went: tell the user.
Inputs: input_data (required). Returns: object
discover_solidworks_docsRebuild SolidWorks API IndexAIdempotent
Rebuild the SolidWorks API index on purpose. The lookups don't need it.
The lookup tools (lookup_api_method, lookup_api_interface, find_related_api_members, search_solidworks_api_help) build the index themselves on first use, so call this only to rebuild it, to read a specific SolidWorks year, or to save a copy elsewhere. It reads every interface in the installed SolidWorks type library (each member's parameters, return type and description), plus the VBA library references. SolidWorks must be installed, not running; it is never started or called. Changes: writes the index file, replacing the saved one.
Returns summary (interface, method and property counts),
type_library (version, year and .tlb path), year and
output_file, the saved index (megabytes, so it is not returned).
Fails with a message naming the installed years when year isn't
installed, or saying SolidWorks isn't installed here.
Example input: {"year": 2026}
Inputs: input_data. Returns: object
execute_macroRun MacroADestructive
Run a SolidWorks macro (.swp, or legacy .swb), or VBA source text, in the running SolidWorks, calling its main procedure.
Use it for a macro file, or VBA you wrote as vba_source. Source runs only
if the user set SOLIDWORKS_MCP_ALLOW_VBA_SOURCE to restricted or full, else
vba_source_off: ask the user, never set it yourself. Restricted source may
call SolidWorks on the open documents only, else vba_source_refused,
naming each line. The reply gives source_file and the vba_source run.
The macro must not wait for the user: a dialog still open after
dialog_timeout s (30) is answered with Cancel or its only button, and the
run fails as macro_waited_for_user; a Yes/No prompt is left. It runs
repeat_count times, pause_between_runs s apart, stopping at the first
failure. Needs: SolidWorks running. Changes: whatever the macro does; it
can't be undone from here. Returns: runs_completed and data from the
last run (macro_path, module_name, proc_name, errors).
Inputs: input_data (required). Returns: object
exit_sketchExit SketchAIdempotent
Close the open sketch so a feature can use it.
Call it after drawing and before create_extrusion, create_revolve or
create_cut_extrude; those use the sketch closed last. Needs: an open sketch.
Changes: leaves sketch editing; the sketch stays in the feature tree, renamed
to the sketch_name create_sketch was given. Returns: a message, plus, after
a sketch_name, sketch with name (the name in the feature tree, which later
tools take as sketch_name) and a warning when the name couldn't be given
(another feature has it).
Inputs: no named parameters. Returns: object
export_dwgExport DWGADestructiveIdempotent
Export the active document to DWG, like File > Save As with the DWG type.
Use it to hand a drawing to AutoCAD users. SolidWorks picks the format from the
file's extension, so end file_path in .dwg. Needs: an open, active drawing.
Changes: writes the file, creating its folder and replacing a file already
there; the open document is unchanged. Returns: export with file_path and
format.
Inputs: input_data (required). Returns: object
export_flat_patternExport Flat PatternADestructiveIdempotent
Export the active sheet-metal part's flat pattern to DXF or DWG, for laser or waterjet cutting.
It writes the flat outline only, without bend lines or sketches. A part with no
sheet-metal body is not_found and nothing is written. Needs: an open, active
sheet-metal part. Changes: writes the file, replacing one already there.
Returns: data with file_path and size_bytes.
Inputs: input_data (required). Returns: object
export_igesExport IGESADestructiveIdempotent
Export the active document to IGES, like File > Save As with the IGES type.
Use it only when the receiver can't read STEP; prefer export_step. SolidWorks
picks the format from the file's extension, so end file_path in .igs or .iges.
Needs: an open, active part or assembly. Changes: writes the file, creating its
folder and replacing a file already there; the open document is unchanged.
Returns: export with file_path and format.
Inputs: input_data (required). Returns: object
export_imageExport ImageADestructiveIdempotent
Save a picture of the active model in a standard view, as PNG or JPG, at a chosen size.
Use it to show a result, or to check a model's shape after a change. The view is
set first (front, back, left, right, top, bottom, isometric, dimetric,
trimetric, or current to keep the user's view). Needs: an open, active document.
Changes: writes the image file, and turns the model to the view asked for.
Returns: data with file_path, format, dimensions (the size written),
requested_dimensions and view.
Inputs: input_data (required). Returns: object
export_pdfExport PDFADestructiveIdempotent
Export the active document to PDF, like File > Save As with the PDF type.
Use it to share a drawing; generate_drawing_package (drawing toolset) already
saves a PDF with the drawing it creates. SolidWorks picks the format from the file's extension,
so end file_path in .pdf. Needs: an open, active drawing (a part or assembly
gives a PDF of the view). Changes: writes the file, creating its folder and
replacing a file already there; the open document is unchanged. Returns:
export with file_path and format.
Inputs: input_data (required). Returns: object
export_stepExport STEPADestructiveIdempotent
Export the active document to STEP, like File > Save As with the STEP type.
Use it to hand a model to another CAD system; it is the most widely read
exchange format. SolidWorks picks the format from the file's extension, so end
file_path in .step or .stp. Needs: an open, active part or assembly. Changes:
writes the file, creating its folder and replacing a file already there; the
open document is unchanged. Returns: export with file_path and format.
Inputs: input_data (required). Returns: object
export_stlExport STLADestructiveIdempotent
Export the active document to STL, like File > Save As with the STL type.
Use it for 3D printing. An assembly is exported whole, with lightweight
components resolved first. SolidWorks picks the format from the file's
extension, so end file_path in .stl. Needs: an open, active part or assembly.
Changes: writes the file, creating its folder and replacing a file already
there; the open document is unchanged. Returns: export with file_path and
format, plus warning when SolidWorks wrote the file without its STL options
(bodies not merged into one file).
Inputs: input_data (required). Returns: object
generate_drawing_packageGenerate Drawing PackageADestructiveIdempotent
Create a complete A3 drawing of a part or assembly in one call, and save it with a PDF.
It opens a new drawing with an A3 ISO frame and fills the title block (title,
number, material, weight, drawn by, date, revision). It places front, plan, side
and isometric views at one standard scale, shows the model dimensions once in
tidy rows, and adds view captions and a NOTES block. Then it checks nothing
overlaps. Use it instead of the step-by-step drawing tools when you want the
whole drawing. Needs: the model file on disk. Changes: saves
<drawing_number>.SLDDRW and a PDF, replacing files of those names, and by
default writes Description, Material and Weight into the model and saves it
(turn off with write_model_properties). Returns: data with scale, views,
dimensions, overlap_check, title_block, drawing_path, pdf_path and
steps. A remaining overlap makes the call an error carrying that data; for
long title-block text pass title_block_text_height_mm (e.g. 3).
Inputs: input_data. Returns: object
generate_vba_assembly_insertGenerate VBA: Insert ComponentARead-onlyIdempotent
Write a VBA macro that inserts a component into the active assembly at a point.
To insert a component directly, use insert_component. The macro comes back as
text for the SolidWorks VBA editor (Alt+F11); execute_macro runs only binary
.swp files, so it can't run this directly. Read-only. Nothing runs in
SolidWorks. Returns: vba_code, the parameters used and usage_instructions.
Inputs: input_data (required). Returns: object
generate_vba_assembly_matesGenerate VBA: Assembly MatesARead-onlyIdempotent
Write a VBA macro that adds a concentric, distance, parallel, perpendicular or coincident mate between two selected faces or edges.
To add a mate directly, use add_mate. The macro comes back as text for the
SolidWorks VBA editor (Alt+F11); execute_macro runs only binary .swp files, so
it can't run this directly. The faces must be selected in SolidWorks before the
macro runs. Read-only. Nothing runs in SolidWorks. Returns: vba_code, the
parameters used and usage_instructions.
Inputs: input_data (required). Returns: object
generate_vba_batch_exportGenerate VBA: Batch ExportARead-onlyIdempotent
Write a VBA macro that opens every matching file in a folder and saves a STEP copy of each to another folder.
To export one file directly, use export_step. The macro comes back as text for
the SolidWorks VBA editor (Alt+F11); execute_macro runs only binary .swp
files, so it can't run this directly. Read-only. Nothing runs in SolidWorks.
Returns: vba_code, the parameters used and usage_instructions.
Inputs: input_data (required). Returns: object
generate_vba_codeGenerate VBA CodeARead-onlyIdempotent
Write a VBA macro skeleton for an operation you describe: the SolidWorks connection, a check of the active document's type and optional error handling, with the operation itself left as a TODO.
Use it as a starting point for a custom macro. For a complete macro for a
specific feature, use a generate_vba_* tool (extrusion, revolve, mates,
drawing views, batch export). The macro reports through Debug.Print, never a
dialog, so it runs without waiting on anyone: save it as a .swb file and run it
with execute_macro (its Sub main() calls the Sub named sub_name; SolidWorks
runs a .swb macro only through main). It stops, printing why,
when the active document isn't target_document. Read-only. Nothing runs in
SolidWorks. Returns: vba_code with code, sub_name, operation,
target_document, lines_of_code and includes_error_handling.
Inputs: input_data (required). Returns: object
generate_vba_drawing_dimensionsGenerate VBA: Drawing DimensionsARead-onlyIdempotent
Write a VBA macro that adds a dimension to the selected drawing entities and sets its precision.
To bring the model's dimensions into a drawing directly, use
insert_model_dimensions. The macro comes back as text for the SolidWorks VBA
editor (Alt+F11); execute_macro runs only binary .swp files, so it can't run
this directly. The entities must be selected before the macro runs. Read-only.
Nothing runs in SolidWorks. Returns: vba_code, the parameters used and
usage_instructions.
Inputs: input_data (required). Returns: object
generate_vba_drawing_viewsGenerate VBA: Drawing ViewsARead-onlyIdempotent
Write a VBA macro that places a model's standard views (front, top, right) on the active drawing.
To make a drawing directly, use generate_drawing_package or
create_drawing_view. The macro comes back as text for the SolidWorks VBA
editor (Alt+F11); execute_macro runs only binary .swp files, so it can't run
this directly. Read-only. Nothing runs in SolidWorks. Returns: vba_code, the
parameters used and usage_instructions.
Inputs: input_data (required). Returns: object
generate_vba_extrusionGenerate VBA: ExtrusionARead-onlyIdempotent
Write a VBA macro that makes an extrusion with the full FeatureExtrusion options: both directions, draft, thin wall, end conditions.
Use it when create_extrusion doesn't cover an option you need, or to hand the
step to someone as a macro. The macro comes back as text for the SolidWorks VBA
editor (Alt+F11); execute_macro runs only binary .swp files, so it can't run
this directly. Read-only. Nothing runs in SolidWorks. Returns: vba_code, the
parameters used and usage_instructions.
Inputs: input_data (required). Returns: object
generate_vba_file_operationsGenerate VBA: File OperationsARead-onlyIdempotent
Write a VBA macro that sets a custom property in every configuration, or runs Pack and Go on the active document.
To set a property directly, use set_custom_property; for Pack and Go, use
pack_and_go_assembly. The macro comes back as text for the SolidWorks VBA
editor (Alt+F11); execute_macro runs only binary .swp files, so it can't run
this directly. Read-only. Nothing runs in SolidWorks. Returns: vba_code, the
parameters used and usage_instructions.
Inputs: input_data (required). Returns: object
generate_vba_macro_recorderGenerate VBA: Macro RecorderARead-onlyIdempotent
Write a VBA starting point: a macro skeleton to fill in, or a note on starting and stopping SolidWorks' macro recorder.
Use "create_template" for an empty macro with the usual SolidWorks setup.
Recording itself is done in SolidWorks (Tools > Macro > Record). The macro comes
back as text for the SolidWorks VBA editor (Alt+F11); execute_macro runs only
binary .swp files, so it can't run this directly. Read-only. Nothing runs in
SolidWorks. Returns: vba_code, the parameters used and usage_instructions.
Inputs: input_data (required). Returns: object
generate_vba_part_modelingGenerate VBA: Part ModelingARead-onlyIdempotent
Write a VBA macro for a shell or a fillet on the active part.
Use it for a shell, which no direct tool makes yet; for a fillet, add_fillet
works directly. The macro comes back as text for the SolidWorks VBA editor
(Alt+F11); execute_macro runs only binary .swp files, so it can't run this
directly. Read-only. Nothing runs in SolidWorks. Returns: vba_code, the
parameters used and usage_instructions.
Inputs: input_data (required). Returns: object
generate_vba_revolveGenerate VBA: RevolveARead-onlyIdempotent
Write a VBA macro that revolves the selected sketch, with both-direction and thin-wall options.
Use it when create_revolve doesn't cover an option you need. The macro comes
back as text for the SolidWorks VBA editor (Alt+F11); execute_macro runs only
binary .swp files, so it can't run this directly. Read-only. Nothing runs in
SolidWorks. Returns: vba_code, the parameters used and usage_instructions.
Inputs: input_data (required). Returns: object
get_api_enumGet API EnumARead-onlyIdempotent
Look up a SolidWorks API enum's members and their integer values.
Use this when a call takes an enum value, such as a unit system or a
user preference, instead of guessing the number: the values aren't in
the API help pages. Give the enum (swUnitSystem_e) or one of its
members (swUnitSystem_IPS); a member's name returns its whole
enum with matched_member set. Names match regardless of case. The
values come from SolidWorks' constants type library installed on this
machine.
Setup: none. SolidWorks must be installed, not running; it is never
contacted. Read-only. The first lookup builds the index (about a
second) and later ones reuse it. index_status is ready,
rebuilt or unavailable.
Returns result with enum, description and members
(name and value in declaration order). result.found false
means there's no such enum or member, or no index could be built;
result.note says which.
Example input: {"name": "swUnitSystem_e"}
Inputs: input_data. Returns: object
get_custom_propertiesGet Custom PropertiesARead-onlyIdempotent
Read the active document's custom properties, such as PartNo, Description or Revision.
File-level properties (the default) are what drawing title blocks and BOMs
usually read; give configuration for that configuration's own. Needs: an open,
active document. Read-only. Returns: data with properties, each name mapped
to its value and resolved value (a $PRP link evaluated).
Inputs: input_data. Returns: object
get_dimensionGet DimensionARead-onlyIdempotent
Read one dimension of the active model by its full name, e.g. "D1@Sketch1".
Find names with list_model_dimensions. It reads the active configuration's
value; activate_configuration to read another. Needs: an open part or
assembly. Read-only. Returns: dimension with name, value and units: "mm" for a
length, "deg" for an angle, and null for a count (such as a pattern's
instance count).
Inputs: input_data (required). Returns: object
get_file_propertiesGet File PropertiesARead-onlyIdempotent
Deprecated: use get_model_info.
Report the active document's file details: name, path, size, dates, type, configuration and unsaved changes.
Use it to check what is open and whether it has unsaved changes before saving or
closing. For the model itself (rebuild status included), use get_model_info;
for custom properties, use get_custom_properties. Needs: an open, active
document. Read-only. Returns: properties with file_name, file_path,
file_size_bytes, created_date and modified_date (Unix timestamps; empty
for a document never saved), document_type, configuration, is_dirty and
feature_count.
Inputs: no named parameters. Returns: object
get_mass_propertiesGet Mass PropertiesARead-onlyIdempotent
Measure the active part or assembly's mass properties: volume, surface area, mass, centre of mass and moments of inertia.
Use it to check weight or balance. To compare a model with the values you
expect, use verify_model. Mass depends on the assigned material
(set_material). Needs: an open part or assembly. Read-only. It rebuilds first.
Returns: mass_properties with volume (mm³), surface_area (mm²), mass
(kg), center_of_mass (mm), moments_of_inertia (kg·mm², about the centre
of mass) and principal_axes.
Inputs: input_data. Returns: object
get_materialGet MaterialARead-onlyIdempotent
Report the active part's material with its strength and stiffness, or any library material's.
Use it to size a part (the elastic modulus and yield strength) or to compare
materials before set_material, and before get_mass_properties (without a
material SolidWorks uses a default density). Give material to read a library
material without assigning it: no document is needed and none changes.
Needs: an open, active part unless material is given (any other document is
wrong_document_type). Read-only. Returns: data with material (null when
none is assigned), database, density_kg_m3, source (part or library) and
properties: elastic_modulus, poissons_ratio, shear_modulus,
tensile_strength, yield_strength, compressive_strength, density,
thermal_expansion, thermal_conductivity, specific_heat, each with
value in SI units (Pa; divide by 1e6 for MPa), unit and label. A
property the library doesn't hold for that material is left out.
Inputs: input_data. Returns: object
get_model_infoGet Model InfoARead-onlyIdempotent
Report the active document's title, path, type, configuration, unsaved changes, feature count, rebuild status and file details.
Use it first in a session, to see which document is active (it follows a switch
made in the SolidWorks window). For every open document, use
list_open_documents; for custom properties, get_custom_properties. Needs: an
open document. Read-only. Returns: model_info with title, path, type,
configuration, is_dirty, feature_count, rebuild_status (0 rebuilt, 1
needs a rebuild), and the file's size_bytes, created and modified (Unix
timestamps; null for a document never saved).
Inputs: no named parameters. Returns: object
get_selected_entitiesGet Selected EntitiesARead-onlyIdempotent
Describe the faces, edges and vertices selected in the SolidWorks window right now.
Use it when the user has clicked something and says "this face": it reads the
selection instead of guessing from a screenshot. To select edges yourself, use
select_face_edges. Needs: an open document. Read-only. Returns: entities
(each with index and type; a face adds bounding_box_mm, center_mm,
area_mm2 and normal when flat, an edge start_mm, end_mm and
straight-line length_mm, a vertex point_mm) and count.
Inputs: no named parameters. Returns: object
insert_bom_tableInsert BOM TableA
Insert a bill-of-materials table for an assembly view on the active drawing.
Use it on an assembly drawing after placing a view of the assembly (see
list_drawing_views for view names). Needs: an open, active drawing with a view
of an assembly. Changes: adds a BOM table to the sheet. Returns: data with
view, bom_type, template and row_count. An unknown view is not_found
and the message lists the views.
Inputs: input_data. Returns: object
insert_componentInsert ComponentA
Insert a part or sub-assembly file into the active assembly at a position in mm.
Use it after create_assembly, then position components with add_mate. The
file must contain solid geometry; an empty or missing file is an error. Needs:
an open, active assembly and the file on disk. Changes: adds a component.
Returns: component with its instance name (component, which add_mate
takes), file_path, position and the counts before and after.
Inputs: input_data (required). Returns: object
insert_model_dimensionsInsert Model DimensionsA
Bring the model's dimensions into the active drawing's views, each dimension shown once.
Imports the model's "marked for drawing" dimensions view by view; a repeat in a
later view is deleted. Pictorial views (isometric, dimetric, trimetric) are
skipped unless named. Falls back to SolidWorks AutoDimension only when nothing
could be imported. SolidWorks places them inside the views, so run
arrange_dimensions next. Needs: an open, active drawing with views. Changes:
adds dimensions to the views. Returns: data with per-view views
(before/after counts, duplicates_removed), dimensions_added,
unique_dimensions, skipped_pictorial_views and the method used. An unknown
view is not_found.
Inputs: input_data. Returns: object
list_available_materialsList Available MaterialsARead-onlyIdempotent
List the materials in the installed SolidWorks material libraries.
Use it to find the exact name set_material needs; filter with search (e.g.
"steel" or "6061"). It reads every .sldmat library SolidWorks is set to use.
Needs: SolidWorks installed. Read-only. Returns: data, each material's name,
classification and database; the message gives the total and the folders
read, so an empty search can be told from a missing library.
Inputs: input_data. Returns: object
list_componentsList ComponentsARead-onlyIdempotent
List the top-level components of the active assembly by instance name, e.g. "bracket-1".
Use it before add_mate, which takes these names. Needs: an open, active
assembly. Read-only. Returns: components (instance names).
Inputs: no named parameters. Returns: object
list_configurationsList ConfigurationsARead-onlyIdempotent
List the names of the active model's configurations, and which one is active.
Use it to see which configurations a part or assembly has before
activate_configuration or delete_configuration. Needs: an open part or
assembly. Read-only. Returns: configurations (names), count and
active (null when it can't be read).
Inputs: no named parameters. Returns: object
list_drawing_viewsList Drawing ViewsARead-onlyIdempotent
List the views on the active drawing, by name.
Use it before auto_center_marks, insert_model_dimensions or any tool that
takes a view name. Needs: an open, active drawing. Read-only. Returns: views
(names, sheet formats left out) and count.
Inputs: no named parameters. Returns: object
list_equationsList EquationsARead-onlyIdempotent
List the active part's or assembly's equations and global variables, with their values.
Use it before set_equation or delete_equation, to see which values
drive which dimensions. Needs: an open part or assembly. Read-only.
Returns: equations, each with index, name, expression, kind
(global_variable, dimension or other) and value (solved, in the
document's units; null when SolidWorks has none), and count.
Inputs: no named parameters. Returns: object
list_featuresList FeaturesARead-onlyIdempotent
List the feature tree of the active part or assembly, in order.
Use it before editing a model, to find a feature's exact name for
delete_feature, suppress_feature or rename_feature. For an assembly it
also lists each component's features, down to max_assembly_depth levels.
Needs: an open part or assembly. Read-only. Returns: features (each with
name, type, suppressed and, in an assembly, component), count, and
assembly_tree, the same list grouped by component.
Inputs: input_data (required). Returns: object
list_hole_sizesList Hole Wizard SizesARead-onlyIdempotent
List the Hole Wizard's hole types and sizes for a standard, or one size's dimensions.
Read from SolidWorks' installed Hole Wizard library, so the sizes are the
ones create_hole accepts; it works without SolidWorks running. Give
hole_type for every hole type of that kind with its sizes, add fastener
for one type only, or size for its dimensions (counterbore diameter and
depth, head diameter, pitch: mm, inches for ansi_inch). Needs: SolidWorks'
Toolbox library on this machine (or SOLIDWORKS_MCP_HOLE_LIBRARY). Changes:
nothing. Returns: library with standard, hole_type, units and either
hole_types (each name and sizes) or fastener and dimensions.
Inputs: input_data (required). Returns: object
list_model_dimensionsList Model DimensionsARead-onlyIdempotent
List every dimension in the active part or assembly with its full name and value.
Use it to find a dimension in an existing model before changing it: each
full_name (e.g. "D1@Sketch1") is the name get_dimension and set_dimension
take. Each dimension is listed once, under the feature its full name names
after the @ (D1@Plane1 under Plane1, never also under a cut sketched on
that plane). Needs: an open part or assembly. Read-only. Returns: data, one
entry per dimension with full_name, feature, value (document units),
system_value (metres or radians) and read_only.
Inputs: input_data. Returns: object
list_open_documentsList Open DocumentsARead-onlyIdempotent
List every document open in SolidWorks and say which one is active.
Use it before activate_document, or when tool calls seem to act on the wrong
document. Needs: SolidWorks running. Read-only. Returns: documents (each with
title, path, type and is_active) and count.
Inputs: no named parameters. Returns: object
load_assemblyLoad AssemblyAIdempotent
Deprecated: use open_model.
Open an assembly (.sldasm) from disk and make it the active document.
Use it to start work on an existing assembly; for any document type, use
open_model, and to switch to a document that is already open, use
activate_document. A path that isn't a .sldasm is refused. Needs: the file on
disk. Changes: opens the assembly (no file is written). Returns: model with
name, type, path and configuration (the one SolidWorks opened, or
null when it can't be read).
Inputs: input_data (required). Returns: object
load_partLoad PartAIdempotent
Deprecated: use open_model.
Open a part (.sldprt) from disk and make it the active document.
Use it to start work on an existing part; for any document type, use
open_model, and to switch to a document that is already open, use
activate_document. A path that isn't a .sldprt is refused. Needs: the file on
disk. Changes: opens the part (no file is written). Returns: model with
name, type, path and configuration (the one SolidWorks opened, or
null when it can't be read).
Inputs: input_data (required). Returns: object
lookup_api_interfaceLook Up API InterfaceARead-onlyIdempotent
List every method and property of a SolidWorks COM interface.
Use this to see what an interface offers, such as IFeatureManager, or to check which interface a member is really on before calling it. For one member's parameters, use lookup_api_method. Names match regardless of case.
Setup: none. SolidWorks must be installed, not running; it is never
contacted. Read-only. The first call builds the index (about a
second) and later calls reuse it. index_status is ready
(saved index), rebuilt (built for this call) or unavailable
(no index could be built).
Returns result with methods, properties and their counts.
result.found false means the interface isn't in the type library,
or no index could be built, in which case result.note says why.
Example input: {"interface": "IFeatureManager"}
Inputs: input_data. Returns: object
lookup_api_methodLook Up API MethodARead-onlyIdempotent
Look up one SolidWorks API method or property: parameters, return type, description.
Use this before writing or debugging a SolidWorks API call (VBA, a macro or COM) to check that the member exists on that interface and how to call it. Answers come from the SolidWorks type library installed on this machine, so they match the installed version.
Setup: none. SolidWorks must be installed, not running; it is never
contacted. Read-only. The first lookup builds the index (about a
second). index_status is ready, rebuilt or
unavailable.
Names match regardless of case, as COM does. result.member is
SolidWorks' own spelling, with a note when yours differs. Each
parameter has a type and a direction: in, out
(SolidWorks fills it) or in_out (pass a variable by reference).
return_type is null when the method returns nothing; a property
has its value type there and an access. result.found false
means there is no such member, and result.note says why,
including when no index could be built (SolidWorks isn't installed
here, or the requested year isn't).
Example input: {"interface": "ISldWorks", "method": "OpenDoc6"}
Inputs: input_data. Returns: object
measure_entitiesMeasure EntitiesARead-onlyIdempotent
Measure faces, edges or vertices of the active model with SolidWorks' Measure tool.
One face gives area and perimeter; one edge its length, and radius and diameter
for an arc; two entities give the distance and angle between them. Use it to
check a feature's size or position; for the whole model, use verify_model.
Needs: an open part or assembly. Read-only. It clears the selection afterwards.
Returns: data with selected and the values in metres, square metres and
radians (distance_m, angle_rad, length_m, radius_m, diameter_m,
area_m2, perimeter_m; for two entities is_parallel).
Inputs: input_data (required). Returns: object
mirror_componentsMirror ComponentsA
Mirror assembly components about a plane, as instances of the same parts.
Use it for a part that appears on both sides, such as a pair of feet or
brackets. Needs: an open assembly with the components and the plane.
Changes: adds mirrored instances (no new part files). Returns: mirror
with the plane and the added instances' names. A plane it doesn't
have fails as not_found.
Inputs: input_data (required). Returns: object
mirror_featureMirror FeatureA
Mirror solid bodies or features of the active part about a plane.
Use it for symmetric parts: model one half, then mirror. Body mirroring (the
default) is what works for lofts and sweeps; to mirror a cut, name the cut and
set mirror_bodies off. It fails when the volume doesn't change, which means
nothing was mirrored. Needs: an open part with the named bodies or features.
Changes: adds a Mirror feature. Returns: mirror with name, mirrored,
mirror_plane, merge, mirror_bodies, and volume_before,
volume_after and volume_change (mm³, negative for a cut).
Inputs: input_data (required). Returns: object
open_modelOpen ModelAIdempotent
Open a part, assembly or drawing from disk and make it the active document.
Use it to start work on an existing file. To switch to a document that is
already open, use activate_document. Needs: the file on disk (a vault file
must be checked out). Changes: opens the document; nothing is written. Returns:
model with title, type, path and configuration.
Inputs: input_data (required). Returns: object
pack_and_go_assemblyPack and Go AssemblyADestructiveIdempotent
Copy an assembly and every file it uses into one folder that opens on its own.
Use it to hand over or archive an assembly. SolidWorks lists the files the
assembly uses; each is copied under its own name, as saved on disk, so save
first: a warning names any open file whose unsaved changes the copy doesn't
have. The copy opens with its own parts, since SolidWorks looks in the
assembly's folder first. It fails, copying nothing, when a file is missing,
two files share a name, or target_dir holds the originals. It refuses a
folder that already has files unless overwrite is on, and then replaces only
the files it copies. It never closes or changes a document. It can add an
isometric PNG preview. Needs: the .sldasm on disk. Changes: writes the copies
into target_dir, creating it if needed. Returns: source_assembly,
target_dir, copied_files, source_files, unsaved_changes and, with a
preview, preview_image.
Inputs: input_data (required). Returns: object
pattern_circularCircular PatternA
Repeat features of the active part around an axis, e.g. a ring of bosses or ribs.
Create the axis first with create_axis. Bosses and cuts both work (a ring of
holes is a patterned cut). It fails when the volume doesn't change, which
means no instance landed on the part. Needs: an open part with the named
features and axis. Changes: adds a circular pattern feature. Returns:
pattern with name, patterned, axis, count, angle,
equal_spacing, and volume_before, volume_after and volume_change
(mm³, negative for cuts).
Inputs: input_data (required). Returns: object
pattern_componentsPattern ComponentsA
Repeat assembly components in a row along an axis, or around one.
Use it for a row of bolts or pins, or parts around a hub. axis names a
reference axis (create_axis in the assembly); count includes the
seeds. Linear takes spacing (mm); circular takes angle (degrees, 360
spaces them equally). The row runs along the axis's own direction, which
SolidWorks picks (an x axis from create_axis runs toward -x), so check
the result with verify_model's bounding box. Needs: an open assembly
with the seeds and the axis.
Changes: adds a component pattern feature. Returns: pattern with the
feature name, the component counts before and after and the added
instances.
Inputs: input_data (required). Returns: object
pattern_linearLinear PatternA
Repeat features of the active part in a row or a grid, e.g. a row of holes.
Give the direction as a point on a straight edge (mm) or an axis name; add
direction2 for a grid. Bosses and cuts both work. SolidWorks picks which
way an edge points; if instances land off the part, set reverse or
reverse2. It fails when the volume doesn't change, which means no
instance landed on the part. Needs: an open
part with the named features. Changes: adds a linear pattern feature.
Returns: pattern with name, patterned, count, spacing_mm, and
volume_before, volume_after and volume_change (mm³).
Inputs: input_data (required). Returns: object
rebuild_modelRebuild ModelAIdempotent
Rebuild the active model and report each feature that fails, with the reason and a fix.
Use it after set_dimension or other edits to confirm the model is sound.
Failing features make the call an error whose data.errors names each one, its
SolidWorks error, what it depends on and a hint; warnings alone still succeed.
Needs: an open part or assembly. Changes: rebuilds the model. Returns: data
with rebuilt, errors, error_count, warning_count and summary.
Inputs: input_data. Returns: object
rename_featureRename FeatureAIdempotent
Rename a feature in the active model's feature tree.
Use it to give features meaningful names (e.g. "MountingHoles"). The new name is
read back: a name another feature already uses is an error. Renaming to the
current name succeeds with no change. Needs: an open part or assembly. Changes:
the feature's name. Returns: data with old_name, new_name, renamed and,
when unchanged, reason.
Inputs: input_data (required). Returns: object
replace_componentReplace ComponentADestructiveIdempotent
Swap an assembly component for another part or assembly file.
Use it to try another version of a part (a longer pin, a different motor)
without re-inserting and re-mating it. all_instances replaces every
instance of the same file, patterned copies included. Mates are kept where
they still fit. Needs: an open assembly and the new file. Changes: the
component's file. Returns: replace with the replaced instances and
their files read back, and the components before and after. A file that
doesn't exist fails as invalid_input.
Inputs: input_data (required). Returns: object
reset_circuit_breakerReset Circuit BreakerAIdempotent
Let calls through again to operations the server paused after repeated failures.
Use it when a tool returns error_type: circuit_open and you have fixed what
made the calls fail (a missing sketch, a wrong reference): without a reset, the
operation stays paused until its timeout. Resetting does not fix the cause; a
call that fails again counts towards a new pause. Changes: only the server's
own state; no SolidWorks document is touched. Returns: data with reset, the
operations that were paused (empty when none were).
Inputs: input_data. Returns: object
save_asSave AsADestructiveIdempotent
Save the active document under a new path, as a SolidWorks file or in an exchange format such as STEP or IGES.
For a SolidWorks format (solidworks, sldprt, sldasm, slddrw) it saves a copy
like File > Save As; any other format_type is passed to the exporter. For one
known format with its options, prefer export_step, export_stl and the other
export_* tools. Needs: an open, active document. Changes: writes the file. A
file already at file_path is kept and the call refused, unless overwrite
is on. Returns: file_path and format.
Inputs: input_data (required). Returns: object
save_assemblySave AssemblyADestructiveIdempotent
Deprecated: use save_file.
Save the active assembly in place, or as a new .sldasm, optionally copying the parts it uses alongside.
Before writing to a new path it checks the folder exists and is writable,
changes the extension to .sldasm, and refuses an existing file unless
overwrite is on. With include_references, it instead copies the assembly
file as last saved, and the files it references, into the new folder; unsaved
changes are left out and references are not updated. To copy an assembly with
its referenced parts, use pack_and_go_assembly. Needs: an open, active assembly, saved once for
include_references. Changes: writes the assembly file (and copies). Returns:
file_path, plus copied_files and missing_source_files when copying
references.
Inputs: input_data. Returns: object
save_as_templateSave As TemplateADestructiveIdempotent
Save the active part, assembly or drawing as a template, so new documents start from it.
Use it after setting up a document once (units with set_units, a material,
custom properties) to start the next one the same way: pass the template to
create_part, create_assembly or create_drawing as template. A part
saves as .prtdot, an assembly as .asmdot, a drawing as .drwdot. Give
file_path, or name to save in SolidWorks' first template folder so it also
shows in File > New. Afterwards SolidWorks has the template open in place of
the document, as File > Save As does (a saved document's file is left as last
saved); the reply's warning says so. Save from a part with no features when only its settings should carry
over. The path is checked before SolidWorks is asked: the extension must
match, the folder must exist, and a file already there is kept unless
overwrite is on. Needs: an open, active document. Changes: writes the
template. Returns: data with file_path, document_type,
in_template_folder, template_folders and document_became_template.
Inputs: input_data (required). Returns: object
save_body_as_partSave Body as PartADestructiveIdempotent
Save one solid body of the active multibody part as a new part file (Insert > Features > Save Bodies).
Use it to split a multibody part into parts, e.g. after create_extrusion
without merging. Needs: an open, active part with the named body and an existing
target folder. Changes: adds a Save Bodies feature to the part and writes the
new .sldprt; closes any new, unsaved assembly SolidWorks opens alongside.
Returns: data with body, file_path, feature, solid_bodies (every
body name, to correct a wrong one) and closed_documents.
Inputs: input_data (required). Returns: object
save_fileSave FileADestructiveIdempotent
Save the active part, assembly or drawing, to its own path or to a new path in its own format.
Use it after changes you want to keep. A new file_path is checked before
SolidWorks is asked: its folder must exist and be writable, it must end in
the document's extension (.sldprt, .sldasm, .slddrw), and a file already there
is kept unless overwrite is on. To write another format, use save_as or an
export_* tool; to copy an assembly with its parts, pack_and_go_assembly.
Needs: an open, active document, already saved once unless you give a path.
Changes: writes the file. Returns: file_path (when given) and data from
the save.
Inputs: input_data (required). Returns: object
save_partSave PartADestructiveIdempotent
Deprecated: use save_file.
Save the active part in place, or as a new .sldprt with the target path checked first.
Before writing to a new path it checks the folder exists and is writable,
changes the extension to .sldprt, and refuses an existing file unless
overwrite is on. For other formats, use save_as or an export_* tool. Needs: an open, active part. Changes: writes
the part file. Returns: file_path when saved to a new path.
Inputs: input_data. Returns: object
search_solidworks_api_helpSearch SolidWorks APIARead-onlyIdempotent
Search SolidWorks API interface and member names by keyword.
Use this when you don't know the exact name: "chamfer" finds IFeatureManager.InsertFeatureChamfer. Then call lookup_api_method on a match for its parameters and return type. Matches come from the SolidWorks type library installed on this machine.
Setup: none. SolidWorks must be installed, not running; it is never
contacted. Read-only. The first call builds the index (about a
second) and later calls reuse it. index_status is ready
(saved index), rebuilt (built for this call) or unavailable
(no index could be built; guidance says why).
Returns matches (interface, member, member_type, score),
guidance, and fallback_help suggesting MCP tools for the
task, with year and type_library_version of the library that
answered.
Example input: {"query": "chamfer", "max_results": 5}
Inputs: input_data. Returns: object
select_face_edgesSelect Face EdgesAIdempotent
Select every edge of one face of the active part, ready for add_fillet or add_chamfer with no edge names.
Pick the face with one of point (a point on it, mm), side (top, bottom,
front, back, right, left or +X..-Z; the furthest flat face that way) or plane
(the face lying on that plane). edge_type narrows to linear or circular edges
(hole rims). Needs: an open part. Changes: the selection only. Returns: data
with face, edges, selected_edges and selection_count.
Inputs: input_data (required). Returns: object
select_featureSelect FeatureAIdempotent
Select a feature, sketch, plane or component by name in the active document.
Use it to set up a selection that the next SolidWorks operation acts on.
append adds to the selection instead of replacing it. A name that can't be
selected is an error. Needs: an open document. Changes: the selection only.
Returns: data with selected_name and selection_count.
Inputs: input_data (required). Returns: object
set_component_stateSet Component StateAIdempotent
Fix or float an assembly component, make a sub-assembly flexible, or hide it or make it transparent.
Float a part so mates can position it (the first part inserted is fixed); fix
one to hold it still. Make a sub-assembly flexible so its own mates move in
this assembly (a crank whose knob turns). Hide a component (visible false)
or make it transparent to see the parts inside. Only what you pass changes:
the component's suppression, configuration and other states are kept. Needs:
an open assembly. Changes: the states you pass. Returns: state with
component, before and after (fixed, flexible, visible and the
properties kept), and appearance (visible, transparent) when you
changed it.
Inputs: input_data (required). Returns: object
set_construction_geometrySet Construction GeometryAIdempotent
Make sketch entities construction geometry, or normal again, by id.
Use it for reference lines and circles a feature should ignore, such as a
line to dimension from or a bolt circle. Needs: an open sketch and ids the
sketch tools returned. Changes: each entity's construction setting (setting it
to what it already is changes nothing). Returns: construction_geometry with
each id's state. An unknown id fails as invalid_input and nothing changes.
Inputs: input_data (required). Returns: object
set_custom_propertySet Custom PropertyADestructiveIdempotent
Create or overwrite one text custom property on the active document, e.g. PartNo or DrawnBy.
Use it to fill what a title block or BOM reads. The value is read back, so
success means it was stored. Needs: an open, active document. Changes: writes
the property, replacing one of the same name (save the file to keep it).
Returns: data with name, value, resolved and configuration.
Inputs: input_data (required). Returns: object
set_dimensionSet DimensionAIdempotent
Change one length dimension of the active model, in mm, and rebuild.
Use it to resize an existing model; find the full name with
list_model_dimensions and check the result with rebuild_model or
verify_model. The value is always millimetres. It changes the active
configuration only, unless configurations is "all" or a list of names.
Needs: an open part or assembly. Changes: the dimension and the geometry it
drives. Returns: dimension_update with name, old_value, new_value
and configurations (the names it was set in).
Inputs: input_data (required). Returns: object
set_equationSet EquationAIdempotent
Add or change an equation or global variable, so one value drives others (a parametric part).
E.g. Width = 60mm, then D1@Sketch1 = "Width" / 2: changing Width
later resizes the sketch. A name with @ is a dimension of the active
document (list_model_dimensions); any other is a global variable. An
existing equation for name is changed, else one is added; the model
is solved and rebuilt. Applies in all configurations unless
configurations says otherwise. An expression SolidWorks can't use
fails as equation_refused, changing nothing. Needs: an open part or
assembly. Changes: the equation and what it drives. Returns:
equation with name, expression, kind, value (document units),
action (added or changed) and configurations.
Inputs: input_data (required). Returns: object
set_exploded_viewSet Exploded ViewAIdempotent
Show the active assembly exploded, or collapse it.
Use it to switch between the exploded view create_exploded_view made
and the assembled one. Needs: an open assembly with an exploded view.
Changes: what the view shows; nothing in the model. Returns:
exploded_view with the view, exploded as read back and the bounding
box size_mm. No exploded view fails as not_found.
Inputs: input_data (required). Returns: object
set_flat_patternFlat PatternAIdempotent
Flatten a sheet-metal part to its blank, or fold it back, and measure it.
Flattened, bounding_box_mm is the blank to cut: check it against the
part's size and the bend allowance before export_flat_pattern writes the
DXF. Fold it back before adding more features. Needs: a sheet-metal part.
Changes: unsuppresses (flat) or suppresses (folded) the Flat-Pattern
feature. Returns: flat, feature and bounding_box_mm.
Inputs: input_data. Returns: object
set_materialSet MaterialAIdempotent
Assign a library material to the active part, e.g. "AISI 1020" or "6061-T6 (SS)".
The material sets the mass and what a title block's Material field shows. The
name must match the library exactly; find it with list_available_materials.
The material is read back, so success means it applied. Needs: an open, active
part. Changes: the part's material. Returns: data with material, database
and configuration.
Inputs: input_data (required). Returns: object
set_sheet_scaleSet Sheet ScaleAIdempotent
Set the active drawing sheet's scale, e.g. 1:2; views that use the sheet scale follow it.
Use it when views are too large for the sheet, or when arrange_dimensions
reports overlaps it can't clear. Needs: an open, active drawing. Changes: the
sheet scale. Returns: data with the sheet name and the new scale.
Inputs: input_data. Returns: object
set_sketch_textSet Sketch TextAIdempotent
Rewrite the text in a sketch and rebuild, so debossed lettering shows it.
Use it after a change the text should follow: SolidWorks doesn't redraw sketch
text on rebuild, not even a $PRP: link to a dimension an equation changed.
Give the same $PRP:"name" text to re-read the link, or new text. The sketch
is opened, its text rewritten, closed, and the model rebuilt, so a cut made
from it changes too. Needs: a part with that sketch, holding text from
add_sketch_text. Changes: the sketch's text. Returns: the sketch, each
text before and after (links resolved).
Inputs: input_data (required). Returns: object
set_unitsSet UnitsAIdempotent
Set the active document's length units: mm, cm, m, in or ft.
Use it on a new part before sketching if you want other than the template's
units. Aliases such as "inch" are accepted. The setting is read back, so success
means it applied. Tool inputs stay in mm whatever the document shows. Needs: an
open, active document. Changes: the document's unit system. Returns: data with
unit_system, the values applied and observed, and verified.
Inputs: input_data (required). Returns: object
sketch_circular_patternSketch Circular PatternA
Repeat sketch entities around the sketch origin, e.g. a bolt circle.
The centre is always the sketch origin, so draw the first entity at the radius
you want from it. Then cut once with create_cut_extrude. Needs: an open sketch
(create_sketch). Changes: adds copies of the entities. Returns: pattern with
id, entities, count and angle.
Inputs: input_data (required). Returns: object
sketch_convert_entitiesConvert EntitiesA
Copy model edges, or a face's whole outline, into the open sketch (Convert Entities).
Use it to sketch on an existing edge exactly, e.g. to cut a pocket that
follows a face, instead of re-drawing it at guessed coordinates. Pick edges
or a face with a point on each (mm). Needs: an open sketch
(create_sketch) and a part with those edges. Changes: adds the copied
entities, tied to the edges. Returns: converted with entities (ids for
the other sketch tools), count and construction.
Inputs: input_data (required). Returns: object
sketch_extendExtend Sketch EntityA
Lengthen a sketch entity from its end nearest a point until it meets the next entity.
Use it to close a gap, such as lines that stop short of a circle. point
([x, y] sketch mm) is on the entity, near the end to lengthen. Needs: an
open sketch with an entity at the point and another in its way. Changes: that
end moves to the next entity. Returns: extend with the point and the
segment counts. Nothing at the point, or nothing to reach, fails as
invalid_input.
Inputs: input_data (required). Returns: object
sketch_linear_patternSketch Linear PatternA
Repeat sketch entities in a straight line at a fixed spacing.
Use it for rows of holes or slots before one cut. Needs: an open sketch
(create_sketch). Changes: adds copies of the entities. Returns: pattern with
id, entities, count, spacing and direction.
Inputs: input_data (required). Returns: object
sketch_mirrorMirror Sketch EntitiesA
Mirror sketch entities about a centreline in the open sketch.
Use it for symmetric profiles: draw one half, add a centreline with
add_centerline, then mirror. Needs: an open sketch (create_sketch). Changes:
adds mirrored copies. Returns: mirror with id, entities and mirror_line.
Inputs: input_data (required). Returns: object
sketch_offsetOffset Sketch EntitiesA
Offset sketch entities by a distance in mm, outward or inward, e.g. for a wall or a clearance.
Needs: an open sketch (create_sketch). Changes: adds the offset entities.
Returns: offset with id, entities, distance and direction (outward or
inward).
Inputs: input_data (required). Returns: object
sketch_trimTrim Sketch EntityADestructive
Trim away the piece of a sketch entity at a point, back to where it meets others.
Use it to clean up overlapping shapes into one profile, such as the arc inside
a keyhole. point ([x, y] sketch mm) is on the piece to remove; an entity
that meets nothing is removed whole. Needs: an open sketch with an entity at
the point. Changes: removes that piece. Returns: trim with the point and
the sketch's segments_before and segments_after. A trimmed entity's id may
no longer name a whole segment. Nothing at the point fails as invalid_input.
Inputs: input_data (required). Returns: object
sketch_tutorial_simple_holeTutorial: Hole SketchA
Deprecated: no replacement.
Demonstrate the sketch steps: draw a 5 mm circle at the origin on the Top plane and close the sketch.
It is a fixed example; for a real hole, use create_sketch, add_circle,
exit_sketch and create_cut_extrude. Needs: an open part. Changes: adds a
sketch with one circle. Returns: steps_completed, next_step (cut the hole
with create_cut_extrude) and suggested_cut, that call's input.
Inputs: no named parameters. Returns: object
suppress_featureSuppress or Unsuppress FeatureAIdempotent
Suppress or unsuppress a feature of the active model; suppressed features stay in the tree but are not built.
Use it to turn off a feature that breaks the rebuild without deleting it. It
acts in the active configuration only, unless configurations is "all" or a
list of names. Needs: an open part or assembly. Changes: the feature's
suppression state, and its children's. Returns: data with feature,
requested, suppressed (read back in the active configuration; null when
unreadable), was_suppressed and configurations (where it applied).
Inputs: input_data (required). Returns: object
undoUndoADestructive
Undo the last operations in the active model (Edit > Undo).
Use it to step back after a feature went wrong. SolidWorks accepts an undo with
nothing to undo, so the reply says whether the feature tree changed. Needs: an
open document. Changes: reverts the last count operations. Returns: data
with requested_steps, features_before, features_after and tree_changed.
Inputs: input_data. Returns: object
update_sheet_formatUpdate Sheet FormatAIdempotent
Change the active drawing sheet's format and paper size, keeping every view.
Give a format name SolidWorks has (e.g. "a2 - iso") or a .slddrt path; the paper
size comes from the name unless given. The views are checked to be the same
afterwards, and the title block keeps its values (they are properties). Needs:
an open, active drawing. Changes: the sheet's format and size. Returns: sheet
with sheet_format (the path), paper_size, sheet_mm and views.
Inputs: input_data (required). Returns: object
update_title_blockUpdate Title BlockAIdempotent
Change the active drawing's title-block fields: title, drawing number, drawn by, date, revision, company.
Each field is written to the property the sheet format shows (the same mapping
generate_drawing_package uses): the title is the drawn model's Description,
the others the drawing's own properties. Fields not given keep their values.
Needs: an open, active drawing of a model. Changes: those properties. Returns:
fields, each with the property written, on (drawing or model) and value.
Inputs: input_data (required). Returns: object
verify_modelVerify Model Against ExpectationsARead-onlyIdempotent
Check the active part or assembly against what you meant to build, one pass/fail check per expected value.
Use it as the last step of a build: a modelling tool's success doesn't prove the
geometry is right. Give only the values you know. Units: mm, mm³, kg;
bounding_box_mm is [x, y, z] in model axes. Widen relative_tolerance when
your sums ignore fillets. Needs: an open part or assembly. Read-only. Returns:
verdict (pass, fail, inconclusive or report_only), checks (each expected,
actual, tolerance, passed; null when unmeasured) and measured. A
mismatch is still status: success.
Inputs: input_data. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 157 tools
Each tool's description explicitly states its purpose and cross-references alternatives, which keeps most selections clear, but the surface carries several genuine near-duplicates: load_part/load_assembly vs open_model, save_part/save_assembly vs save_file, get_file_properties vs get_model_info, calculate_mass_properties vs get_mass_properties, and add_drawing_view vs create_drawing_view. Deprecated aliases mitigate the risk by naming their replacement, but an agent can still land on the superseded tool. The nine generate_vba_* tools plus create_* equivalents form another cluster that only the prose keeps apart.
Names are uniformly snake_case with a verb-led convention across most of the surface (create_, add_, list_, get_, set_, export_, generate_, check_, verify_). A minority are noun-led or bare-noun patterns (sketch_mirror, sketch_trim, pattern_linear, mirror_feature, measure_entities), and add_fillet/add_chamfer vs add_sketch_fillet/add_sketch_chamfer show the sketch/solid split is expressed inconsistently. Still highly readable with only minor deviations.
157 tools is far beyond a manageable surface; even for a full CAD application this is a large, layered API exposed at once. Deprecated aliases (load_part, save_part, calculate_mass_properties, get_file_properties, add_drawing_view, sketch_tutorial_simple_hole) and the redundant generate_vba_* family inflate the count without adding capability. The breadth of sub-domains justifies many tools, but not this many, and grouping/packs would help.
Coverage is unusually deep: sketching primitives and constraints, boss/cut extrude, revolve, sweep, loft, fillet/chamfer/draft/rib/shell, hole wizard, sheet metal with flat pattern and DXF export, assembly mates/components/patterns/interference, drawings with views, dimensions, GD&T, BOM, and a wide export set. Remaining gaps are modest (no cut-sweep/cut-loft, no body delete or combine/split beyond save_body_as_part, no delete_custom_property, no component delete), which agents can route around or handle via macros.
Maintenance
Related MCP Connectors
Edit AutoCAD and Revit MEP drawings from Claude or ChatGPT in plain English.
CAD in ChatGPT and Claude: editable parts, STEP/STL/drawings, in-chat 3D, automatic checks.
Parametric 3D CAD for AI agents: build print-ready parts, check them, export STL, 3MF or STEP.
Read, query, edit and render DWG drawings with AI. No AutoCAD required.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables connecting MCP clients to local SolidWorks for automated 3D part creation, template generation, file export, and basic review via natural language.104MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI models to automate SolidWorks CAD at the feature level through MCP, including building parts from DXF/DWG drawings and reproducing existing parts via a deterministic compiler.1AGPL 3.0
- AlicenseBqualityCmaintenanceEnables Claude or any MCP client to drive a live SOLIDWORKS session through its COM API, modeling parts, building assemblies with mates, checking interferences and machining feasibility, and exporting STEP or DXF files. It also exposes a local semantic index of the SOLIDWORKS API so the model can look up signatures, enums, and official examples before running arbitrary Python against the session.222MIT
- FlicenseNot gradedqualityAmaintenanceEnables AI assistants to control supported CAD applications through natural-language instructions and unified MCP tools for drawing, layers, blocks, entities, files, and data export.-