jinyongjun 发表于 2005-2-20 19:48:00

如何把.PAT文件所属的文件路径用VBA程序自动添加到AUTOCAD的支持文件搜索路径中.

如何把.PAT文件所属的文件路径用VBA程序自动添加到的支持文件搜索路径中.即我把.PAT文件保存在 "E:\工程项目\SUPPORT\" 文件夹中,如何用VBA语言编程自动添加到AUTOCAD2002 >TOOLS>OPTIONS>SUPPORT FILE SERACH PATH 中.

mccad 发表于 2005-2-20 22:03:00

.SupportPath

jinyongjun 发表于 2005-2-21 17:35:00

能否写具体点,谢谢

clement 发表于 2005-2-21 19:19:00

Sub Example_SupportPath()
                       ' This example returns the current setting of
                       ' SupportPath. It then changes the value, and finally
                       ' it resets the value back to the original setting.
                       
                       Dim preferences As AcadPreferences
                       Dim currSupportPath As String
                       Dim newSupportPath As String
                       
                       Set preferences = ThisDrawing.Application.preferences
                       
                       ' Retrieve the current SupportPath value
                       currSupportPath = preferences.Files.SupportPath
                       MsgBox "The current value for SupportPath is " & currSupportPath, vbInformation, "SupportPath Example"
                       
                       ' Change the value for SupportPath
                       newSupportPath = "TestSupportPath"
                       preferences.Files.SupportPath = newSupportPath
                       MsgBox "The new value for SupportPath is " & newSupportPath, vbInformation, "SupportPath Example"
                       
                       ' Reset SupportPath to its original value
                       preferences.Files.SupportPath = currSupportPath
                       MsgBox "The SupportPath value is reset to " & currSupportPath, vbInformation, "SupportPath Example"
End Sub

wyj7485 发表于 2005-2-22 11:03:00

Sub AddSupportPath(ByVal Path As String)
Dim curSupportPath As Variant
Dim i As Integer
Dim Support As Boolean
Support = False
curSupportPath = Split(ThisDrawing.Application.preferences.Files, ";")
For i = 0 To UBound(curSupportPath)
                       If StrConv(curSupportPath(i), vbUpperCase) = StrConv(Path, vbUpperCase) Then
                                                       Support = True
                                                       Exit For
                       End If
Next
If Not Support Then
               ThisDrawing.Application.preferences.Files = ThisDrawing.Application.preferences.Files & ";" & Path
End If
End Sub
       
Sub test()
AddSupportPath "d:\test"
End Sub

tanglianyu 发表于 2012-2-8 18:25:00

楼上讲的是inventor吗?
页: [1]
查看完整版本: 如何把.PAT文件所属的文件路径用VBA程序自动添加到AUTOCAD的支持文件搜索路径中.