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.

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:

Anonymous said...

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% ?

JTB World said...

This might work:
Dim objWSH
Dim objUserVariables
Dim objSystemVariables

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

Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner

Contact Us | About JTB World | Subscribe to this blog | JTB World's website
^ Top of page

© 2004-2009 JTB World. All rights reserved.