Skip to content

JSON contract

Machine-readable schema: schema.json.

Envelope and feature tree

Annotated JSON feature tree with envelope, feature order, shape parameters, units and placement, and the feature library

Data contract. A nineteen-line response is enough to describe an ordered, parametric feature tree.

Envelope

A response is either a single feature:

{
  "feature_type": "extrude",
  "name": "Cylinder",
  "params": {
    "plane": "前视基准面",
    "shape": "circle",
    "diameter": 50,
    "depth": 100
  }
}

or an ordered multi-feature model:

{
  "model_name": "Mounting plate",
  "features": [
    {
      "feature_type": "extrude",
      "name": "Base",
      "params": {
        "plane": "前视基准面",
        "shape": "rectangle",
        "length": 200,
        "width": 100,
        "depth": 20
      }
    },
    {
      "feature_type": "cut",
      "name": "Hole 1",
      "params": {
        "plane": "前视基准面",
        "shape": "circle",
        "diameter": 10,
        "depth": 20,
        "through_all": true,
        "center_x": 90,
        "center_y": 40
      }
    }
  ]
}

One of the four holes is shown. The full response repeats the cut feature with the other corner coordinates.

Feature types

Type Purpose Key parameters
extrude Creates the base or adds material. plane, shape, depth; optional end_condition (blind or mid_plane), depth2, plane_offset, seed
cut / hole Removes material from the current solid. plane, shape, depth unless through_all / through_next; optional end_condition, depth2, plane_offset, seed, thread, hole_style, fit
revolve Revolves an offset profile around an axis. plane, shape, profile dimensions, and center_x or center_y offset from the axis
fillet Rounds selected edges of the current solid. radius; optional edges
chamfer Applies an equal-distance chamfer to selected edges. distance; optional edges
linear_pattern Repeats the current solid along a direction. direction, count, spacing; optional count2, spacing2, seed, flip
circular_pattern Repeats the current solid around an axis. axis, count, angle; optional equal_spacing, seed, flip
mirror Mirrors the current solid across a datum plane. plane; optional seed, merge
shell Hollows the solid with a wall thickness. thickness; optional remove_faces, outward
draft Applies a draft angle to selected faces. angle; optional faces, neutral_plane, propagation
sweep Sweeps a circular profile along a path. diameter, path_length; optional path_plane, path_shape
loft Lofts between two profiles. height, profile1, profile2; optional plane
rib Inserts a rib from an open sketch. thickness, length; optional plane, center_x, center_y, draft_angle, two_sided
counterbore Cuts a counterbored hole. hole_diameter, counterbore_diameter (larger), counterbore_depth; hole depth or through_all
countersink Cuts a countersunk hole. hole_diameter, countersink_diameter (larger), optional countersink_angle; hole depth or through_all
hole_array Cuts a row of identical holes. diameter (or thread), count, spacing; optional hole_style, fit, direction, angle; hole depth or through_all
sketch Draws a freeform sketch for a later extrude/cut. plane, segments; optional plane_offset, closed
note Adds a drawing annotation. Drawing documents only. text; optional x, y, height
insert_component Inserts a part or sub-assembly. Assembly documents only. path (.sldprt or .sldasm); optional x, y, z, fixed
drawing_view Inserts a model view on a drawing sheet. Drawing documents only. model_path (.sldprt or .sldasm); optional view, x, y, scale
base_flange Creates a sheet metal base flange. Part documents only. plane, shape, shape dimensions, thickness; optional radius, plane_offset, center_x, center_y, reverse
edit_dimension Changes a driving dimension that already exists. dimension (exact full_name from context), value (mm); optional target

Configurations

A part-family request can add a top-level configurations array next to features:

{
  "features": [
    {
      "feature_type": "extrude",
      "name": "Base",
      "params": {
        "plane": "front",
        "shape": "rectangle",
        "length": 100,
        "width": 60,
        "depth": 20
      }
    }
  ],
  "configurations": [
    { "name": "L80", "overrides": { "Base.length": 80 } },
    { "name": "W40", "overrides": { "Base.width": 40 } }
  ]
}
  • name is unique and at most 128 characters; the response supports up to 20 configurations.
  • overrides maps "FeatureName.parameter" to a millimetre value. The referenced feature must have a name.
  • Supported roles are extrude rectangle length/width, extrude circle diameter, and cut/hole circle diameter.
  • The client creates each configuration after the base tree, activates it, applies the overrides in that configuration only, rebuilds, and returns to the base configuration.
  • Rollback deletes configurations created by the run together with its features and dimension edits.

Feature schema

Field Type Required Notes
feature_type string yes One of the types in the feature types table
name string no Human-readable label used in logs and configuration override keys
configurations array no Top-level sibling of features; dimension-driven configuration specs
configurations[].name string yes Unique configuration name, at most 128 characters
configurations[].overrides object yes Feature.parameter to millimetre value; non-empty
params.model_path string drawing_view only Full path to a .sldprt or .sldasm model
params.view string no Drawing view orientation: front (default), back, left, right, top, bottom, isometric, trimetric, dimetric, or current
params.scale number no Drawing-view scale from 0.01 to 100; omit to use the sheet scale
params.plane string yes for sketch features Requested datum plane; front, top, and right are supported
params.shape string yes for sketch features circle, rectangle, polygon, ellipse, or slot
params.depth number yes for blind / mid_plane; optional for through_all / through_next Depth in millimetres
params.seed string no Name of a sketch feature to extrude/cut; omit plane and shape when used
params.thread string no Standard metric thread: M3, M4, M5, M6, M8, M10, M12, M16, M20, or M24; replaces diameter
params.hole_style string no clearance (default) or tapped (tap-drill diameter)
params.fit string no close, normal (default), or loose for clearance holes
params.segments array sketch only Line, arc, circle, or polyline segments in millimetres
params.closed boolean no Close the freeform contour automatically
params.through_all boolean no Legacy shortcut for end_condition=through_all; cuts in both directions when true
params.end_condition string no blind (default) or mid_plane for extrude; blind, mid_plane, through_all, or through_next for cuts
params.depth2 number no Second-direction depth for a two-sided blind feature; not valid with mid_plane
params.plane_offset number no Offset from the datum plane along its normal in millimetres; positive or negative
params.edges string no Fillet/chamfer edge filter: all (default), axis_x, axis_y, axis_z, or circular
params.center_x number cuts in multi-hole models; revolve profiles Sketch centre on the first sketch axis, in millimetres
params.center_y number cuts in multi-hole models; revolve profiles Sketch centre on the second sketch axis, in millimetres
params.thickness number base_flange only Sheet thickness in millimetres; shell uses its own thickness
params.radius number fillet only Fillet radius or base-flange bend radius in millimetres
params.reverse boolean no Thicken the base flange in the opposite direction
params.distance number chamfer only Equal-distance chamfer in millimetres; applies to the selected edges
params.angle number no Revolve angle in degrees; defaults to 360
params.axis string no Revolve axis, x or y; defaults to y
params.draft_angle number no Draft angle in degrees for extrude/cut
params.dimension string edit_dimension only Exact full_name from context.features[].dimensions
params.value number edit_dimension only New dimension value in millimetres
params.target string no Owning feature name, for readability

Shape parameters

Shape Required fields Notes
circle diameter Millimetres
rectangle length, width Centred on center_x, center_y
polygon diameter, sides sides is clamped to 3–100
ellipse major_axis, minor_axis Millimetres
slot length, width Straight slot; width is the end diameter

