By Adam Nagy
There is a comprehensive .NET sample using the AutoCAD Mechanical COM API in the SDK under "acadmapi\sample\dotNet" called "netTitleBorder": http://usa.autodesk.com/adsk/servlet/index?id=14952981&siteID=123112
Here is also a simpler VBA code that shows how the relevant API works:
Public Sub CreateTitleBorder() ' Requires a reference to: ' - Autodesk SymBBAuto Type Library ' - Autodesk AutoCAD Mechanical Type Library 'Get Application Object Dim oApp As AcadmApplication Set oApp = ThisDrawing.Application.GetInterfaceObject( _
"AcadmAuto.AcadmApplication") 'Reference to the Symbol Manager Dim symMgr As McadSymbolBBMgr Set symMgr = ThisDrawing.Application.GetInterfaceObject( _
"SymBBAuto.McadSymbolBBMgr") 'Reference to the TitleBorder Manager Dim oTitleBMng As McadTitleBorderMgr Set oTitleBMng = symMgr.TitleBorderMgr 'Create New Descriptor Dim oDescriptor As McadTitleBorderDescriptor Set oDescriptor = oTitleBMng.NewDescriptor 'Set Position oDescriptor.Position(0) = 0 oDescriptor.Position(1) = 41.7 oDescriptor.Position(2) = 0 'Fill up Border properties oDescriptor.Border.Name = "ANSI_C" oDescriptor.Border.Extends(0)(0) = 1E+20 oDescriptor.Border.Extends(0)(1) = 1E+20 oDescriptor.Border.Extends(0)(2) = 1E+20 oDescriptor.Border.Extends(1)(0) = -1E+20 oDescriptor.Border.Extends(1)(1) = -1E+20 oDescriptor.Border.Extends(1)(2) = -1E+20 oDescriptor.Border.Position(0) = 0 oDescriptor.Border.Position(1) = 41.7 oDescriptor.Border.Position(2) = 0 'Fill up Title Properties oDescriptor.Title.Name = "ANSI_TITUS" oDescriptor.Title.Position(0) = 21.5 oDescriptor.Title.Position(1) = 42.443 oDescriptor.Title.Position(2) = 0 'Create Title Attribute Values Dim Attributes(0 To 19, 0 To 1) As String Attributes(0, 0) = "GEN-TITLE-APPM": Attributes(0, 1) = "My Boss" Attributes(1, 0) = "GEN-TITLE-ISSD": Attributes(1, 1) = "02/02/2008" Attributes(2, 0) = "GEN-TITLE-NAME": Attributes(2, 1) = _
"Administrator" Attributes(3, 0) = "GEN-TITLE-CTRN": Attributes(3, 1) = "12358746" Attributes(4, 0) = "GEN-TITLE-DACT": Attributes(4, 1) = "" Attributes(5, 0) = "GEN-TITLE-CHKD": Attributes(5, 1) = "01/01/2008" Attributes(6, 0) = "GEN-TITLE-SCA": Attributes(6, 1) = "1'0""=1'0""" Attributes(7, 0) = "GEN-TITLE-DES1": Attributes(7, 1) = "Title1" Attributes(8, 0) = "GEN-TITLE-REV": Attributes(8, 1) = "rev1" Attributes(9, 0) = "GEN-TITLE-WT": Attributes(9, 1) = "Weight" Attributes(10, 0) = "GEN-TITLE-DES2": Attributes(10, 1) = "Subtitle1" Attributes(11, 0) = "GEN-TITLE-SIZ": Attributes(11, 1) = "C" Attributes(12, 0) = "GEN-TITLE-APPD": Attributes(12, 1) = "05/02/2008" Attributes(13, 0) = "GEN-TITLE-ISSM": Attributes(13, 1) = "Johnny" Attributes(14, 0) = "GEN-TITLE-DWG": Attributes(14, 1) = "Drawing1" Attributes(15, 0) = "GEN-TITLE-DAT": Attributes(15, 1) = "02/12/2008" Attributes(16, 0) = "GEN-TITLE-FSCM": Attributes(16, 1) = "-0125412" Attributes(17, 0) = "GEN-TITLE-CHKM": Attributes(17, 1) = "Joe" Attributes(18, 0) = "GEN-TITLE-NR": Attributes(18, 1) = "-0123654" Attributes(19, 0) = "GEN-TITLE-SHEET": Attributes(19, 1) = "Sheet1" oDescriptor.Title.Attributes = Attributes 'Set Scale oDescriptor.TitleBorderScale = 1 'Create New Context Dim oContext As McadTitleBorderContext Set oContext = oTitleBMng.NewContext 'oContext.AutomaticPlacement = True 'oContext.BaseScale = True 'oContext.DwgDefault = True 'oContext.MoveObjects = True 'oContext.Rescale = True 'oContext.RetrieveFromAsmProp = True 'oContext.RetrieveFromPartRef = True 'oContext.ThawAllLayers = True 'Create Title Border Dim oTitleBorder As McadTitleBorder Set oTitleBorder = oTitleBMng.CreateTitleBorder(oDescriptor, oContext) End Sub
The result: