Change all the attributes color

Change all the attributes color

mohandis2
Advocate Advocate
735 Views
3 Replies
Message 1 of 4

Change all the attributes color

mohandis2
Advocate
Advocate

My drawing has blocks nested into blacks nested into blacks nested into blacks and so on, and every block may or may not have attributes, how can I change all the attributes color? Any help please?

0 Likes
736 Views
3 Replies
Replies (3)
Message 2 of 4

truss_85
Advocate
Advocate

You mean inside the vba or outside ?

0 Likes
Message 3 of 4

mohandis2
Advocate
Advocate
In vba,
0 Likes
Message 4 of 4

truss_85
Advocate
Advocate

Here it is what you want:

 

Public Sub block_nest()

Dim objBlock As AcadBlockReference
Dim objBlock_objEnt As AcadBlockReference
Dim objBlk As AcadBlock
Dim objBlkRef As AcadBlockReference
Dim objEnt As AcadEntity

Dim var_atts As Variant

For Each objBlk In ThisDrawing.Blocks
    For Each objEnt In objBlk
        If TypeOf objEnt Is AcadBlockReference Then
            Set objBlock_objEnt = objEnt
            var_atts = objBlock_objEnt.GetAttributes
            For j = 0 To UBound(var_atts)
                var_atts(j).color = acRed
            Next
        End If
    Next
Next

End Sub