Hi All,
I am trying to retrieve page setups from our plot.dwt files by accessing the database through ReadDwgFile (each project has its own plot.dwt). For some of the files it works, but others, I get an ePermanentlyErased exception when I try to cast the oPSID to PlotSettings.
My question is:
How can I find out what is erased? The oPSID or the PlotSettings?
{code}
Public Function GetPlotSettings(ByVal FileName As String) As List(Of Batch.ImportPlotSettting)
Dim ListOfPlotSettings As New List(Of ImportPlotSettting)
Dim db As New DatabaseServices.Database
db.ReadDwgFile(FileName, DatabaseServices.FileOpenMode.OpenForReadAndAllShare, False, Nothing)
Using tr As Transaction = db.TransactionManager.StartTransaction
Try
Dim oPSID As ObjectId = db.PlotSettingsDictionaryId
Dim oPSDict As DBDictionary = CType(tr.GetObject(oPSID, OpenMode.ForWrite, False, False), DBDictionary)
Dim oDictionaryEntry As DictionaryEntry
Dim oPSV As PlotSettingsValidator = PlotSettingsValidator.Current
Dim oPlotConfig As PlotConfig
Dim oPlotSettings As PlotSettings
For i As Integer = 0 To PlotConfigManager.Devices.Count - 1
Try
PlotConfigManager.SetCurrentConfig(PlotConfigManager.Devices(i).DeviceName)
oPlotConfig = PlotConfigManager.CurrentConfig
Exit For
Catch ex As Exception
End Try
Next
Dim oPlotInfo As PlotInfo = New PlotInfo()
For Each oDictionaryEntry In oPSDict
oPSID = oDictionaryEntry.Value
''''ePermanentlyErased''''
oPlotSettings = CType(tr.GetObject(oPSID, OpenMode.ForWrite, False, False), PlotSettings)
''''ePermanentlyErased''''
'' Other code here
Next
Catch ex As Exception
Application.ShowAlertDialog(ex.Message)
Finally
End Try
End Using
{code}
Is someone out there familiar with this and able to give some pointers or advice?
Thanks
Brent