Read & Write Cut-List Properties for Weldments
Access custom properties on weldment and sheet metal cut-list items — a completely different API path from standard file-level custom properties that trips up most developers.
public void ReadCutListProperties(ModelDoc2 model)
{
var feat = (Feature)model.FirstFeature();
while (feat != null)
{
if (feat.GetTypeName2() == "CutListFolder")
{
var folder = (BodyFolder)feat.GetSpecificFeature2();
folder.SetAutomaticCutList(true);
folder.UpdateCutList();
// Cut-list properties live on the FEATURE, not the body
var mgr = feat.CustomPropertyManager;
string valOut = "", resolvedOut = "";
bool wasResolved;
mgr.Get6("Description", false,
out valOut, out resolvedOut, out wasResolved, out _);
Console.WriteLine($" Description: {resolvedOut}");
mgr.Get6("Length", false,
out valOut, out resolvedOut, out wasResolved, out _);
Console.WriteLine($" Length: {resolvedOut}");
// Write a property
mgr.Add3("CostCenter",
(int)swCustomInfoType_e.swCustomInfoText,
"WLD-100",
(int)swCustomPropertyAddOption_e.swCustomPropertyReplaceValue);
}
feat = (Feature)feat.GetNextFeature();
}
}Why This Is Different
SolidWorks has three separate places where custom properties live:
- File-level properties: ModelDoc2.Extension.CustomPropertyManager[""] — applies to the whole file
- Configuration-specific properties: CustomPropertyManager["ConfigName"] — varies per config
- Cut-list properties: Feature.CustomPropertyManager on CutListFolder features — applies to individual weldment bodies or sheet metal bodies
Most developers learn #1 and #2 and assume that covers everything. Then they try to read weldment body descriptions and get nothing back — because those properties are stored at the cut-list level (#3).
How to Find Cut-List Folders
Cut-list folders are features with GetTypeName2() == "CutListFolder". They appear under the Cut list folders node in the Feature Manager tree. Each folder groups bodies that share the same profile (for weldments) or the same flat pattern (for sheet metal).
To find them, traverse the feature tree and check each feature's type name:
var feat = (Feature)model.FirstFeature();
while (feat != null)
{
if (feat.GetTypeName2() == "CutListFolder")
{
// This is a cut-list item
}
feat = (Feature)feat.GetNextFeature();
}Important: Update Before Reading
Cut-list data can be stale. Always call these before reading properties:
- BodyFolder.SetAutomaticCutList(true) — enables automatic updates
- BodyFolder.UpdateCutList() — forces a refresh of all cut-list data
Without this, you may get empty or outdated values for properties like Length, Angle, and Thickness.
Common Cut-List Properties
| Property | Weldments | Sheet Metal |
|---|---|---|
| Description | Profile name (e.g., "C Channel 6 x 8.2") | "Sheet Metal" |
| Length | Member length | Flat pattern bounding box length |
| Thickness | N/A | Material thickness |
| Material | Inherited from body | Inherited from body |
| Bounding Box Length/Width | Available | Available |
Tips
- Cut-list properties show up in weldment cut lists and sheet metal cut lists in drawings — they drive BOM content
- You can also access the bodies in each cut-list folder via BodyFolder.GetBodies() to get IBody2 references
- The cut-list folder feature name (feat.Name) is what appears in the Feature Manager tree — you can rename it programmatically