| name | kalpataru-edit-feature |
| description | Parametrically edit an existing SolidWorks feature — change a depth, radius, count, or angle without rebuilding the part from scratch. The safest way to modify geometry because no topology changes are introduced. |
Editing features parametrically
When the user says "make the bracket 75mm long instead of 50", don't
rebuild the part. Edit the existing extrusion.
Parametric edits sidestep the entity-ID-stability problem entirely:
nothing new is created, so face and edge IDs stay valid. This is by far
the most reliable way to modify a Kalpataru-built part.
The kalpataru_edit_feature call
kalpataru_edit_feature(
feature_name="Boss-Extrude1",
changes={"depth": "75"}
)
changes is a dict of parameter name → new value (as strings — they're
parsed by SolidWorks).
What you can edit
Per feature type, the editable parameters are:
| Feature type | Common parameters |
|---|
Extrusion (boss or cut) | depth, direction, draft, merge |
Revolution | angle, revolve_type |
Fillet | radius, propagate_tangent |
Chamfer | distance, angle |
Shell | thickness, outward |
Mirror | (geometry pattern only) |
LinearPattern | count, spacing, count2, spacing2, reverse_dir1, reverse_dir2 |
CircularPattern | count, angle, equal_spacing |
Plane | offset, angle |
For values with units, include the unit (e.g. "75mm", "30deg") — the
plain numeric form usually also works because SolidWorks assumes the
document's default unit.
Find feature names first
If you don't know the feature names, call kalpataru_list_features first:
features = kalpataru_list_features()
# -> [{name: "Boss-Extrude1", type: "Extrusion", ...}, ...]
Match by type or by position in the rebuild order. The user's
"the bracket" usually means the largest extrusion; "the hole" usually
means a cut; "the rounds" usually means fillets.
Confirming the edit
The result has old_values and new_values:
{
feature_name: "Boss-Extrude1",
modified_feature: "Boss-Extrude1",
old_values: {depth: "50mm"},
new_values: {depth: "75mm"},
rebuild_status: "rebuilt"
}
If rebuild_status is "failed", the edit caused a downstream rebuild
error. Read the error message — usually a downstream feature can't find
a face/edge that moved. Either:
- Roll back (
kalpataru_undo) and try a smaller change
- Edit the dependent feature too
Editing multiple parameters at once
kalpataru_edit_feature(
feature_name="LPattern1",
changes={"count": "8", "spacing": "12.5"}
)
Both changes are applied atomically. Cleaner than two separate edits.
When NOT to edit
If the change is structural — adding a feature, removing a feature,
changing a feature's type — you can't edit. Build the new feature or
roll back to before the old one.
Specifically:
- Can't change a
Boss-Extrude into a Cut-Extrude (different feature types)
- Can't change which sketch a feature references
- Can't change which edges a fillet selected (delete and recreate)
- Can't add a new edge to an existing fillet (delete and recreate)
Undo, redo
kalpataru_undo and kalpataru_redo move through the standard SolidWorks
undo stack. count defaults to 1; pass higher to undo multiple steps.
Use undo liberally — it's safe.