Additional feature parameters:

  • revolve: requires a sketch profile offset from the revolution axis. Set center_x or center_y to a non-zero value, and optionally set axis to x or y and angle to a value from 1 to 360 degrees.
  • end_condition / depth2: blind uses depth; mid_plane is symmetric about the sketch plane; cuts also accept through_all and through_next, which ignore depth; depth2 turns a blind feature into a two-sided feature. On a single solid body, through_next falls back to a through-all cut when SolidWorks cannot resolve the next face.
  • plane_offset: creates a parallel datum plane at that offset and sketches there; extrude and cut/hole accept it. Positive and negative offsets follow the datum normal.
  • fillet: requires radius; applies a constant-radius fillet to the selected edges. edges defaults to all; axis_x, axis_y, and axis_z select edges along that model axis, and circular selects circular edges.
  • chamfer: requires distance; applies an equal-distance chamfer to the selected edges with the same edges filter.
  • draft_angle: optional on extrude and cut, in degrees from -89 to 89.
  • edit_dimension: changes a driving dimension that already exists. dimension must be the exact full_name from context.features[].dimensions; the client resolves it, rebuilds, and records the old value so rollback can restore it. Do not emit this type for a new feature.
  • sketch: draws a freeform profile from segments (line, arc, circle, or polyline). Give the sketch a name; an extrude or cut references it with seed and omits plane/shape. closed adds the closing segment.
  • thread / hole_style / fit: standard metric holes. Clearance holes follow ISO 273 (fit selects close, normal, or loose); tapped uses the common coarse tap-drill diameter. Cosmetic thread annotations are not created yet; only the correct hole geometry is cut.
  • configurations: dimension-driven part families. Each entry names a SolidWorks configuration and overrides profiles by "FeatureName.parameter"; only extrude rectangle length/width, extrude circle diameter, and cut/hole circle diameter are supported. Configurations are created after the base tree, and rollback removes them.
  • drawing_view: inserts a view of a saved model on the current drawing. model_path must be an existing .sldprt or .sldasm; view selects the standard orientation. The client opens the model to read its localized standard-view names, so it works on Chinese, English, and French SolidWorks installs. Drawing views are not part of model-feature rollback yet.
  • base_flange: creates a sheet metal base flange from the same closed profiles as extrude. thickness is required; radius defaults to the thickness. SolidWorks also creates the sheet-metal and flat-pattern features. Edge flanges and weldments are not implemented yet.
  • linear_pattern / circular_pattern / mirror / shell / draft: operate on the current solid. seed may reference the name of an earlier feature in the same response; the client maps it to the generated SolidWorks feature name.
  • sweep: the sweep uses a circular profile of diameter. The path is drawn on path_plane, with path_shape set to line or arc; path_length is in millimetres.
  • loft: two profiles are sketches on plane and on an offset plane height millimetres away. profile1 and profile2 use the same shape fields as sketch features.
  • rib: length is the sketch line length in the chosen plane. direction is x or y in that plane and defaults to y; two_sided defaults to true. The line must span the cavity so both ends meet existing walls.

Relational and advanced features

Type Required parameters Optional parameters
linear_pattern direction, count, spacing seed, count2, spacing2, flip
circular_pattern axis, count, angle seed, equal_spacing, flip
mirror plane seed, merge
shell thickness remove_faces, outward
draft angle faces, neutral_plane, propagation
sweep diameter, path_length path_plane, path_shape, path_center_x, path_center_y
loft height, profile1, profile2 plane
rib thickness, length plane, center_x, center_y, direction, draft_angle, two_sided

seed matches the name of an earlier feature in the same response, and the client maps it to the generated SolidWorks feature name. sweep uses a circular profile; path_shape is line or arc. loft creates an offset plane height millimetres from plane. For rib, the sketch line must span the cavity so both ends meet existing walls.

{
  "features": [
    { "feature_type": "extrude", "name": "Base", "params": { "plane": "前视基准面", "shape": "rectangle", "length": 120, "width": 80, "depth": 12 } },
    { "feature_type": "extrude", "name": "Boss", "params": { "plane": "前视基准面", "shape": "circle", "diameter": 16, "depth": 10, "center_x": -30, "center_y": 0 } },
    { "feature_type": "mirror", "name": "Boss mirror", "params": { "seed": "Boss", "plane": "right" } }
  ]
}

Coordinates and units

  • Front plane: sketch axes are X and Y; center_x maps to X and center_y to Y.
  • Top plane: sketch axes are X and Z; center_y maps to Z and must fall inside the base thickness.
  • Right plane: sketch axes are Y and Z; center_x maps to Y and center_y to Z.
  • Multi-feature models: read the base length, width, and depth first, then compute later coordinates. Never place several identical features at (0, 0).
  • Units: every dimension in the JSON is millimetres. The modeler converts to metres at the COM boundary.

Implementation note

The release modeler routes sketches to the requested datum plane and resolves front, top, and right planes on Chinese, English, and French UIs. For a four-corner request, the client also has a heuristic that places cuts at ±(length / 2 − 10) and ±(width / 2 − 10) in front-plane X/Y when the prompt explicitly asks for corner holes in Chinese or English.