GetProjectFilePath Method (ActiveX)

Gets the directory in which AutoCAD looks for external reference files.

Supported platforms: Windows only

Signature

VBA:

RetVal = object.GetProjectFilePath(ProjectName)
object

Type: PreferencesFiles

The object this method applies to.

ProjectName

Access: Input-only

Type: String

The name of the project. This name is also controlled by the PROJECTNAME system variable.

Return Value (RetVal)

Type: String

The directory in which AutoCAD looks for external reference files.

Remarks

No additional remarks.

Examples

VBA:

Sub Example_GetProjectFilePath()
    ' This example finds the current project file information.
    
    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.Files.GetProjectFilePath(currProjName)
    End If
    If currProjPath = "" Then
        MsgBox "There is no current project file or path. ", , "GetProjectFilePath Example"
    Else
        MsgBox "The current project file path is: " & currProjPath, , "GetProjectFilePath Example"
    End If
        
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetProjectFilePath()
    ;; This example finds the current project file information.
    (setq acadObj (vlax-get-acad-object))
    (setq preferences (vla-get-Preferences acadObj))

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