https://www.keanw.com/2010/03/loading-mult ... to-autocad-using-net.html
程序代码: |
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.Runtime
Namespace LoadLinetypes
Public Class Commands
<CommandMethod("LL")> _
Public Sub LoadLinetypes()
Dim doc As Document = Application.DocumentManager.MdiActiveDocument
Dim db As Database = doc.Database
Dim ed As Editor = doc.Editor
Const filename As String = "acad.lin"
Try
Dim path As String = HostApplicationServices.Current.FindFile(filename, db, FindFileHint.[Default])
db.LoadLineTypeFile("*", path)
Catch ex As Autodesk.AutoCAD.Runtime.Exception
If ex.ErrorStatus = ErrorStatus.FilerError Then
ed.WriteMessage(vbLf & "Could not find file ""{0}"".", filename)
ElseIf ex.ErrorStatus = ErrorStatus.DuplicateRecordName Then
ed.WriteMessage(vbLf & "Cannot load already defined linetypes.")
Else
ed.WriteMessage(vbLf & "Exception: {0}", ex.Message)
End If
End Try
End Sub
End Class
End Namespace
[本日志由 tiancao1001 于 2019-12-09 10:17 PM 编辑]
|
暂时没有评论
发表评论 - 不要忘了输入验证码哦! |