harilalmn Posted January 11, 2011 Posted January 11, 2011 I have created a vba macro to edit attributes in Blocks. I tried so many times but it doesn't update the attributes in drawing, unless I manually do a BATTMAN... What is wrong? Quote
SEANT Posted January 11, 2011 Posted January 11, 2011 I think this situation is typically addressed by calling ATTSYNC via ThisDrawing.SendCommand. As distasteful as it may be to use SendCommand, it works fairly well if the call is made at the end of the routine. The other, more laborious option would be to interrogate all the attributes, store the information, delete then recreate everything from scratch. This should allow the expected performance out of the .Update method. Quote
BIGAL Posted January 12, 2011 Posted January 12, 2011 maybe this will help Set SS = ThisDrawing.SelectionSets.Add("issued") SS.Select acSelectionSetAll, , , FilterDXFCode, FilterDXFVal For Cntr = 0 To SS.Count - 1 attribs = SS.Item(Cntr).GetAttributes attribs(0).TextString = "ISSUED FOR CONSTRUCTION" attribs(3).TextString = "0" attribs(0).Update attribs(3).Update Next Cntr Quote
harilalmn Posted January 12, 2011 Author Posted January 12, 2011 BIGAL and SEANT, Thanks a lot for your replies... I had some error coming up regarding FilterDXFCode. However, ATTSYNC worked for me. Thanks both of you... Quote
BIGAL Posted January 13, 2011 Posted January 13, 2011 Yeah left this stuff out which you will need Dim FilterDXFCode(1) As Integer Dim FilterDXFVal(1) As Variant Dim attribs As Variant Dim BLOCK_NAME As String On Error Resume Next FilterDXFCode(0) = 0 FilterDXFVal(0) = "INSERT" FilterDXFCode(1) = 2 FilterDXFVal(1) = "DA1DRTXT" BLOCK_NAME = "DA1DRTXT" Quote
SEANT Posted January 13, 2011 Posted January 13, 2011 This thread prompted me to look back at some old VBA code and see that I had missed the Attribute.Update method. The code is pretty old, though (circa AutoCAD 2000) which may have had other issues. It’s too bad that I find out about it now, when I’ve abandoned any new VBA coding. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.