VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change all the attributes color

3 REPLIES 3
Reply
Message 1 of 4
mohandis2
576 Views, 3 Replies

Change all the attributes color

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?

3 REPLIES 3
Message 2 of 4
truss_85
in reply to: mohandis2

You mean inside the vba or outside ?

Message 3 of 4
mohandis2
in reply to: mohandis2

In vba,
Message 4 of 4
truss_85
in reply to: mohandis2

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

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost