Message 1 of 9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
Is it possible to reload a linetype without having to use the send command method. I am familiar with Dev Blogs solution for this but I am curious if it can be done without the send command method. This is what I have so far:
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Public Class AutocadService
Implements IAutocadService
Public Sub LoadLinetype(ByVal selectedLineTypeName As String, ByVal lineTypeFile As String) Implements IAutocadService.LoadLinetype
Try
Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acDoc.Database
Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
Dim acLineTypTbl As LinetypeTable
acLineTypTbl = acTrans.GetObject(acCurDb.LinetypeTableId, OpenMode.ForRead)
If acLineTypTbl.Has(selectedLineTypeName) = True Then
'reload linetype somehow
Dim frmMessageBox As New frmMessageBox
frmMessageBox.lblHeader.Text = "Linetype Loader"
frmMessageBox.lblMessageTitle.Text = "Linetype Loaded Successfully!"
frmMessageBox.lblMessageBody.Text = "The selected linetype, " & selectedLineTypeName & ", has been re-loaded in the drawing."
frmMessageBox.picIcon.Image = My.Resources.msbComplete
frmMessageBox.ShowDialog()
ElseIf acLineTypTbl.Has(selectedLineTypeName) = False Then
acCurDb.LoadLineTypeFile(selectedLineTypeName, lineTypeFile)
Dim frmMessageBox As New frmMessageBox
frmMessageBox.lblHeader.Text = "Linetype Loader"
frmMessageBox.lblMessageTitle.Text = "Linetype Loaded Successfully!"
frmMessageBox.lblMessageBody.Text = "The selected linetype, " & selectedLineTypeName & ", is now available in the drawing."
frmMessageBox.picIcon.Image = My.Resources.msbComplete
frmMessageBox.ShowDialog()
End If
acTrans.Commit()
End Using
Catch ex As Exception
Dim frmMessageBox As New frmMessageBox
frmMessageBox.lblHeader.Text = "Linetype Loader"
frmMessageBox.lblMessageTitle.Text = "Linetype Loading Failed!"
frmMessageBox.lblMessageBody.Text = "Ensure you are using a proper drawing and/or the existing text styles are loaded."
frmMessageBox.picIcon.Image = My.Resources.msbError
frmMessageBox.ShowDialog()
End Try
End Sub
End Class
If the line type exists it errors out. I want it to just reload it.
Solved! Go to Solution.