.swp macro

Rename Custom Property: rename across many files

Renames a custom property across many files. Works on parts, assemblies and drawings.

Properties

PRT PartsASM AssembliesDRW Drawings

Download Rename Custom Property.swp Get SwMacroFlow

Put the downloaded file in this folder, then open SwMacroFlow and choose it from the library.

%LOCALAPPDATA%\SwMacroFlow\macros

Runs per file — point the scope at a folder and it renames the property in each document in turn.

Inputs

FieldPurpose
OldNameThe property to rename. Files that do not have it are reported as nothing to do, not as failures.
NewNameThe name to give it.
ScopeFile, Active configuration, All configurations, or File and all configurations (the default).
OverwriteOff by default. Leave it off and a document that already has NewName is reported rather than quietly overwritten.

SOLIDWORKS has no rename

There is no rename API for a custom property, so this adds the new name carrying the old value and then deletes the old one. Two consequences:

  • The property moves to the end of the list. It is genuinely a new property. Nothing reads custom properties by position, but it will look different in the Summary Information dialog.
  • The stored value is carried, never the resolved one. A property holding D1@Sketch1 keeps that expression. Carrying the resolved value would write the number it currently evaluates to and break the link permanently — the rename would quietly become a flatten.

The type is carried too. A property that was a Date or a Number keeps behaving like one in a BOM or a drawing note, rather than everything becoming Text.

Results

OutcomeMeaning
OKRenamed and saved. Says how many stores changed.
WarningThe document does not have OldName anywhere in scope. Nothing was saved.
ErrorRead-only, never saved, NewName already present with Overwrite off, or the save failed.

Linked properties

If the old property is linked to a dimension or an equation, SOLIDWORKS refuses to delete it. The new name will have been created in memory, but nothing is saved and the file is reported as an error naming the property — rather than being left with both names on disk.

Chaining

Place it before any export macro so the exported files carry the renamed property. It saves the document, and does not close or rebuild it.

Add the macro several times in one chain to rename several properties in a single pass over the files.