Comparing blocks with attributes in VBA

I want to search blocks in my drawing that have attributes. I need to compare the attributes to discover which of them are unique.I am using the following code to place the attributes of the block into an array (a variant, which has more than one dimension), and then see if the arrays are the same.However, my array comparison is a "type mismatch" according to a VBA Watch I created. When I view the arrays, they look the same to me.What amazes me about each attribute in the variant array, is that there are hundreds of sub elements. I understand a sub-element describing the font, justification, and value of the attributes. But, it goes much deeper, and seems to be caught in an endless loop. For instance; application.activdocument.activedimstyle.application.activedimstyle ...etcCould this be related to the "ambiguous reference" in the other post?Here is my code;Public Sub testAttributes()Dim varPick As VariantDim myAttribs1 As VariantDim myAttribs2 As VariantDim objEnt As AcadEntityDim objBRef As AcadBlockReference With ThisDrawing.Utility '' get first entity from user .GetEntity objEnt, varPick, vbCr & "Pick the 1st block with attributes: " '' cast it to a blockref Set objBRef = objEnt '' get the first set of attributerefs myAttribs1 = objBRef.GetAttributes '' get 2nd entity from user .GetEntity objEnt, varPick, vbCr & "Pick the 2nd block: " If Err Then Exit Sub '' cast it to a blockref Set objBRef = objEnt '' get the second set of attributerefs myAttribs2 = objBRef.GetAttributes End With If myAttribs1 = myAttribs2 ThenMsgBox "they are the same"End IfEnd Sub

Comments

  • I am afraid one of my main concerns got buried in my lengthy description.It is the endless loops that seems to be created using a standard method for accessing attributes. (well I am sure they are not endless, but do repeat several times)application.activedocument.activedimstyle (and repeat the same thing again)Aside from the repetition, why would a block refer to a dimstyle?Is this a bug in BricsCad? I am uncertain because I am not confident enough in my VBA experience.Joe Dunfee

This discussion has been closed.