SetProjectFilePath メソッド(ActiveX)

AutoCAD が外部参照ファイルを検索するフォルダを設定します。

サポートされているプラットフォーム: Windows のみ

構文と要素

VBA:

object.SetProjectFilePath ProjectName, ProjectFilePath
object

タイプ: PreferencesFiles

このメソッドが適用されるオブジェクト。

ProjectName

アクセス: 入力のみ

タイプ: 文字列

プロジェクトの名前。この名前は、システム変数 PROJECTNAME でもコントロールできます。

ProjectFilePath

アクセス: 入力のみ

タイプ: 文字列

AutoCAD が外部参照ファイルを検索するフォルダ。

戻り値(RetVal)

戻り値はありません。

注意

追加の注意はありません。

VBA:

Sub Example_SetProjectFilePath()
    ' This example finds the current project file information, changes
    ' that information, and finally resets the information back to the
    ' original values.
    
    Dim preferences As AcadPreferences
    Set preferences = ThisDrawing.Application.preferences
    
    ' Get the current project file information
    Dim currProjPath As String
    Dim currProjName As Variant
    currProjName = ThisDrawing.GetVariable("PROJECTNAME")
    If currProjName <> "" Then
        currProjPath = preferences.GetProjectFilePath(currProjName)
    End If
    If currProjPath = "" Then
        MsgBox "There is no current project file or path. ", , "SetProjectFilePath Example"
    Else
        MsgBox "The current project file path is: " & currProjPath, , "SetProjectFilePath Example"
        ' Set new project file information.
        ' Change drive/path as necessary to match your system
        Dim newProjPath As String
        newProjPath = "C:/AutoCAD/"
        
        preferences.SetProjectFilePath currProjName, newProjPath
        MsgBox "The new project file path is: " & newProjPath, , "GetProjectFilePath Example"
        
        ' Reset the project file information
        preferences.SetProjectFilePath currProjName, currProjPath
        MsgBox "The project file path has been reset to: " & currProjPath, , "GetProjectFilePath Example"
    End If
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SetProjectFilePath()
    ;; This example finds the current project file information, changes
    ;; that information, and finally resets the information back to the
    ;; original values.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    (setq preferences (vla-get-Preferences acadObj))

    ;; Get the current project file information
    (setq currProjName (vlax-variant-value (vla-GetVariable doc "PROJECTNAME")))
    (if (/= currProjName "")
        (setq currProjPath (vla-GetProjectFilePath (vla-get-Files preferences) currProjName))
        (setq currProjPath "")
    )
    (if (= currProjPath "")
        (alert "There is no current project file or path. ")
        (progn
	           (alert (strcat "The current project file path is: " currProjPath))

            ;; Set new project file information.
            ;; Change drive/path as necessary to match your system
            (setq newProjPath "C:/AutoCAD/")

            (vla-SetProjectFilePath (vla-get-Files preferences) currProjName newProjPath)
            (alert (strcat "The new project file path is: " newProjPath))

            ;; Reset the project file information
            (vla-SetProjectFilePath (vla-get-Files preferences) currProjName currProjPath)
            (alert (strcat "The project file path has been reset to: " currProjPath))
        )
    )
)