solidworks_mcp.adapters.solidworks.part_features¶
solidworks_mcp.adapters.solidworks.part_features ¶
Part features beyond extrude and revolve: holes, threads, patterns, shell, draft, rib.
Also sketch_convert_entities, which copies model edges into the open
sketch. Every face and edge is picked by a point in millimetres, through
the same helpers the chamfer and fillet tools use (rebuild first, then the
nearest face or edge on the body; runbook #11 and #13).
The solid features share one rule (spec tools/measured-feature-change):
the volume is read before and after through get_mass_properties, and a
feature that left the volume unchanged is deleted again and reported as a
failure, so a no-op never stays in the tree. A cosmetic thread is the
exception: it must leave the volume alone.
COM argument lists and enum values come from the installed type libraries
(sldworks.tlb and swconst.tlb, SolidWorks 2026).
Attributes¶
HOLE_END_CONDITIONS
module-attribute
¶
HOLE_STANDARDS
module-attribute
¶
HOLE_TYPES
module-attribute
¶
ISO_COARSE_PITCH
module-attribute
¶
ISO_COARSE_PITCH: dict[float, float] = {1.0: 0.25, 1.2: 0.25, 1.4: 0.3, 1.6: 0.35, 2.0: 0.4, 2.5: 0.45, 3.0: 0.5, 3.5: 0.6, 4.0: 0.7, 5.0: 0.8, 6.0: 1.0, 7.0: 1.0, 8.0: 1.25, 10.0: 1.5, 12.0: 1.75, 14.0: 2.0, 16.0: 2.0, 18.0: 2.5, 20.0: 2.5, 22.0: 2.5, 24.0: 3.0, 27.0: 3.0, 30.0: 3.5, 33.0: 3.5, 36.0: 4.0, 39.0: 4.0, 42.0: 4.5, 45.0: 4.5, 48.0: 5.0, 52.0: 5.0, 56.0: 5.5, 60.0: 5.5, 64.0: 6.0}
THREAD_END_TYPES
module-attribute
¶
Classes¶
AdapterResult
dataclass
¶
AdapterResult(status: AdapterResultStatus, data: T | None = None, error: str | None = None, execution_time: float | None = None, metadata: dict[str, Any] | None = None)
Result wrapper for adapter operations.
Attributes:
| Name | Type | Description |
|---|---|---|
data |
T | None
|
The data value. |
error |
str | None
|
The error value. |
execution_time |
float | None
|
The execution time value. |
metadata |
dict[str, Any] | None
|
The metadata value. |
status |
AdapterResultStatus
|
The status value. |
AdapterResultStatus ¶
Bases: StrEnum
Result status for adapter operations.
Attributes:
| Name | Type | Description |
|---|---|---|
ERROR |
Any
|
The error value. |
SUCCESS |
Any
|
The success value. |
TIMEOUT |
Any
|
The timeout value. |
WARNING |
Any
|
The warning value. |
HoleLibraryError ¶
Bases: Exception
The library can't be found or read; the message says where it looked.
HoleSizeError ¶
Bases: InputRefused
A hole type or size the library doesn't have; names the nearest ones.
ResolvedHole
dataclass
¶
What create_hole asks SolidWorks for.
Attributes:
| Name | Type | Description |
|---|---|---|
fastener |
str
|
The hole type's name. |
code |
int
|
Its |
size |
str
|
The size exactly as the library writes it. |
warning |
str | None
|
Set when the size couldn't be checked. |
SolidWorksPartFeaturesMixin ¶
Holes, threads, linear patterns, shell, draft, rib and convert entities.
Methods:¶
add_cosmetic_thread
async
¶
add_cosmetic_thread(edge_point: list[float], size: str, diameter: float, end_type: str = 'blind', depth: float | None = None, standard: str = 'iso') -> AdapterResult[dict[str, Any]]
A cosmetic thread on a circular edge (InsertCosmeticThread3).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edge_point
|
list[float]
|
A point (mm) on the circular edge. |
required |
size
|
str
|
The thread size, e.g. |
required |
diameter
|
float
|
The major diameter, mm. |
required |
end_type
|
str
|
A key of :data: |
'blind'
|
depth
|
float | None
|
Thread length for a blind thread, mm. |
None
|
standard
|
str
|
A key of :data: |
'iso'
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The thread's name; the volume is unchanged. |
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 | |
add_draft
async
¶
add_draft(angle: float, faces: list[list[float]], neutral_face: list[float], reverse: bool = False) -> AdapterResult[dict[str, Any]]
Draft faces by an angle against a neutral face (InsertMultiFaceDraft).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
angle
|
float
|
Draft angle, degrees. |
required |
faces
|
list[list[float]]
|
A point (mm) on each face to draft. |
required |
neutral_face
|
list[float]
|
A point (mm) on the neutral face. |
required |
reverse
|
bool
|
Draft the other way. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The draft's name and volume change. |
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
create_hole
async
¶
create_hole(face_point: list[float], hole_type: str, standard: str, size: str, end_condition: str = 'through_all', depth: float | None = None, positions: list[list[float]] | None = None, fastener: str | None = None) -> AdapterResult[dict[str, Any]]
Hole Wizard holes at points on a flat face (HoleWizard5).
The face is selected at face_point with SelectByID2, and
SolidWorks puts the hole where the pick landed, about 0.04 mm off; the
hole's position sketch point is then moved exactly onto
face_point. Dimensions not given are -1, which leaves them to the
standard's table for the size. Each point of positions is added to
the same position sketch, so one feature holds every hole
(:func:_place_holes). A simple hole that
SolidWorks won't make through all is made blind through the part
(:func:_through_depth_m).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
face_point
|
list[float]
|
|
required |
hole_type
|
str
|
A key of :data: |
required |
standard
|
str
|
A key of :data: |
required |
size
|
str
|
The size as the library lists it ( |
required |
end_condition
|
str
|
A key of :data: |
'through_all'
|
depth
|
float | None
|
Hole depth for a blind hole, mm. |
None
|
positions
|
list[list[float]] | None
|
Further |
None
|
fastener
|
str | None
|
The hole type's name from |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The hole's name, inputs, |
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
lacks is refused before any COM call, with the nearest sizes. |
AdapterResult[dict[str, Any]]
|
When adding the positions fails, the hole is removed again and |
AdapterResult[dict[str, Any]]
|
the error says why. |
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 | |
create_rib
async
¶
create_rib(sketch: str, thickness: float, both_sides: bool = True, flip_material: bool = False, normal_to_sketch: bool = False) -> AdapterResult[dict[str, Any]]
A rib from an open sketch (InsertRib).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sketch
|
str
|
The rib sketch's name. |
required |
thickness
|
float
|
Rib thickness, mm. |
required |
both_sides
|
bool
|
Add the thickness to both sides of the sketch. |
True
|
flip_material
|
bool
|
Extend the rib the other way. |
False
|
normal_to_sketch
|
bool
|
Extrude normal to the sketch instead of parallel. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The rib's name and volume change. |
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
create_shell
async
¶
create_shell(thickness: float, faces: list[list[float]], outward: bool = False) -> AdapterResult[dict[str, Any]]
Hollow the body to a wall thickness, removing the faces picked.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
thickness
|
float
|
Wall thickness, mm. |
required |
faces
|
list[list[float]]
|
A point (mm) on each face to remove; empty for a closed shell. |
required |
outward
|
bool
|
Add the wall outside the body instead of inside. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The shell's name and volume change. |
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
list_hole_sizes
async
¶
list_hole_sizes(standard: str, hole_type: str, fastener: str | None = None, size: str | None = None) -> AdapterResult[dict[str, Any]]
The Hole Wizard hole types and sizes, read from the installed library.
A file read (:mod:.hole_library), no COM: it works whether or not
SolidWorks is running.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
standard
|
str
|
A key of :data: |
required |
hole_type
|
str
|
|
required |
fastener
|
str | None
|
One hole type's name, to list only its sizes. |
None
|
size
|
str | None
|
One size, to read its dimensions. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The hole types with their sizes, or one size's dimensions; an |
AdapterResult[dict[str, Any]]
|
error naming where the library was looked for, or the nearest |
AdapterResult[dict[str, Any]]
|
sizes. |
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
pattern_linear
async
¶
pattern_linear(features: list[str], direction: list[float] | str, count: int, spacing: float, direction2: list[float] | str | None = None, count2: int = 1, spacing2: float = 0.0, reverse: bool = False, reverse2: bool = False) -> AdapterResult[dict[str, Any]]
Repeat features along one or two directions (FeatureLinearPattern5).
A direction is a point (mm) on a straight edge, or the name of an axis or edge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
list[str]
|
Names of the features to repeat. |
required |
direction
|
list[float] | str
|
The first direction. |
required |
count
|
int
|
Instances along it, the original included. |
required |
spacing
|
float
|
Distance between instances, mm. |
required |
direction2
|
list[float] | str | None
|
The second direction, or None for one direction. |
None
|
count2
|
int
|
Instances along the second direction. |
1
|
spacing2
|
float
|
Spacing along the second direction, mm. |
0.0
|
reverse
|
bool
|
Flip the first direction. |
False
|
reverse2
|
bool
|
Flip the second direction. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The pattern's name, inputs and volume change. |
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 | |
sketch_convert_entities
async
¶
sketch_convert_entities(edge_points: list[list[float]] | None = None, face_point: list[float] | None = None, construction: bool = False) -> AdapterResult[dict[str, Any]]
Copy model edges, or a face's outline, into the open sketch.
SketchUseEdge3 returns only a Boolean, so the sketch's segments
are read before and after and the new ones registered under ids the
other sketch tools accept.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edge_points
|
list[list[float]] | None
|
A point (mm) on each edge to copy. |
None
|
face_point
|
list[float] | None
|
A point (mm) on a face whose outline to copy. |
None
|
construction
|
bool
|
Make the copies construction geometry. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
The new entities' ids. |
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 | |
_BodyEntityPicker ¶
Find the body edge or face nearest a point, by true closest distance.
SelectByID2("", "EDGE", x, y, z, ...) picks along the view direction
through the point, so on a 12 mm plate seen from the front an edge at
z=-6 is hidden behind the matching edge at z=+6 and the front one is
selected instead - silently. This walks every solid body's edges (or
faces) and measures the distance from the point to the closest point
on each (IEdge / IFace2.GetClosestPointOn), which does not
depend on the view, vertices or midpoints.
The entity lists are read once per picker, so one fillet over many edges costs one body walk, not one per edge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adapter
|
Any
|
A connected adapter with a valid |
required |
Source code in src/solidworks_mcp/adapters/solidworks/features.py
Methods:¶
entities ¶
Return every solid body's GetEdges() or GetFaces().
Source code in src/solidworks_mcp/adapters/solidworks/features.py
nearest ¶
Return (entity, distance_m) for the closest entity, or None.
Source code in src/solidworks_mcp/adapters/solidworks/features.py
select ¶
Select entity with IEntity.Select4 under mark.
Source code in src/solidworks_mcp/adapters/solidworks/features.py
_Picks ¶
Picks faces and edges by points (mm), sharing one body walk.
Start a pick set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adapter
|
Any
|
The connected adapter. |
required |
rebuild
|
bool
|
Rebuild before the first pick; False inside an open sketch, which a rebuild would close. |
True
|
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
Methods:¶
pick ¶
Select the kind ("FACE" or "EDGE") at point under mark.
Raises:
| Type | Description |
|---|---|
LookupError
|
When nothing of that kind lies at the point. |
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
Functions:¶
_cap_thread_depth ¶
Keep a blind tapped hole's thread inside the hole, in metres.
HoleWizard5 takes the thread depth from the size table (about twice
the diameter), which SolidWorks then refuses when the blind hole is
shallower: "The Tap Thread Depth cannot be larger than Blind Hole Depth"
(seen live on SolidWorks 2026). A thread exactly as deep as the hole is
refused too (a zero-length line in the hole's sketch), so the thread is
capped at :data:_THREAD_SHARE of the hole depth: the hole's
IWizardHoleFeatureData2 is opened, ThreadDepth lowered, and the
definition saved.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adapter
|
Any
|
The connected adapter. |
required |
model
|
Any
|
The active |
required |
feature
|
Any
|
The new hole feature. |
required |
depth_m
|
float
|
The blind hole's depth, metres. |
required |
Returns:
| Type | Description |
|---|---|
float | None
|
The thread depth in metres after the call, or |
float | None
|
definition couldn't be read (the rebuild check then reports why). |
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
_coords ¶
_feature_name ¶
A COM feature's name, or None.
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
_last_feature_name ¶
The newest feature's name, for calls that return nothing (rib, shell).
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
_mm ¶
_nearest_point ¶
The ISketchPoint of sketch nearest at (sketch metres).
_position_sketch already found a point within the pick tolerance, so
the sketch has at least one point.
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
_null_callout ¶
Return a VT_DISPATCH null for SelectByID2's Callout parameter.
A plain Python None marshals as VT_NULL, which SolidWorks rejects
with DISP_E_TYPEMISMATCH - measured as
(-2147352571, 'Type mismatch.', None, 8). See runbook item 11.
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
A |
Any
|
when pywin32 is unavailable (mock/Linux runs, where no real COM call |
|
Any
|
will be made anyway, but the value must still never be bare |
Source code in src/solidworks_mcp/adapters/solidworks/features.py
_place_holes ¶
_place_holes(adapter: Any, model: Any, feature: Any, first_mm: list[float], positions_mm: list[list[float]]) -> int
Put the first hole exactly at first_mm and one at each position.
HoleWizard5 puts the hole where SelectByID2 picked the face, which
lands about 0.04 mm from the point asked for. So the hole's position
sketch is edited: its first point is moved onto the exact point
(ISketchPoint.SetCoords), and each further point is added, as
clicking points on the Hole Wizard's Positions tab does. Closing the
sketch rebuilds the hole at every point. With nothing to move or add the
sketch isn't opened.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adapter
|
Any
|
The connected adapter. |
required |
model
|
Any
|
The active part. |
required |
feature
|
Any
|
The new Hole Wizard feature. |
required |
first_mm
|
list[float]
|
The first hole's point, mm. |
required |
positions_mm
|
list[list[float]]
|
The further points, mm, on the same face. |
required |
Returns:
| Type | Description |
|---|---|
int
|
The number of points in the position sketch afterwards. |
Raises:
| Type | Description |
|---|---|
ValueError
|
A point that is off the face's plane. |
RuntimeError
|
When the first point didn't move or the sketch didn't take every point. |
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | |
_position_sketch ¶
The hole's position sketch feature: its sketch has a point at first_m.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adapter
|
Any
|
The connected adapter. |
required |
feature
|
Any
|
The new Hole Wizard feature. |
required |
first_m
|
list[float]
|
The first hole's point, metres, model space. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
|
Raises:
| Type | Description |
|---|---|
LookupError
|
When no sub-feature sketch holds that point. |
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
_resolve_hole ¶
The hole type, index and size to ask HoleWizard5 for.
Checked against the installed library; when it can't be read, the default hole type is tried with a warning (design decision 7).
Raises:
| Type | Description |
|---|---|
HoleSizeError
|
For a size or hole type the library lacks. |
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
_select_edge_by_coord ¶
_select_edge_by_coord(adapter: Any, x: float, y: float, z: float, append: bool, mark: int = 0, entity_type: str = 'EDGE', picker: _BodyEntityPicker | None = None, rebuild: bool = True) -> bool
Select the edge (or face) nearest to (x, y, z) in metres.
Calls ForceRebuild3 on the first entity in the selection set so that
recent features are fully tessellated and selectable, then resolves the
point with :class:_BodyEntityPicker - the entity whose closest point is
nearest, independent of the view. Only when no body edge/face can be read
at all does it fall back to the view-dependent SelectByID2 pick.
entity_type is normally "EDGE", but pass "FACE" to select a
whole face instead. Any other type ("VERTEX" from
measure_entities) goes straight to the SelectByID2 pick: a vertex
lies on its edges at distance 0, so the edge walk would select an edge
in its place.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adapter
|
Any
|
A connected adapter with a valid |
required |
x
|
float
|
X in metres. |
required |
y
|
float
|
Y in metres. |
required |
z
|
float
|
Z in metres. |
required |
append
|
bool
|
Add to the current selection instead of replacing it. |
required |
mark
|
int
|
Selection mark. |
0
|
entity_type
|
str
|
|
'EDGE'
|
picker
|
_BodyEntityPicker | None
|
Reuse a picker (and its body walk) across several picks. |
None
|
rebuild
|
bool
|
Rebuild before the first pick. Pass False inside an open sketch: a rebuild there closes the sketch (seen live). |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if an entity was selected; False otherwise. |
Raises:
| Type | Description |
|---|---|
LookupError
|
When the nearest entity is further than
|
Source code in src/solidworks_mcp/adapters/solidworks/features.py
2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 | |
_select_named_feature ¶
Select a named feature under a specific selection mark via Select2.
Sweep and loft rely on selection marks to tell SolidWorks which selection
is the profile (1), guide curve (2), or sweep path (4). We resolve the
feature with IModelDoc2::FeatureByName and select it with
IFeature::Select2(append, mark) — the same proven path the rest of the
adapter uses for plane/sketch selection. IModelDocExtension::SelectByID2
is avoided deliberately: late-bound SelectByID2 raises
Type mismatch on some SolidWorks builds, whereas FeatureByName +
Select2 is reliable, works for sketches and reference curves such as
a helix, and needs no entity-type string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adapter
|
Any
|
A connected adapter with a valid |
required |
name
|
str
|
Feature name (e.g. |
required |
mark
|
int
|
Selection mark — 1=profile, 2=guide curve, 4=sweep path. |
required |
append
|
bool
|
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
|
Source code in src/solidworks_mcp/adapters/solidworks/features.py
_sketch_points ¶
The points of an ISketch, [x, y, z] in sketch metres.
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
_stored_thread ¶
The size and callout SolidWorks stored for a cosmetic thread.
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
_through_depth_m ¶
A blind depth that passes through the part: its box diagonal + 1 mm.
SolidWorks refuses through_all for a simple Hole Wizard hole (seen
live, every argument variant), so such a hole is made blind this deep.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adapter
|
Any
|
The connected adapter. |
required |
model
|
Any
|
The active part. |
required |
Returns:
| Type | Description |
|---|---|
float
|
The depth in metres; 1 m when the part box can't be read. |
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
_to_sketch ¶
A model point (metres) in sketch's coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adapter
|
Any
|
The connected adapter (its |
required |
sketch
|
Any
|
An |
required |
point_m
|
list[float]
|
|
required |
Returns:
| Type | Description |
|---|---|
list[float]
|
|
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
_with_volume_change ¶
_with_volume_change(result: AdapterResult[dict[str, Any]], before: float, after: float) -> AdapterResult[dict[str, Any]]
A pattern or mirror's result, with the volume it changed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
AdapterResult[dict[str, Any]]
|
The feature call's successful result. |
required |
before
|
float
|
The part's volume before, in mm³. |
required |
after
|
float
|
The part's volume after, in mm³. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
cut) and |
Source code in src/solidworks_mcp/adapters/solidworks/features.py
as_list ¶
Normalise a COM array/scalar/None return into a list.
collect_rebuild_issues ¶
Return every rebuild error/warning on model after a rebuild.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
adapter
|
Any
|
A connected adapter (for |
required |
model
|
Any
|
The active |
required |
Returns:
| Type | Description |
|---|---|
list[RawRebuildIssue]
|
list[RawRebuildIssue]: Empty when the model is clean. |
Source code in src/solidworks_mcp/adapters/solidworks/rebuild_inspector.py
describe ¶
describe(library: HoleLibrary, standard: str, hole_type: str, fastener: str | None = None, size: str | None = None) -> dict[str, Any]
What list_hole_sizes returns.
No size: the hole types of the kind (only fastener's when given),
each with its enabled sizes. With size: that size's dimensions, in
the hole type fastener names or the default one for the kind.
Raises:
| Type | Description |
|---|---|
HoleSizeError
|
For an unknown hole type or size. |
Source code in src/solidworks_mcp/adapters/solidworks/hole_library.py
double_array ¶
VARIANT(VT_ARRAY | VT_R8) for array-valued COM properties (tuple when pywin32 is absent).
Source code in src/solidworks_mcp/adapters/solidworks/com_utils.py
explain ¶
Build the caller-facing diagnostic entry for one rebuild issue.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
issue
|
RawRebuildIssue
|
The raw entry collected from SolidWorks. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: |
dict[str, Any]
|
|
Source code in src/solidworks_mcp/adapters/solidworks/rebuild_diagnostics.py
find_library ¶
The installed library.
Raises:
| Type | Description |
|---|---|
HoleLibraryError
|
Naming every place looked and the setting. |
Source code in src/solidworks_mcp/adapters/solidworks/hole_library.py
thread_table_size ¶
The spelling SolidWorks' thread table has for size.
M8x1.25 is the ISO coarse M8, which the ISO and DIN tables list as
M8; any other size (a fine pitch, an inch size) is kept.
Source code in src/solidworks_mcp/adapters/solidworks/part_features.py
unchecked ¶
unchecked(standard: str, hole_type: str, size: str, fastener: str | None, reason: str) -> ResolvedHole
The defaults to try when the library can't be read, with a warning.
A named fastener is used only when it is the default for the kind,
as its index is otherwise unknown.
Raises:
| Type | Description |
|---|---|
HoleSizeError
|
For a |