Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

Acad Attribute References

Status
Not open for further replies.

mochamoo

Technical User
Mar 8, 2005
8
US
I have created a block with 2 attribute references attached to it(pipe size and pipe length). I then run a macro that inserts this block in my drawing on every peice of pipe. Now I am trying to create a macro that allows the user to select one or more of these blocks and edit the size attribute.
To do this I am creating a selection set. My question is how to change the attribute. The user can select the block, but I do not know how to access the attribute of that block. I am aware that the selection set gives me a pointer to that block, but can I access the attribute associated with that block from this pointer.
If you have any trouble understanding my problem I could post some snippets of code.

Thanks for your help,
James
 
Hi James,

Try this:

Code:
Dim blkRef as AcadBlockReference
Dim varArray as Variant
Dim intCnt as Integer
Dim objSSet as AcadSelectionSet

...
...

For Each blkRef in objSSet
  If blkRef.HasAttributes Then
    varArray = blkRef.GetAttributes
    For intCnt = LBound(varArray) to UBound(varArray)
      Debug.Print varArray(intCnt).TagString & " = " & varArray(intCnt).TextString
    Next intCnt
  End If
Next blkRef

HTH
Todd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top