Big Duh indeed T man! What was the other poster, or is that poser, thinking
:-) Thanks for the simplified answer.
--
Bobby C. Jones
www.AcadX.com
"Tony Tanzillo" wrote in message
news:3fe07ab5$1_2@statler...
> Just for the record, This is not a "two step process",
> and you don't need to worry about 'nested' blocks or
> application of 'recursive' concepts, because you're
> going to process *all* objects in the drawing, except
> for those in layouts.
>
> In fact, the "recursive approach" posted in another
> reply, will needlessly process the same block multiple
> times, when insertions of it appear in more than one
> parent block. Duh!
>
> This Sub will process every block, including layouts,
> but will not change the color of entities that are
> directly owned by layouts:
>
> Public Sub ProcessBlock(Block As AcadBlock)
> Dim IsNested As Boolean
> IsNested = not Block.IsLayout
> Dim Entity As AcadEntity
> ForEach Entity in Block
> If IsNested then
> Entity.Color = acByLayer
> End If
> if TypeOf Entity is AcadBlockReference then
> Dim BlockRef As AcadBlockReference
> Set BlockRef = Entity
> If BlockRef.HasAttributes then
> Dim AttRef As AcadAttributeReference
> Dim Attributes As Variant
> Attributes = BlockRef.GetAttributes
> Dim i As Integer
> For i = LBound(Attributes) to UBound(Attributes)
> Set AttRef = Attributes(i)
> AttRef.Color = acByLayer
> Next i
> End If
> End If
> Next Entity
> End Sub
>
> With the above, you just need this:
>
> Public Sub ProcessDrawing
> Dim ABlock As AcadBlock
> ForEach ABlock in ThisDrawing.Blocks
> If not ABlock.IsXref then
> ProcessBlock ABlock
> End if
> Next Block
> End Sub
>
> --
> AcadXTabs: MDI Document Tabs for AutoCAD
> http://www.acadxtabs.com
>
>
> "JMongi5967" wrote in message
news:9922485.1071541144387.JavaMail.jive@jiveforum1.autodesk.com...
> > I am new to AutoCAD VBA, I was wondering if anyone could help me. I am
trying to write a Procedure that will loop
> through all the blocks, included nested blocks, in a drawing and change it
objects, include attribute tags, to the color
> ByLayer. I am running AutoCAD 2000i Any help would be appreciated.
> >
> > Thanks,
> > Joe
>
>