Opening drafts in inactive mode



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*pathname*)??


The code is as follows:

Imports System.IO

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
'Process.Start("explorer.exe", FolderBrowserDialog1.SelectedPath)
str = IO.Directory.GetFiles(FolderBrowserDialog1.SelectedPath)
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"
End If
Next i
str = Nothing
app = Nothing
draft = Nothing
fname = Nothing
ext = Nothing
i = Nothing
MsgBox("No folder selected")
End If

End Sub
End Class


Re: Opening drafts in inactive mode

Set the Solid Edge Application in the right mode:

SEapplication.DisplayAlerts = False
'do something here

SEapplication.DisplayAlerts = True

Greetings from Switzerland



Re: Opening drafts in inactive mode

Hi Matthias,


Thanks for the reply. Solved my problem.

But I was wondering whether opening the drafts in inactive mode would speed up the process?



Re: Opening drafts in inactive mode

I have not personally tried it but I would give the following code a try.


Application.SetGlobalParameter(SolidEdgeConstants.ApplicationGlobalConstants.seApplicationGlobalSessionDraftOpenInactive, true)
Jason Newell
Applications Architect