I've been writing a small code to convert all draft files in a folder to PDFs. The code works fine. But the problem is that if one of the files has views that are not updated or is detached from its source, I have to manually click OK for the message box displayed by SE before the code can continue. The workaround would be to open the draft file as inactive. Is there a way to specify this when using the application.document.open(*pathname*)??
The code is as follows:
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim str As String()
Dim app As SolidEdgeFramework.Application = Nothing
Dim draft As SolidEdgeDraft.DraftDocument
Dim fname As String
Dim ext As String
Dim i As Integer = 0
If FolderBrowserDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
str = IO.Directory.GetFiles(FolderBrowserDialog1.Selecte
app = SolidEdgeCommunity.SolidEdgeUtils.Connect(True, False)
For i = 0 To str.Count - 1
ProgressBar1.Minimum = 0
ProgressBar1.Maximum = 100
ProgressBar1.Value = i / (str.Count - 1) * 100
ext = System.IO.Path.GetExtension(str.ElementAt(i))
fname = str.ElementAt(i)
If ext = ".dft" Then
draft = app.ActiveDocument
fname = FolderBrowserDialog1.SelectedPath + "\" + Path.GetFileNameWithoutExtension(fname) + ".pdf"
str = Nothing
app = Nothing
draft = Nothing
fname = Nothing
ext = Nothing
i = Nothing
MsgBox("No folder selected")
Set the Solid Edge Application in the right mode:
SEapplication.DisplayAlerts = False 'do something here SEapplication.DisplayAlerts = True
Greetings from Switzerland
Thanks for the reply. Solved my problem.
But I was wondering whether opening the drafts in inactive mode would speed up the process?
I have not personally tried it but I would give the following code a try.
ApplicationGlobalConstants.seApplicationGlobalSess ionDraftOpenInactive, true)