Blog · STEP · 1 Oct 2026 · 3 min read
How to split a STEP multi-body into separate Inventor part files with the API
The STEP arrives as one part with hundreds of solid bodies. To draw each one you need one part file per body. The iLogic code that does it, why you never convert the client's file, and the traps: bodies looked up by index, gaps in the numbering, bodies that will not delete.
Short answer: for each body, make a transient copy with TransientBRep.Copy, create a new part document, and add the copy with NonParametricBaseFeatures.Add. Save it under the part code. Never convert or edit the client's original file. Find bodies by looping over their Name, never by index.
Why one file per body
A steel model often arrives as one STEP part: one of ours had 225 solid bodies sharing one coordinate system. Inventor draws documents, not bodies. To get one cutting drawing per plate you first need one .ipt per plate.
The code
' copy the body out of the multi-body
Dim oNewBody As SurfaceBody = oApp.TransientBRep.Copy(oSrcBody)
If bStraighten Then
oApp.TransientBRep.Transform(oNewBody, oMatRot) ' optional: lay it flat
End If
oNewPart = oApp.Documents.Add(kPartDocumentObject, sPartTemplate, True)
Dim oNewDef As PartComponentDefinition = oNewPart.ComponentDefinition
oNewDef.Features.NonParametricBaseFeatures.Add(oNewBody)
Dim sCode As String = sProject & sType & "-" & nPos.ToString("000")
oNewPart.SaveAs(sIptPath, False)
The transient copy is also the right moment to rotate the body into a convenient position, before any drawing view exists: see choosing the base view for STEP parts.
Traps
| Trap | What happens | Rule |
|---|---|---|
SurfaceBodies.Item("Solid8") |
Does not look up by name | For Each over the bodies, compare .Name |
SurfaceBodies.Item(9) when numbering has gaps |
Returns Solid12. On one model 136 of 144 indices pointed to the wrong body, without one error |
Always find bodies by name |
| Loop up to the body count | Positions can go higher than the count (130 bodies, positions up to 151). The last part was never generated | Loop to the highest position number |
SurfaceBody.Volume |
Does not exist | .MassProperties.Volume |
SurfaceBody.Delete on a STEP body |
Does nothing | Delete the NonParametricBaseFeature. The feature name does not tell you which body it holds (Solid20 sat in feature _22) |
| Converting the client's file | You lose the original and its state | Work on transient copies in new files |
Putting a body back into the multi-body
Sometimes the reverse is needed: a part redesigned by hand must replace several bodies in the multi-body. From VBScript the flow is: read occ.Transformation from the assembly, TransientBRep.Copy, Transform, then NonParametricBaseFeatures.AddByDefinition.
| Trap | Effect | Fix |
|---|---|---|
| Matrix rebuilt from printed values | Rounded to 6 digits, determinant 1.00000015, Transform gives err 5 |
Take the matrix from the object: Set m = occ.Transformation |
Wrong OutputType |
The part comes in as a surface; body count does not grow | defi.OutputType = 90114 (solid) |
Add(collection) |
err 13 | AddByDefinition(defi) with defi.BRepEntities as an ObjectCollection |
Matrix.AsArray() from VBScript |
Does not work | Read m.Cell(r, c), indices 1 to 4 |
DerivedPartComponents |
Inserts, but the derived part cannot be rotated | Use the transient copy route |
Check: compare volumes. In one case the 29 new bodies summed to 46,231,872 mm³ against 46,241,620 mm³ for the plate they replaced: 0.02% apart.
Do and don't
Do
- Copy bodies into new part files; leave the source alone.
- Look bodies up by name.
- Loop to the highest position, not the count.
- Check volumes before and after.
Don't
- Don't index
SurfaceBodiesby number. - Don't rebuild matrices from printed numbers.
- Don't trust "no error": the wrong-body bug produced none.
Questions people ask
Can an AI agent do this for hundreds of bodies? Yes. It runs as an iLogic rule over every body; the agent writes the rule and checks the count of files and their volumes afterwards.
What name does each part get?
A code from the project, type and position (P-001, P-002...). Codes are made final later, after identical parts are merged: merging identical parts and renumbering drawings.