SolidWorks List Faces
Dump normal + centroid for every face on every solid body of the active part.
Prerequisites
- SolidWorks 2024+ with SwpilotCLI add-in installed
- .NET 8+ Runtime
- An active Part document (
.sldprt)
What this Skill does
- Casts the active document to
PartDoc - Calls
GetBodies2(swSolidBody)to iterate all solid bodies - For each body, iterates
GetFaces()and reads: Face2.Normal— unit normal vectorFace2.GetBox()— bounding box, used to compute centroid- Prints one line per face:
```
Normal=(nx,ny,nz) Centre=(cx,cy,cz)mm
```
When to use
- Before
sketch-on-facewhen you want to see all candidate faces - Debugging: find the exact world coordinate to pass to
SelectByID2("", "FACE", x, y, z, ...) - Auditing: verify a generated part has the expected number of faces
Quick start
dotnet run --project ./sup_tools/swpilotcli-list-faces/scripts/ListFaces/ListFaces.csproj
Return codes
| Code | Meaning |
|------|---------|
| 0 | Success |
| 1 | No solid bodies found, or general error |
| 2 | Cannot connect to SolidWorks |
| 3 | No active document |