A Practical Guide for Reliable iFeature Placement
Automating sheet metal design tasks in Autodesk Inventor can dramatically improve productivity, consistency, and design quality. One common automation requirement is the ability to programmatically place punch features—such as dimples, louvers, embosses, or knockouts—using iFeature definition files (.ide).
While these punch features are easy to place using the Inventor user interface, doing the same through the Inventor API requires a clear understanding of how placement context is created and controlled.
This article explains the essential concepts, common pitfalls, and the correct automation workflow—using VBA examples that work reliably in Inventor projects.
Understanding Punch iFeatures
Punch iFeatures are reusable feature definitions designed specifically for sheet metal parts. They typically exist in two forms:
Table-Driven iFeatures
- Feature dimensions are controlled through an internal table.
- Common for vendor-supplied punch libraries and standardized tooling.
Non-Table-Driven iFeatures
- Parameters such as diameter and depth are set directly.
- Useful for flexible or parametric punch designs.
✅ From an API perspective, both types are placed in the same way.
The only difference is how their inputs are populated.
Why API Placement Feels Different from UI Placement
When you place a punch manually using the Inventor UI, Inventor automatically:
- Determines a suitable reference face
- Creates a sketch plane
- Resolves feature orientation
When using the Inventor API, none of this happens implicitly.
Key takeaway
When placing punch iFeatures programmatically, you must explicitly build and control the placement context.
If this is not done correctly, the iFeature may:
- Fail silently
- Appear in the wrong orientation
- Behave inconsistently across models
The Required Placement Workflow
A reliable VBA automation workflow always follows these steps:
- Create a sheet metal part
- Create a planar sketch
- Build a face feature from that sketch
- Select a face of that feature
- Assign that face to the iFeature’s sketch plane input
- Apply parameter values or table selections
- Add the iFeature to the model
This mirrors what the UI does automatically—but makes every step explicit and predictable.
VBA Example: Table-Driven Punch iFeature
The following VBA macro demonstrates how to place a table-driven punch iFeature using a fully defined placement context.
Public Sub CreateiFeature1()
' Create a new sheet metal document, using the default sheet metal template.
Dim oSheetMetalDoc As PartDocument
Set oSheetMetalDoc = ThisApplication.Documents.Add(kPartDocumentObject, _
ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject, , , "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"))
' Set a reference to the component definition.
Dim oCompDef As SheetMetalComponentDefinition
Set oCompDef = oSheetMetalDoc.ComponentDefinition
' Set a reference to the sheet metal features collection.
Dim oSheetMetalFeatures As SheetMetalFeatures
Set oSheetMetalFeatures = oCompDef.Features
' Create a new sketch on the X-Y work plane.
Dim oSketch As PlanarSketch
Set oSketch = oCompDef.Sketches.Add(oCompDef.WorkPlanes.Item(3))
' Set a reference to the transient geometry object.
Dim oTransGeom As TransientGeometry
Set oTransGeom = ThisApplication.TransientGeometry
' Draw a rectangle
Call oSketch.SketchLines.AddAsTwoPointRectangle( _
oTransGeom.CreatePoint2d(-15, -15), _
oTransGeom.CreatePoint2d(15, 15))
' Create a profile.
Dim oProfile As profile
Set oProfile = oSketch.Profiles.AddForSolid
Dim oFaceFeatureDefinition As FaceFeatureDefinition
Set oFaceFeatureDefinition = oSheetMetalFeatures.FaceFeatures.CreateFaceFeatureDefinition(oProfile)
' Create a face feature.
Dim oFaceFeature As FaceFeature
Set oFaceFeature = oSheetMetalFeatures.FaceFeatures.Add(oFaceFeatureDefinition)
' Get the top face.
Dim oFrontFace As Face
Set oFrontFace = oFaceFeature.Faces.Item(6)
' Create a new sketch on this face.
Set oSketch = oCompDef.Sketches.AddWithOrientation(oFrontFace, _
oCompDef.WorkAxes.Item(1), True, True, oCompDef.WorkPoints(1))
Dim oFeatures As PartFeatures
Set oFeatures = oCompDef.Features
' Create an iFeatureDefinition object.
Dim oiFeatureDef As iFeatureDefinition
Set oiFeatureDef = oFeatures.iFeatures.CreateiFeatureDefinition( _
"C:\Temp\Sample_table.ide")
' Set the input.
Dim oInput As iFeatureInput
For Each oInput In oiFeatureDef.iFeatureInputs
Select Case oInput.Name
Case "Profile Plane1"
Dim oPlaneInput As iFeatureSketchPlaneInput
Set oPlaneInput = oInput
oPlaneInput.PlaneInput = oFrontFace
End Select
Next
' Create the iFeature.
Dim oiFeature As iFeature
Set oiFeature = oFeatures.iFeatures.Add(oiFeatureDef)
End Sub
VBA Example: Non-Table-Driven Punch iFeature
For non-table punch features, parameters must be assigned directly.
Public Sub CreateiFeature2()
' Create a new sheet metal document, using the default sheet metal template.
Dim oSheetMetalDoc As PartDocument
Set oSheetMetalDoc = ThisApplication.Documents.Add(kPartDocumentObject, _
ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject, , , "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"))
Dim oCompDef As SheetMetalComponentDefinition
Set oCompDef = oSheetMetalDoc.ComponentDefinition
Dim oSheetMetalFeatures As SheetMetalFeatures
Set oSheetMetalFeatures = oCompDef.Features
Dim oSketch As PlanarSketch
Set oSketch = oCompDef.Sketches.Add(oCompDef.WorkPlanes.Item(3))
Dim oTransGeom As TransientGeometry
Set oTransGeom = ThisApplication.TransientGeometry
Call oSketch.SketchLines.AddAsTwoPointRectangle( _
oTransGeom.CreatePoint2d(-15, -15), _
oTransGeom.CreatePoint2d(15, 15))
Dim oProfile As profile
Set oProfile = oSketch.Profiles.AddForSolid
Dim oFaceFeatureDefinition As FaceFeatureDefinition
Set oFaceFeatureDefinition = oSheetMetalFeatures.FaceFeatures.CreateFaceFeatureDefinition(oProfile)
Dim oFaceFeature As FaceFeature
Set oFaceFeature = oSheetMetalFeatures.FaceFeatures.Add(oFaceFeatureDefinition)
Dim oFrontFace As Face
Set oFrontFace = oFaceFeature.Faces.Item(6)
Set oSketch = oCompDef.Sketches.AddWithOrientation(oFrontFace, _
oCompDef.WorkAxes.Item(1), True, True, oCompDef.WorkPoints(1))
Dim oFeatures As PartFeatures
Set oFeatures = oCompDef.Features
Dim oiFeatureDef As iFeatureDefinition
Set oiFeatureDef = oFeatures.iFeatures.CreateiFeatureDefinition( _
"C:\Temp\Sample_no_table.ide")
Dim oInput As iFeatureInput
For Each oInput In oiFeatureDef.iFeatureInputs
Select Case oInput.Name
Case "Profile Plane1"
Dim oPlaneInput As iFeatureSketchPlaneInput
Set oPlaneInput = oInput
oPlaneInput.PlaneInput = oFrontFace
Case "Dia"
Dim oParamInput As iFeatureParameterInput
Set oParamInput = oInput
oParamInput.Expression = "2 in"
Case "Depth"
Set oParamInput = oInput
oParamInput.Expression = "0.2 in"
End Select
Next
Dim oiFeature As iFeature
Set oiFeature = oFeatures.iFeatures.Add(oiFeatureDef)
End Sub
Best Practices for Reliable Automation
To build robust and maintainable automation:
- ✅ Always create and control the placement face explicitly
- ✅ Avoid hard-coding face indices where possible
- ✅ Validate required iFeature inputs before assigning values
- ✅ Handle table-driven and non-table-driven features gracefully
- ✅ Add logging for troubleshooting and support
Final Thoughts
Punch iFeatures are a powerful way to standardize sheet metal design, and the Inventor API fully supports their automation—even in VBA.
The key to success lies in understanding that the API does not replicate the UI’s implicit behavior.
By explicitly building the placement context—sketches, faces, orientation, and inputs—you gain predictable, repeatable results every time.
With this foundation in place, you can confidently scale your sheet metal automation across projects, teams, and design standards.

Leave a Reply