Modify the Attributes values with VBA or insert a block with attributes in AutoCAD

 ;;;;;;;;;;;;;;;;;;;;  Description ;;;;;;;;;;;;;;;;;
Here under an implementation of GetAttributes method in order to :
- Modify the Attributes values with VBA
- Insert a block with attributes in AutoCAD

.TagString = attribute name
.TextString = attribute value
varAttributes(0) -> first attribute defined in the block
varAttributes(1) -> second attribute defined in the block

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Dim blockRefObj2 As AcadBlockReference
    insertionPnt(0) = Range("F19")
    insertionPnt(1) = Range("F20")
    insertionPnt(2) = 0
    Set blockRefObj2 = AcadDoc.ModelSpace.InsertBlock _
               (insertionPnt, "MANHOLE", 1#, 1#, 1#, 0)
   
    Dim varAttributes As Variant
    varAttributes = blockRefObj2.GetAttributes
    varAttributes(0).TextString = "200"
    varAttributes(1).TextString = "20"

No comments:

Post a Comment