<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Change height attribute definition in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13263997#M150</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just generated this code and I think it works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Sub Main()
   Dim elem As Object
    Dim block As AcadBlock
    Dim item As Object
    Dim Array1 As Variant
    Dim count As Integer
    Dim MBtest1 As String
    Dim str As String
    
    For Each elem In ThisDrawing.ModelSpace
        If elem.EntityName = "AcDbBlockReference" Then
            If elem.HasAttributes Then
                Array1 = elem.GetAttributes
                    str = elem.Name
                    Set block = ThisDrawing.Blocks.item(str)
                    For Each item In block
                        str = item.EntityName
                       If item.EntityName = "AcDbAttributeDefinition" Then
                          item.Height = 1.5
                                
                         
                        End If
                    Next item
            End If
        End If
    Next

End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jan 2025 08:34:51 GMT</pubDate>
    <dc:creator>jplujan</dc:creator>
    <dc:date>2025-01-16T08:34:51Z</dc:date>
    <item>
      <title>Change height attribute definition</title>
      <link>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13261921#M144</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a drawing with hundreds of blocks with the same attribute names and I would like to change the height of these attributes in all blocks globally.&lt;/P&gt;&lt;P&gt;The code attached on the screen changes the height, but when I edit a block it returns to the previous height.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt; Sub ChangeHeightAttr()
    Dim nombreSeleccion As String
    Dim Seleccion As AcadSelectionSet
    Dim ListaAtr As Variant
    Dim item As Variant
    Dim i As Variant
  
    Set Seleccion = ThisDrawing.SelectionSets.Add("Sleccion1")
    Seleccion.SelectOnScreen
    For Each item In Seleccion
             If item.HasAttributes Then
                 ListaAtr = item.GetAttributes()
                 For i = LBound(ListaAtr) To UBound(ListaAtr)
                     ListaAtr(i).Height = 5
                     ListaAtr(i).Update
                 Next
         End If
     Next
         
End sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much in advance&lt;BR /&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 15:16:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13261921#M144</guid>
      <dc:creator>jplujan</dc:creator>
      <dc:date>2025-01-15T15:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: Change height attribute definition</title>
      <link>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13262546#M145</link>
      <description>&lt;P&gt;It seems that you may need to fully understand the relationships between block definition/block reference and attribute definition/attribute reference, especially the latter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Relationship between Attribute definition (AcadAttribute) and attribute reference (AcadAttributeReference) is different from that of between AcadBlock and AcadBlockReference. AcadAttribute is only used as template when a block reference's AcadAttributeReference is created. So, changes to AcadAttribute would not affact any existing AcadAttributeReferences and vice versa.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Your code changes AcadAttributeReference's height, not AcadAttribute inside the block definition, which is what you see in the Block Editor that the attribute high is not changed. If you change attribute's height in the block editor, it is the AcadAttribute in the block definition being changed, which would not change any AcadAttributeReference in all the existing block references.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your case, what you need to do is to use the block editor to change the AcadAttribute's height as needed and then run command from Express Tool "AttSync", which would reset the existing AcadAttributeReferences with updated AcadAttribute as template (thus, all the AcadAttributeReferences you see with the existing block reference get changes). Of course, if you wish, you can code your own "AttSync" command to achieve the same goal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 16:24:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13262546#M145</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2025-01-15T16:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: Change height attribute definition</title>
      <link>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13263438#M146</link>
      <description>&lt;P&gt;try this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Sub Main()

Dim blockRef As AcadBlockReference
Dim attrib As Variant
Dim entity As acadEntity

For Each entity In ThisDrawing.ModelSpace

    If TypeOf entity Is AcadBlockReference Then

        Set blockRef = entity

        For Each attrib In blockRef.GetAttributes
    
            If attrib.TagString = "YOUR ATTRIBUTE NAME" Then
                attrib.TextString = "sfsdf"
                attrib.ScaleFactor = 0.8
                attrib.Height = 5
            End If

        Next attrib

    End If

Next entity

ThisDrawing.Regen (acActiveViewport)

