CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2020 开发者帮助

GetProjectFilePath 方法 (ActiveX)

2024-5-18 18:20| 发布者: admin| 查看: 72| 评论: 0|原作者: admin|来自: AutoCAD

GetProjectFilePath 方法 (ActiveX)

获取 AutoCAD 在其中查找外部参照文件的目录。

支持的平台:仅限 Windows

签名

VBA:

RetVal = object.GetProjectFilePath(ProjectName)
对象

类型:PreferencesFiles

此方法应用到的对象。

项目名称

访问:仅输入

类型:字符串

项目的名称。此名称也由 PROJECTNAME 系统变量控制。

返回值 (RetVal)

类型:字符串

AutoCAD 在其中查找外部参考文件的目录。

言论

没有其他评论。

例子

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

可视化 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.")
    )
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1   苏公网安备32011402011833)

GMT+8, 2024-12-15 13:11

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部