Imports Autodesk.AutoCAD.Runtime
Imports System.Reflection
Imports Autodesk.AutoCAD.EditorInput
Public Class test
<CommandMethod("AddSupportPath")> _
Public Shared Sub AddSupportPath()
Dim acadObject As Object = Application.AcadApplication
Dim preferences As Object = acadObject.[GetType]().InvokeMember("Preferences", BindingFlags.GetProperty, Nothing, acadObject, Nothing)
'get the files
Dim files As Object = preferences.[GetType]().InvokeMember("Files", BindingFlags.GetProperty, Nothing, preferences, Nothing)
'get the support path SupportPath
Dim supportPath As String = CType(files.[GetType]().InvokeMember("SupportPath", BindingFlags.GetProperty, Nothing, files, Nothing), String)
Dim doc As Document = Application.DocumentManager.MdiActiveDocument
Dim ed As Editor = doc.Editor
If Not supportPath.Contains("C:\BatchPublish") Then
supportPath = supportPath + ";" + "C:\BatchPublish"
Dim dataArry As Object() = New Object(0) {}
dataArry(0) = supportPath
files.[GetType]().InvokeMember("SupportPath", BindingFlags.SetProperty, Nothing, files, dataArry)
ed.WriteMessage(supportPath + vbLf)
Else
ed.WriteMessage("Support path already present" & vbLf)
End If
End Sub
End Class
http://adndevblog.typepad.com/autocad/2012/05/ ... upport-path-through-net.html
[本日志由 tiancao1001 于 2018-09-17 05:37 PM 编辑]
|
暂时没有评论
发表评论 - 不要忘了输入验证码哦! |