Imports System.IO
Imports System.Runtime.InteropServices
Module Example
<STAThread()> _
Sub Main()
Dim objApplication As SolidEdgeFramework.Application = Nothing
Dim objDocuments As SolidEdgeFramework.Documents = Nothing
Dim objDraftDocument As SolidEdgeDraft.DraftDocument = Nothing
Dim objSections As SolidEdgeDraft.Sections = Nothing
Dim objSection As SolidEdgeDraft.Section = Nothing
Dim objSectionSheets As SolidEdgeDraft.SectionSheets = Nothing
Dim objSheets As SolidEdgeDraft.Sheets = Nothing
Dim objSheet As SolidEdgeDraft.Sheet = Nothing
Dim i As Integer
Try
OleMessageFilter.Register()
' Start Solid Edge
objApplication = Activator.CreateInstance(Type.GetTypeFromProgID("SolidEdge.Application"))
objApplication.Visible = True
objDocuments = objApplication.Documents
objDraftDocument = objDocuments.Add("SolidEdge.DraftDocument")
objSheets = objDraftDocument.Sheets
objSections = objDraftDocument.Sections
' Default draft file has 1 sheet. Add 9 new sheets. Total will be 10.
For i = 1 To 9
objSheets.AddSheet(, SolidEdgeDraft.SheetSectionTypeConstants.igWorkingSection)
Next
objSection = objSections.WorkingSection
objSectionSheets = objSection.Sheets
' To demonstrate, reverse the order of the sheets.
' We start with Sheet1 ~ Sheet10. We end with Sheet10 ~ Sheet1
For i = objSectionSheets.Count To 1 Step -1
objSheet = objSectionSheets.Item(1)
objSheet.Number = i
Next
Catch ex As Exception
Console.WriteLine(ex.Message)
Finally
OleMessageFilter.Revoke()
End Try
End Sub
End Module