Wednesday, August 20, 2008

AutoCAD Architecture PSD showing the drawing name

There was a question in the AutoCAD Architecture discussion group.

“How can i get dwgname of open drawing  in this drawing in  property set per vbscript code?”

Here is how it can be done. I use ACA 2009 but it should work with older versions too. Formula Property Definition below:

On Error Resume Next
Set app = GetObject(, "AutoCAD.Application")
RESULT=app.ActiveDocument.Name

If the full path and name needs to be use just change ActiveDocument.Name to ActiveDocument.FullName.

2 comments:

  1. Is there any way to get it to report the correct file name through an xref? I need to have a schedule in a different file display the name of the drawing that the duct/pipe/whatever lives in. Is there a way to use VB to call a Windows variable like %FILE% or %USERNAME% ?

    ReplyDelete
  2. This might work:
    Dim objWSH
    Dim objUserVariables
    Dim objSystemVariables

    Set objWSH = CreateObject("WScript.Shell")
    Set objUserVariables = objWSH.Environment("USER")
    RESULT=objUserVariables("USERNAME")

    ReplyDelete

Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner