PDA

View Full Version : Updating Drawing Properties thru VBA



CADdancer
2004-11-12, 06:41 PM
Hello to All At AUGI:

I am new to Visual Basic so forgive me if this is a dumb question however, is it possible to fill in or update drawing property field values automatically via a VBA routine..???

For example can the "user name", "file name", "date" and "drawing title" etc. be captured and stored and/or updated in the drawing properties fields every time the drawing is saved.??

If so can you provide some examples so I can get started in developing a routine to accomplish this task or does one exist already..?

Any assistance would be appreciated.

jwanstaett
2004-11-15, 07:21 PM
You can try this

:note this is 2002 code my not work in 2004 or 2005



Dim XR As AcadXRecord
Set XR = ThisDrawing.Dictionaries.Item("DWGPROPS")

'-------NOTE WILL EORRO IN here if
'--------------DRAWING has on DWGPROPS IN IT

XR.GetXRecordData XTYPE, XDATA 'THIS GET THE DWGPROPS
'----XDATA(1) IS TITLE
'----XDATA(2) IS SUBJECT
'----XDATA(3) IS AUTHOR
'---XDATA(4) IS COMENTS
'---XDATA(5) IS KEYWORDS
'---XDATA(6) IS LAST SAVE BY
'---XDATA(7) ????
'---XDATA(8) IS NAME1=VAULE1
'---THUR
'---XDATA(17) IS NAME10=VAULE10"
'---XDATA(19) thru DATA(21) ??????
'---XDATA(22) = NUMBER OF CUSTOM VAULE USED
'--YOU PUT CODE HERE TO CHANGE THE VAULE
'--

'--THEN
XR.SetXRecordData XTYPE, XDATA 'THIS WILL UPDATE THE DWGPROPS