明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2315|回复: 5

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

[复制链接]
发表于 2005-2-20 19:48:00 | 显示全部楼层 |阅读模式
如何把.PAT文件所属的文件路径用VBA程序自动添加到AutoCAD的支持文件搜索路径中.即我把.PAT文件保存在 "E:\工程项目\SUPPORT\" 文件夹中,如何用VBA语言编程自动添加到AUTOCAD2002 >TOOLS>OPTIONS>SUPPORT FILE SERACH PATH 中.
发表于 2005-2-20 22:03:00 | 显示全部楼层
 楼主| 发表于 2005-2-21 17:35:00 | 显示全部楼层
能否写具体点,谢谢
发表于 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
发表于 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
发表于 2012-2-8 18:25:15 | 显示全部楼层
楼上讲的是inventor吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-25 16:45 , Processed in 0.159854 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表