The class "LInhas" returns a string with the name of linetype.
Code: Select all
Public Shared Function DashDot() As String
Dim sLineTypName As String = "Dashdot"
Try
Dim acLineTypTbl As LinetypeTable
Dim db As Database = IntelliCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database
Dim ed As Editor = IntelliCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
Dim path As String = HostApplicationServices.Current.FindFile("Icad.lin", db, FindFileHint.Default)
Using tr As Transaction = IntelliCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.TransactionManager.StartOpenCloseTransaction
acLineTypTbl = tr.GetObject(IntelliCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database.LinetypeTableId,
Teigha.DatabaseServices.OpenMode.ForRead)
If acLineTypTbl.Has(sLineTypName) = False Then
Try
db.LoadLineTypeFile(sLineTypName, path)
Catch ex As Teigha.Runtime.Exception
If ex.ErrorStatus = ErrorStatus.FilerError Then
ed.WriteMessage(String.Format("Não encontrou arquivo {0}", "Icad.lin"))
ElseIf ex.ErrorStatus = ErrorStatus.DuplicateRecordName Then
ed.WriteMessage("Não pôde carregar linha existente !")
Else
ed.WriteMessage("Exceção: {0}", ex.Message)
End If
sLineTypName = "ByLayer"
End Try
End If
tr.Commit()
End Using
Catch ex As System.Exception
End Try
Return sLineTypName
End Function
Public Const IcadFile As String = "Icad.lin"
Dim path As String = HostApplicationServices.Current.FindFile(IcadFile, db, FindFileHint.Default)
Dim sLineTypName As String = Linhas.DashDot
Dim acLineTypTbl As LinetypeTable
acLineTypTbl = tr.GetObject(db.LinetypeTableId,
Teigha.DatabaseServices.OpenMode.ForRead)
If acLineTypTbl.Has(sLineTypName) = False Then
'' Load the Center Linetype
Try
db.LoadLineTypeFile(sLineTypName, path)
Catch ex As Teigha.Runtime.Exception
If ex.ErrorStatus = ErrorStatus.FilerError Then
ed.WriteMessage(String.Format("Não encontrou arquivo {0}", IcadFile))
ElseIf ex.ErrorStatus = ErrorStatus.DuplicateRecordName Then
ed.WriteMessage("Não pôde carregar linha existente !")
Else
ed.WriteMessage("Exceção: {0}", ex.Message)
End If
sLineTypName = "ByLayer"
End Try
End If