Blog · STEP · 1 Oct 2026 · Last updated 13 Oct 2026 · 5 min read · By Stefano B.
Inventor multi body part to assembly with iLogic, one part file per body
A STEP often arrives as one part with many solid bodies. To draw each one you need one part file per body. A tested iLogic rule that copies every body into its own part file and places them all in an assembly, plus the traps: bodies looked up by index, gaps in the numbering, bodies that will not delete.
Short answer: to go from an Inventor multi body part to assembly, copy each solid body with TransientBRep.Copy, put the copy in a new part with NonParametricBaseFeatures.Add, save it, and place it in an assembly with an identity matrix: every part lands where its body was. The bodies of the client's file are never changed. Find bodies by their Name, never by index.


We ran the code on this page as an iLogic rule in Inventor 2025, copied as it is (only sFolder changed), on a test part we modelled for it: seven plates in one part, saved as STEP, then two bodies removed to leave gaps in the numbering. The images are the drawing views of that part and of the files the rule wrote, exported to DXF and redrawn.
This came up on the Autodesk forum: multi-body part to assembly made by iLogic. This page is the long answer.
Why one file per body
A steel model often arrives as one STEP part with every plate as a solid body, all in one coordinate system. Our drawing rules work on one part file per plate, so the first step is one .ipt per plate.
The rule
Open the multi body part and run this rule (Manage > iLogic > Add Rule, paste, Save & Run):
Dim sFolder As String = "C:\Temp\split\" ' must exist, ends with \
Dim sPrefix As String = "P-" ' files P-001.ipt, P-002.ipt...
Dim oApp As Inventor.Application = ThisApplication
Dim oSrc As PartDocument = ThisDoc.Document
Dim sPartTpl As String = oApp.FileManager.GetTemplateFile(DocumentTypeEnum.kPartDocumentObject)
Dim sAsmTpl As String = oApp.FileManager.GetTemplateFile(DocumentTypeEnum.kAssemblyDocumentObject)
Dim oAsm As AssemblyDocument = oApp.Documents.Add(DocumentTypeEnum.kAssemblyDocumentObject, sAsmTpl, False)
Dim oPlace As Matrix = oApp.TransientGeometry.CreateMatrix() ' identity: each part stays where its body was
Dim nPos As Integer = 0
For Each oBody As SurfaceBody In oSrc.ComponentDefinition.SurfaceBodies
nPos += 1
Dim oCopy As SurfaceBody = oApp.TransientBRep.Copy(oBody) ' a copy: the source part is not touched
Dim oNew As PartDocument = oApp.Documents.Add(DocumentTypeEnum.kPartDocumentObject, sPartTpl, False)
oNew.ComponentDefinition.Features.NonParametricBaseFeatures.Add(oCopy)
Dim sFile As String = sFolder & sPrefix & nPos.ToString("000") & ".ipt"
oNew.SaveAs(sFile, False)
oNew.Close(True)
oAsm.ComponentDefinition.Occurrences.Add(sFile, oPlace)
Next
oAsm.SaveAs(sFolder & sPrefix & "assembly.iam", False)
oAsm.Close(True)
What to change:
sFolder: where the part files and the assembly go. The folder must exist.sPrefixandnPos.ToString("000"): the file names.sPartTpl,sAsmTpl: the default templates. Put the full path of yours if your title block or units live there.- The rule does not change the bodies of the source part. But a rule added with Add Rule is stored in the part: close it without saving and the client's file stays as it came.
On our test part the rule wrote five part files and an assembly with five occurrences. Each file holds one body with the same volume as its source body, and each occurrence sits exactly where that body was (same bounding box corner).
Find a body by name, not by index
Dim oFound As SurfaceBody = Nothing
For Each b As SurfaceBody In oSrc.ComponentDefinition.SurfaceBodies
If b.Name = "Solid5" Then oFound = b : Exit For
Next
SurfaceBodies.Item(n) is a position in the list, not the number in the name. Our test STEP has five bodies: Solid1, Solid3, Solid5, Solid8, Solid9.

Traps
| Trap | What we measured | Rule |
|---|---|---|
SurfaceBodies.Item(3) |
Returns Solid5: the names have gaps, no error |
Loop and compare .Name |
SurfaceBodies.Item(9) |
Error, although Solid9 exists: there are only 5 bodies |
Loop to the count; the highest number in a name can be higher |
SurfaceBodies.Item("Solid5") |
Error: Conversion from string "Solid5" to type 'Integer' is not valid |
Loop and compare .Name |
| Body names after a STEP round trip | Our 7 bodies Solid1…Solid7, saved as STEP and opened again, came back as Solid2…Solid8 |
Do not store body names across imports: read them from the file you split |
SurfaceBody.Delete on a body from STEP |
Error (E_FAIL), the body stays |
Delete the NonParametricBaseFeature that holds it |
| Feature names | Feature Solid2 holds body Solid1, feature Solid4 holds Solid3 |
Find the feature through its SurfaceBodies, not its name |
SurfaceBody.Volume |
Needs an argument: Volume(0.001) |
Or use MassProperties.Volume of the new part |
Putting a body back into the multi body part
Sometimes the reverse is needed: a part changed by hand must go back into the multi body part. The flow: read occ.Transformation, TransientBRep.Copy the body, TransientBRep.Transform it with that matrix, then NonParametricBaseFeatures.AddByDefinition.
| Trap | What we measured | Fix |
|---|---|---|
OutputType set to surface |
No new solid body; a work surface appears instead | defi.OutputType = kSolidOutputType (90114) |
Add(collection) |
Type mismatch | AddByDefinition(defi) with defi.BRepEntities as an ObjectCollection |
Matrix.AsArray from Python (late binding) |
Fails | Read m.Cell(r, c), indices 1 to 4 |
Check: compare volumes before and after. On our test part every copy had the same volume as its source body.
Do and don't
Do
- Copy bodies into new part files; leave the source alone.
- Look bodies up by name.
- Check the number of files and their volumes after the run.
Don't
- Don't index
SurfaceBodiesby a number taken from a body name. - Don't trust "no error":
Item(3)returned the wrong body without one.
Questions people ask
Does it work on hundreds of bodies? The rule loops over every body; we ran it on five. On any count the check is the same: number of files and their volumes. In our work the AI agent writes and adapts the rule, Inventor runs it.
What name does each part get?
Here a prefix and a position (P-001, P-002...). Codes are made final later, after identical parts are merged: merging identical parts and renumbering drawings. Next step for each part: choosing the base view for STEP parts, and for bent plates the flat pattern from a STEP solid.