Private Sub OButtonDefA1_OnExecute(ByVal Context As Inventor.NameValueMap) Handles OButtonDefA1.OnExecute
On Error Resume Next
Dim oDoc As Inventor.DrawingDocument
oDoc = m_inventorApplication.ActiveDocument
Dim sName As String
If oDoc.Sheets.Count = 1 Then
If Not Left(oDoc.ActiveSheet.Name, 5) = "00_00" Then
sName = "00_00"
Call oDoc.Sheets.Add(Inventor.DrawingSheetSizeEnum.kCustomDrawingSheetSize, Inventor.PageOrientationTypeEnum.kLandscapePageOrientation, sName, 80.5, 58.2)
oDoc.Sheets.Item(1).Delete(False)
Else
sName = "01_00"
Call oDoc.Sheets.Add(Inventor.DrawingSheetSizeEnum.kCustomDrawingSheetSize, Inventor.PageOrientationTypeEnum.kLandscapePageOrientation, sName, 80.5, 58.2)
End If
ElseIf oDoc.Sheets.Count > 1 Then
sName = Format(oDoc.Sheets.Count, "0#") & "_00"
Call oDoc.Sheets.Add(Inventor.DrawingSheetSizeEnum.kCustomDrawingSheetSize, Inventor.PageOrientationTypeEnum.kLandscapePageOrientation, sName, 80.5, 58.2)
End If
Dim oBorder As Inventor.BorderDefinition
oBorder = oDoc.BorderDefinitions.Item("IP-A1")
Call oDoc.ActiveSheet.AddBorder(oBorder)
Dim oTitle As Inventor.TitleBlockDefinition
oTitle = oDoc.TitleBlockDefinitions.Item("IP-TITLE-B")
Dim sPromptStrings(1) As String
sPromptStrings(0) = "N.T.S"
sPromptStrings(1) = "01"
Dim oSheet As Inventor.Sheet
oSheet = oDoc.ActiveSheet
If Not oSheet.TitleBlock Is Nothing Then
oSheet.TitleBlock.Delete()
End If
Dim oTitleBlock As Inventor.TitleBlock
oTitleBlock = oSheet.AddTitleBlock(oTitle, , sPromptStrings)
End Sub
Hope this will help you