How I can modify from VBA to a attibute in a nested block

How I can modify from VBA to a attibute in a nested block

Anonymous
Not applicable
447 Views
5 Replies
Message 1 of 6

How I can modify from VBA to a attibute in a nested block

Anonymous
Not applicable
Hi
Does anyone know how to modify attributes in a nested block.

Thanks

Luis
0 Likes
448 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
wrote in message news:5543140@discussion.autodesk.com...
>Hi
>Does anyone know how to modify attributes in a nested block.
>Thanks
>Luis

Hi Luis,
What exactly are you trying to do?
What have you tried so far? (show code)
What errors / problems are you having?
Strictly speaking there's no such thing as a nested block
To modify an attribute in any block, you just modify the block definition
for that block in the Blocks Collection

I suspect you're really asking how to modify an attribute reference in a
nested block reference but that's just a guess....
:-)

to get at any object in any block, iterate the block till you come to the
object you want to modify(in this case I think you're looking for a block
reference)
For Each oEnt in oBlk
If TypeOf oEnt Is AcadBlockReference Then
If oEnt.Name = OneYouLookingFor Then
vAtts = oEnt.GetAttributes
...now you have the attribute references you can mess with
them as you like
...etc

hth
Mark
0 Likes
Message 3 of 6

Anonymous
Not applicable
Hi Mark
I want to modify attribute which are in inserted block.

Regards

Luis
0 Likes
Message 4 of 6

Anonymous
Not applicable
so what did you try, and did it work?
mark
:-)

wrote in message news:5548822@discussion.autodesk.com...
Hi Mark
I want to modify attribute which are in inserted block.

Regards

Luis
0 Likes
Message 5 of 6

Anonymous
Not applicable
Hi Mark
This is what I did so far. I have to explode the block in other to access the attributes.

Regards
Luis
0 Likes
Message 6 of 6

Anonymous
Not applicable
easier to just paste your code here, rather than attach a .doc file
it is not necessary to explode your block to read it's contents

Sub AttExtract()

Dim elem As AcadEntity

Dim Array1 As Variant

Dim entidad As AcadEntity

Dim oBlkRef as AcadBlockReference

Dim oAtt as AcadAttributeReference

Dim iAtt as integer



For Each elem In ThisDrawing.ModelSpace

if TypeOf elem Is AcadBlockReference Then

'you might want to check name also if you just want certain blocks

if elem.Name = FindThisBlockName Then

Set oBlkRef = elem

If oBlkRef.HasAttributes Then

Array1 = oBlkRef.GetAttributes

'**** get the appropiates Array (XY) information that you
need

For iAtt = 0 to Ubound(array1)

Set oAtt = array1(iAtt)

Debug.Print oAtt.Tagstring , oAtt.Textstring

Next iAtt

End If

End if

End if

Next elem

End Sub


hth Mark

wrote in message news:5558937@discussion.autodesk.com...
Hi Mark
This is what I did so far. I have to explode the block in other to
access the attributes.

Regards
Luis
0 Likes