The SOLIDWORKS macro recorder is a reasonable starting point for simple geometry operations. Record a sketch, a cut-extrude, a fillet — replay it — it works. But the moment you do anything beyond basic feature creation, the recorder either drops the operation entirely, captures it in a form that cannot be replayed on a different model, or generates so much view-manipulation noise that the useful API calls are buried.

The official documentation says “not all commands can be recorded.” That sentence is technically accurate and practically useless. This post covers the specific operations that the recorder silently omits, why each one fails, and the API call you need to write instead.

Linear Sketch Pattern and Circular Sketch Pattern

What the recorder does: Generates no code, or records the sketch creation before the pattern without recording the pattern step itself.

Linear Sketch Pattern is one of the most-requested automation operations on the SOLIDWORKS forums, and the recorder gives you nothing. This is confirmed behavior: a highly active forum contributor on the 3DEXPERIENCE community describes the recorder as “nearly useless” specifically in the context of sketch patterns and recommends writing the API call directly.

What to write instead:

Dim swSketchMgr As SldWorks.SketchManager
Set swSketchMgr = swDoc.SketchManager

' Parameters: NumX, NumY, SpacingX, SpacingY, AngleX, AngleY,
'             DeleteInstances, XSpacingDim, YSpacingDim, AngleDim,
'             CreateNumOfInstancesDimInXDir, CreateNumOfInstancesDimInYDir
Dim bStatus As Boolean
bStatus = swSketchMgr.CreateLinearSketchStepAndRepeat( _
    3, 1, _        ' 3 instances in X, 1 in Y
    0.025, 0, _   ' 25 mm spacing in X, 0 in Y (meters — see note)
    0, 0, _       ' 0 degrees angle for both axes
    "", _          ' no instances deleted
    True, False, _ ' show X spacing dim, hide Y spacing dim
    True, True, False) ' show angle dim, show X count dim, hide Y count dim

The meters trap: All dimension inputs to the SolidWorks API are in meters, regardless of your document unit settings. 0.025 is 25 mm. If you’re working in inches and pass 1, you get a pattern with 1-meter spacing. This bites everyone the first time. The full explanation of the API meters convention covers all the affected calls in one place.

For circular sketch patterns, the equivalent is CreateCircularSketchStepAndRepeat:

bStatus = swSketchMgr.CreateCircularSketchStepAndRepeat( _
    0.05, _    ' radius in meters
    6, _       ' instance count
    True, _    ' equal spacing
    True, _    ' dimension radius
    True, _    ' dimension angle
    True)      ' rotate instances

Neither method is recorded. Both must be hand-written.

Sketch Relations (Constraints)

What the recorder does: Records AddRelation2 calls, but with entity references that are tied to the specific geometry created during that recording session. The captured entity handles (swSelFACE1, selection manager indices) cannot be transferred to a different document or a different order of sketch creation.

The result: the macro replays on the exact model you recorded it on, fails silently on everything else, and the debugging session produces no useful error message because AddRelation2 returns a Boolean that almost always comes back True regardless of whether the constraint was actually applied.

What to write instead:

Get entity references explicitly from the sketch, not from the selection manager, before calling AddRelation2:

Dim swSketch    As SldWorks.Sketch
Dim swEntities  As Variant
Dim swLine1     As SldWorks.SketchSegment
Dim swLine2     As SldWorks.SketchSegment
Dim swRelMgr    As SldWorks.RelationManager

' Get the sketch from the active model
Set swSketch = swDoc.GetActiveSketch2

' GetSketchSegments returns all segments in creation order
swEntities = swSketch.GetSketchSegments

' Access specific segments by index (0-based)
Set swLine1 = swEntities(0)
Set swLine2 = swEntities(1)

' Select both entities for the constraint
swLine1.Select4 False, Nothing
swLine2.Select4 True, Nothing   ' True = add to selection

' Apply a Parallel constraint
swDoc.SketchAddConstraints "sgPARALLEL"

SketchAddConstraints takes a constraint string constant ("sgPARALLEL", "sgPERPENDICULAR", "sgCOINCIDENT", etc.). The equivalent through IRelationManager gives you a return code that indicates success or failure. Neither is recorded by the macro recorder.

Equations

What the recorder does: Nothing. The Equations dialog is modal and completely opaque to the recorder. You can open it, type equations, close it, and find that the generated macro has no trace of that interaction.

This is confirmed by multiple forum threads, most directly: “Can’t add equations to part by recording macro.”

What to write instead:

Use IEquationMgr to add, modify, or delete equations programmatically:

Dim swEqMgr As SldWorks.EquationMgr
Set swEqMgr = swDoc.GetEquationMgr

' Add3 returns the index of the new equation, or -1 on failure
' Parameters: Index (-1 = append), Equation string, Solve order, Suppress, Configuration
Dim eqIdx As Long
eqIdx = swEqMgr.Add3(-1, """Plate_Thickness"" = 0.005", True, False, "")

If eqIdx = -1 Then
    Debug.Print "Failed to add equation"
End If

' Rebuild after adding equations
swDoc.EditRebuild3

The equation string format matches what you’d type in the Equations dialog: variable name in double-quotes, equals sign, value or expression. For global variables, the name must be quoted: """MyGlobal"" = 10 * 2.54 / 1000. For dimension references: """D1@Sketch1"" = 50mm" — but note that dimension names in equations must match the actual dimension name in the model, not the display name.

IEquationMgr.Add3 is available from SOLIDWORKS 2018. Older macros may use the deprecated Add or Add2, which have fewer configuration-scope options.

View Manipulation Noise

What the recorder does: Records every zoom, rotate, and pan operation. A 30-second session of navigating to see a feature clearly before clicking it can produce 200 lines of swView.SetPickPoint, swView.FramePosition, and rotation matrix calls. These lines do nothing useful in automation replay — the view orientation has no effect on whether a feature gets created.

This isn’t a silent failure, but it makes the recorded macro unreadable and hides the calls that actually matter.

How to avoid it: Use the Pause button on the macro recording toolbar before panning and zooming to inspect your model. Press Continue before making the actual geometry operation. The pause suppresses recording during view manipulation. Most engineers discover this feature after the third time they try to find the useful API call inside 400 lines of ViewFrame calls.

If you inherited a bloated recorded macro, the cleanup pattern is: delete every block of code between two swDoc.ActiveView or swView.SetPickPoint calls, then verify the geometry-creating calls still run in sequence.

Text Note Editing in Drawings

What the recorder does: Records the INote.Select4 call that selects the note, and sometimes the IAnnotation.Select3 call, but not the text modification itself. Editing the content of an existing drawing note via the property panel produces no code.

What to write instead:

Get the note reference and call INote.SetText2 directly:

Dim swDrw        As SldWorks.DrawingDoc
Dim swSheet      As SldWorks.Sheet
Dim swAnnotation As SldWorks.Annotation
Dim swNote       As SldWorks.Note
Dim noteObjs     As Variant
Dim i            As Long

Set swDrw = swDoc
Set swSheet = swDrw.GetCurrentSheet

noteObjs = swSheet.GetNotes

If Not IsEmpty(noteObjs) Then
    For i = 0 To UBound(noteObjs)
        Set swNote = noteObjs(i)
        ' Match by current text content
        If InStr(swNote.GetText, "REVISION") > 0 Then
            swNote.SetText2 "REVISION: C"
        End If
    Next i
End If

swDoc.EditRebuild3

SetText2 accepts plain text or text with <MOD-DIAM>, <MOD-DEGREE>, and other SOLIDWORKS note formatting codes. If the note contains linked properties ($PRPSHEET:Description), replacing it with SetText2 breaks the link permanently — use INote.PropertyLinkedText variants instead to preserve the data source.

Configuration Switching

What the recorder does: Partially. Activating a configuration via the ConfigurationManager tree is sometimes recorded as swDoc.ShowConfiguration2 and sometimes not recorded at all, depending on the SOLIDWORKS version and whether the configuration panel is docked or floating.

What to write instead:

' Activate a configuration by name
Dim result As Boolean
result = swDoc.ShowConfiguration2("MyConfigName")

If Not result Then
    Debug.Print "Configuration not found: MyConfigName"
End If

ShowConfiguration2 returns False if the named configuration does not exist. The recorder-generated version (when it does capture the call) uses the same method but often with internal display-state arguments that don’t transfer to other models.

Reference Geometry — Planes, Axes From Selected Edges

What the recorder does: Records InsertRefPlane or InsertAxis calls, but with selection references that point to specific face or edge indices from the recording session. If the referenced geometry has a different face ID in another model (which it almost always does when models share similar geometry), the macro creates the reference plane attached to the wrong face.

What to write instead:

Build selections explicitly before inserting reference geometry. Use IModelDocExtension.SelectByID2 with the specific entity name and type, or select through IFace2.Select4 / IEdge.Select4 after traversing the geometry tree. The SolidWorks API silent failures post covers the selection-by-ID pitfalls in more depth.

What the Recorder Is Actually Useful For

The recorder is not useless — it’s useful for one specific purpose: discovering which API method corresponds to a UI operation you’ve never automated before. Record the action, stop the recording, and use the generated method name as a search term in the API help. The call you want is almost always one or two levels deeper than what the recorder shows, and with different parameters than what was captured.

For the operations the recorder drops entirely — sketch patterns, equations, text notes — the recorder gives you nothing to search from. That’s where community resources and the API help’s “See Also” links become the starting point.

For a practical decision on when the recorder-and-edit approach hits its limit and a full COM add-in makes more sense, see when to upgrade from a SolidWorks macro to a full add-in. The recorder-derived VBA macro is the right tool for document-level automation with 20-30 operations. Once you need event handlers, persistent state, or a UI that lives in SolidWorks’s property panel, you’ve outgrown the macro format.

The SolidWorks workflow automation guide has the broader decision tree: recorder-derived macro, Task Scheduler, PDM Dispatch, or C# add-in — with the criteria for each.