Inventor supports the extrusion of Text object. The following sample code demonstrates how to extrude the text.
Public Sub ExtrudeText()
'create a part Document
Dim oPartDoc As PartDocument
oPartDoc = m_inventorApplication.Documents.Add( _
DocumentTypeEnum.kPartDocumentObject, _
m_inventorApplication.FileManager.GetTemplateFile( _
DocumentTypeEnum.kPartDocumentObject))
Dim oCompDef As PartComponentDefinition
oCompDef = oPartDoc.ComponentDefinition
'get the xy work plane
Dim oSketch As PlanarSketch
oSketch = oCompDef.Sketches.Add( _
oCompDef.WorkPlanes.Item(3))
' access the transient geometry object
Dim oTG As TransientGeometry
oTG = m_inventorApplication.TransientGeometry
Call oSketch.SketchLines.AddAsTwoPointRectangle( _
oTG.CreatePoint2d(0, 0), oTG.CreatePoint2d(20, 10))
' prepare the skecth for extrusion
Dim oProfile As Profile
oProfile = oSketch.Profiles.AddForSolid
' create the extrusion
Dim oExtrudeDef As ExtrudeDefinition = _
oCompDef.Features.ExtrudeFeatures. _
CreateExtrudeDefinition(oProfile, _
PartFeatureOperationEnum.kJoinOperation)
oExtrudeDef.SetDistanceExtent(2, _
PartFeatureExtentDirectionEnum.kNegativeExtentDirection)
Dim oExtrude As ExtrudeFeature
oExtrude = oCompDef.Features.ExtrudeFeatures.Add(oExtrudeDef)
' get the active camera and fit the view
Dim oCamera As Camera
oCamera = m_inventorApplication.ActiveView.Camera
oCamera.ViewOrientationType = ViewOrientationTypeEnum. _
kIsoTopLeftViewOrientation
oCamera.Fit()
oCamera.Apply()
'Place Sketch Text
oSketch = oCompDef.Sketches.Add( _
oExtrude.StartFaces.Item(1))
Dim oText As TextBox
oText = oSketch.TextBoxes.AddByRectangle( _
oTG.CreatePoint2d(0, 0), _
oTG.CreatePoint2d(20, 10), _
"<StyleOverride FontSize='2.54' Bold='True'>" +
"Sample</StyleOverride>")
oText.HorizontalJustification = _
HorizontalTextAlignmentEnum.kAlignTextCenter
oText.VerticalJustification = _
VerticalTextAlignmentEnum.kAlignTextMiddle
'Extrude Text
oProfile = oSketch.Profiles.AddForSolid
oExtrude = oCompDef.Features.ExtrudeFeatures. _
AddByDistanceExtent(oProfile, 0.5, _
PartFeatureExtentDirectionEnum. _
kPositiveExtentDirection, _
PartFeatureOperationEnum.kJoinOperation)
End Sub