End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 00:17:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13263438#M146</guid>
      <dc:creator>tim11_manhhieu</dc:creator>
      <dc:date>2025-01-16T00:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: Change height attribute definition</title>
      <link>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13263910#M147</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;Thank you both for your time.&lt;BR /&gt;I have tried tim11_manhhieu&amp;nbsp;code and the same thing happens to me, I can't get it to change in the block definition. According to what Normando Yuan explained, I'm afraid the solution is to create my own "AttSync", which I really don't know how to access the entity's Acadatribute.&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 07:42:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13263910#M147</guid>
      <dc:creator>jplujan</dc:creator>
      <dc:date>2025-01-16T07:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: Change height attribute definition</title>
      <link>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13263978#M148</link>
      <description>&lt;P&gt;can you share the DWG file?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 08:20:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13263978#M148</guid>
      <dc:creator>tim11_manhhieu</dc:creator>
      <dc:date>2025-01-16T08:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: Change height attribute definition</title>
      <link>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13263989#M149</link>
      <description>&lt;P&gt;Here is the file, I want to change all the attributes to a different height&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 08:28:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13263989#M149</guid>
      <dc:creator>jplujan</dc:creator>
      <dc:date>2025-01-16T08:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: Change height attribute definition</title>
      <link>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13263997#M150</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just generated this code and I think it works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Sub Main()
   Dim elem As Object
    Dim block As AcadBlock
    Dim item As Object
    Dim Array1 As Variant
    Dim count As Integer
    Dim MBtest1 As String
    Dim str As String
    
    For Each elem In ThisDrawing.ModelSpace
        If elem.EntityName = "AcDbBlockReference" Then
            If elem.HasAttributes Then
                Array1 = elem.GetAttributes
                    str = elem.Name
                    Set block = ThisDrawing.Blocks.item(str)
                    For Each item In block
                        str = item.EntityName
                       If item.EntityName = "AcDbAttributeDefinition" Then
                          item.Height = 1.5
                                
                         
                        End If
                    Next item
            End If
        End If
    Next

End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 08:34:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13263997#M150</guid>
      <dc:creator>jplujan</dc:creator>
      <dc:date>2025-01-16T08:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: Change height attribute definition</title>
      <link>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13266150#M151</link>
      <description>&lt;P&gt;The request at the beginning of the post, as I understand it, is to change the height of attribute A in block A, attribute A in block B, attribute A in block C...&lt;/P&gt;&lt;P&gt;If you want change height all attribute in all block, the code more easier.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tim11_manhhieu_0-1737072920588.png" style="width: 300px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1455880i7EA6D03A293CC8F7/image-dimensions/300x254?v=v2" width="300" height="254" role="button" title="tim11_manhhieu_0-1737072920588.png" alt="tim11_manhhieu_0-1737072920588.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Sub Main()

Dim blockRef As AcadBlockReference
Dim attrib As Variant
Dim entity As acadEntity

For Each entity In ThisDrawing.ModelSpace

    If TypeOf entity Is AcadBlockReference Then

        Set blockRef = entity

        For Each attrib In blockRef.GetAttributes   
                attrib.Height = 1.5
        Next attrib

    End If

Next entity

ThisDrawing.Regen (acActiveViewport)

End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2025 00:15:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13266150#M151</guid>
      <dc:creator>tim11_manhhieu</dc:creator>
      <dc:date>2025-01-17T00:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: Change height attribute definition</title>
      <link>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13266546#M152</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;The idea is to change the height of the attributes in the block definition.&lt;/P&gt;&lt;P&gt;Thank you very much for your code.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2025 06:52:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13266546#M152</guid>
      <dc:creator>jplujan</dc:creator>
      <dc:date>2025-01-17T06:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: Change height attribute definition</title>
      <link>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13267871#M153</link>
      <description>&lt;P&gt;If the goal is only change the attribute's Height in the block definition, then you do not need to loop through the ModelSpace/PaperSpace for each AcadBlockReference, especially, if there are many block references that are from the same block definition: your code modify the same block definition multiple times again and again with the same change.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can simply loop through AcadBlocks collection:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dim blk as AcadBlock&lt;/P&gt;
&lt;P&gt;Dim ent As AcadEntity&lt;/P&gt;
&lt;P&gt;Dim att As AcadAttribute&lt;/P&gt;
&lt;P&gt;For Each blk in ThisDrawingBlock&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;'' You may also test block name to narrow the loop here&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;For Each ent in blk&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;If TypeOf ent Is AcadAttribute Then&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Set att = Ent&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;att.Height=10.0&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;Next&lt;/P&gt;
&lt;P&gt;Next&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This way, each block definition is only modified once.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course, you do realize that all the attributes (AcadAttributeReferences) of existing block references (you said there could hundreds of then) remain unchanged with their Height, unless you run "ATTSYNC" command (or you have other code to also change AcadReferences' Height).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2025 17:17:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13267871#M153</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2025-01-17T17:17:00Z</dc:date>
    </item>
    <item>
      <title>Re: Change height attribute definition</title>
      <link>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13270840#M154</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;Thank you for your dedication&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2025 06:50:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/change-height-attribute-definition/m-p/13270840#M154</guid>
      <dc:creator>jplujan</dc:creator>
      <dc:date>2025-01-20T06:50:02Z</dc:date>
    </item>
  </channel>
</rss>

