Matersammichman 发表于 2006-7-17 09:29:30

支持文件搜索路径

可以使用vba来定义新的支持文件搜索路径吗?
**** Hidden Message *****

Matersammichman 发表于 2006-7-17 09:53:11

是的,你想干什么?

Matersammichman 发表于 2006-7-17 09:56:34

这就是我如何确保这些驱动器在路径中的方法。
Public Sub ACADStartup()
    Set AutoCAD = Application
    Dim strUSER As String
    Dim supppath As String
    supppath = UCase(ThisDrawing.Application.Preferences.Files.SupportPath)
    'This will prevent you entering the same entry more than once
    If InStr(1, supppath, "U:\TITLEBLOCKS") > 1 Then
    GoTo Nextline
    Else
    ThisDrawing.Application.Preferences.Files.SupportPath = supppath & ";" & "U:\TITLEBLOCKS"
    End If
Nextline:
    If InStr(1, supppath, "U:\symbols") > 1 Then
    GoTo Lastline
    Else
    ThisDrawing.Application.Preferences.Files.SupportPath = supppath & ";" & "U:\symbols"
    End If
Lastline:
    If InStr(1, supppath, "U:\PROJECTLOGS") > 1 Then
    Exit Sub
    Else
    ThisDrawing.Application.Preferences.Files.SupportPath = supppath & ";" & "U:\PROJECTLOGS"
    End If
    Exit Sub
End Sub

Jeff_M 发表于 2006-7-17 10:02:49

我想使用VBA插入一个dwg,但是如果它不在定义的路径中,vba会阻塞,因为它找不到块,所以我需要能够定义新路径。

Matersammichman 发表于 2006-7-17 10:12:36

使用上述方法,您应该可以添加您的路径。如果您需要帮助,请告诉我

Matersammichman 发表于 2006-7-17 11:04:34

让它工作,谢谢。

Matersammichman 发表于 2006-7-17 11:48:14

您使用的是什么版本?我看到有报道称,在2007年,InsertBlock现在需要一个完全限定的路径名。因此,仅仅确保支持路径指向您的块不起作用……请注意,我没有亲自测试过这一点。(self注意,今天晚些时候进行测试)

Jeff_M 发表于 2006-7-18 07:29:13

2005 adt

Matersammichman 发表于 2006-7-18 09:45:14

JM,我这边没有确认,但我昨天在插入块时遇到了问题。我今天必须调查一下。
页: [1]
查看完整版本: 支持文件搜索路径