Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

vba autocad get attributes of a block without opened it

Status
Not open for further replies.

321sh

Electrical
Oct 6, 2004
2
Is it possible to retrieve autocad attributes of an existing block in a known repertory without open it as a drawing, change the attributes(tag,value, prompt, etc...), update the block, save it in a new repertory
 
Replies continue below

Recommended for you

You have two options; you can open the drawing in the current autocad session which is usually the fastest choice
and disable autocad updating the interface. So it looks like it just stopped for a moment. Then after you get your values, reactivate the autocad window. Or you can open up another copy of autocad and get the information from that copy. Altho this takes a lot more time. But you could do this upon loading autocad and just store the variables as a global variable; ready to be used.

Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long

function GetValues ()
LockWindowUpdate (ThisDrawing.hwnd)

' do some secret stuff
' Open a drawing get the attribute value and then close the drawing.

LockWindowUpdate (0)

end function

' or


Sub OpenNewAcad()
Dim Acad As AcadApplication
Dim AcadDwg As AcadDocument
Set Acad = CreateObject("AutoCAD.Application")
Set AcadDwg = Acad.Application.Documents.Open("c:\filename.dwg")
' do stuff
' get values
Acad.Documents.Close
Acad.Quit
Set Acad = Nothing
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor