<?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: Insert number into an array of blocks in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10927518#M2676</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/543921"&gt;@norman.yuan&lt;/a&gt;, actually I don't need the associative array, I understand the step given by you, but I don't know how to convert it into VBA coding, I'm new and still learning about VBA.&lt;/P&gt;</description>
    <pubDate>Fri, 04 Feb 2022 00:52:52 GMT</pubDate>
    <dc:creator>zka192020</dc:creator>
    <dc:date>2022-02-04T00:52:52Z</dc:date>
    <item>
      <title>Insert number into an array of blocks</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10925629#M2671</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way that I could do coding in VBA to insert automatic numbers inside an array of blocks?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="zka192020_0-1643885694525.png" style="width: 451px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1020187i58CA372E1198BE75/image-dimensions/451x109?v=v2" width="451" height="109" role="button" title="zka192020_0-1643885694525.png" alt="zka192020_0-1643885694525.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If you can see above, I'm manually putting text to indicate the number, I want that if I select the array it will be automatically numbered. can anyone help me how to do it in VBA, please take note that I'm new to this VBA, I'm eager to learn about it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 11:00:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10925629#M2671</guid>
      <dc:creator>zka192020</dc:creator>
      <dc:date>2022-02-03T11:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: Insert number into an array of blocks</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10925910#M2672</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12001896"&gt;@zka192020&lt;/a&gt;&amp;nbsp;I guess tha the best could be create a block attribute, as alternative you can retrive the block insertion point and place text with properties you wish.&lt;/P&gt;&lt;P&gt;I'll try to create sample and share with you.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 13:23:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10925910#M2672</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2022-02-03T13:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: Insert number into an array of blocks</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10926875#M2673</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12001896"&gt;@zka192020&lt;/a&gt;&amp;nbsp;I downloaded your file but seems that the block are associated in associative array, in this way I guess my idea will be not applicable, but I'm trying.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 18:56:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10926875#M2673</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2022-02-03T18:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: Insert number into an array of blocks</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10927279#M2674</link>
      <description>&lt;P&gt;Firstly, as&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/472256"&gt;@grobnik&lt;/a&gt;&amp;nbsp;pointed out: it would be much better for the block to have an attribute defined and use the attribute to show the number of each individual block.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now that&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/472256"&gt;@grobnik&lt;/a&gt;&amp;nbsp;has found out the individual block references are created as associative array, then there is no direct way to update the attribute of each individual block in the associative array.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are possible ways to do it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Explode the associative array, so you get all the individual block references line up in its original location. Then, you find all the individual block references and based on their location (insertion point - say, from left to right) to determine the number and update the attribute, or draw a text at center of each individual block reference.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. You can try to find the size (BoundingBox) of the individual block reference, and calculate the center of each individual block reference based on the boundingbox (a big rectangle) of the associative array. In your case, it is simply evenly dividing the array's boundingbox into small rectangle. Then drawing a text for the number at the center of each individual block reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Feb 2022 21:56:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10927279#M2674</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2022-02-03T21:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Insert number into an array of blocks</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10927514#M2675</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/472256"&gt;@grobnik&lt;/a&gt;, actually I don't need the associative array, it just when I array it automatically turn on the associative array. Normal array would do for me. Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Feb 2022 00:48:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10927514#M2675</guid>
      <dc:creator>zka192020</dc:creator>
      <dc:date>2022-02-04T00:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: Insert number into an array of blocks</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10927518#M2676</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/543921"&gt;@norman.yuan&lt;/a&gt;, actually I don't need the associative array, I understand the step given by you, but I don't know how to convert it into VBA coding, I'm new and still learning about VBA.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Feb 2022 00:52:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10927518#M2676</guid>
      <dc:creator>zka192020</dc:creator>
      <dc:date>2022-02-04T00:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: Insert number into an array of blocks</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10930908#M2677</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12001896"&gt;@zka192020&lt;/a&gt;&amp;nbsp;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;here below a sample code for inserting a number "over" the block, with "over" I mean that it's untied with block, like as attribute could be.&lt;/P&gt;&lt;P&gt;Before execute the code you have to explode your associative array, and in case you create a new one, please not set it as associative.&lt;/P&gt;&lt;P&gt;Code could be refined, for example you can check the insertion point of block and if the value of Y changes, you can restart the count.&lt;/P&gt;&lt;P&gt;Please note that the number sequence associated to block will be the same as insertion block sequence.&lt;/P&gt;&lt;P&gt;I hope this will helps you a little bit.&lt;/P&gt;&lt;P&gt;Bye&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Countblock()
A = 1
Dim MyTextInsPoint(0 To 2) As Double
Dim MyAlignmentPoint(0 To 2) As Double
Dim MyblockInsPoint() As Double
Dim MyBObject As Object
For Each MyBObject In ThisDrawing.ModelSpace
    If TypeOf MyBObject Is AcadBlockReference Then
        Set MyblockNew = MyBObject
        MyblockInsPoint = MyblockNew.InsertionPoint
        
        'midpoint X = (X1 + X2) / 2
        'midpoint Y = (Y1 + Y2) / 2
        'midpoint Z = (Z1 + Z2) / 2
        MyblockNew.GetBoundingBox minExt, maxExt
        MyTextInsPoint(0) = (minExt(0) + maxExt(0)) / 2#
        MyTextInsPoint(1) = (minExt(1) + maxExt(1)) / 2#
        MyTextInsPoint(2) = 0# '(minExt(2) + maxExt(2)) / 2#
      
        Set MyText = ThisDrawing.ModelSpace.AddText(CStr(A), MyTextInsPoint, 180)
        MyText.Alignment = acAlignmentMiddleCenter
        MyAlignmentPoint(0) = MyTextInsPoint(0)
        MyAlignmentPoint(1) = MyTextInsPoint(1)
        MyAlignmentPoint(2) = MyTextInsPoint(2)
        MyText.TextAlignmentPoint = MyAlignmentPoint
        MyText.Alignment = acAlignmentTopCenter
        ThisDrawing.Regen acAllViewports
        A = A + 1
    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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Feb 2022 11:29:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10930908#M2677</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2022-02-06T11:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: Insert number into an array of blocks</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10935022#M2678</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/472256"&gt;@grobnik&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for the late reply, I'm on holiday. Thank you so much for your code.&lt;/P&gt;&lt;P&gt;I understand a bit now how to do it, but when I try your code, the number goes up from row to row.&lt;/P&gt;&lt;P&gt;Can I know how to change it so that the number can be in the arrow direction.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="zka192020_0-1644282568889.png" style="width: 455px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1022022i8AF5E0DAE432BD4C/image-dimensions/455x464?v=v2" width="455" height="464" role="button" title="zka192020_0-1644282568889.png" alt="zka192020_0-1644282568889.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/472256"&gt;@grobnik&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 01:11:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10935022#M2678</guid>
      <dc:creator>zka192020</dc:creator>
      <dc:date>2022-02-08T01:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: Insert number into an array of blocks</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10935113#M2679</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/472256"&gt;@grobnik&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another one I found from your code is that the number is based on the total qty, but actually what I want to do is every row start with number 1 (refer pic below). But can I do that the user input the starting number? For example as you can see from the last row, the number start from 3, because it doesn't have same qty of seat as per the other row.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="zka192020_0-1644286732190.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1022042i5A0276183921E883/image-size/medium?v=v2&amp;amp;px=400" role="button" title="zka192020_0-1644286732190.png" alt="zka192020_0-1644286732190.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 02:21:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10935113#M2679</guid>
      <dc:creator>zka192020</dc:creator>
      <dc:date>2022-02-08T02:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: Insert number into an array of blocks</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10935336#M2680</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12001896"&gt;@zka192020&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I wrote &lt;EM&gt;&lt;U&gt;"Please note that the number sequence associated to block will be the same as insertion block sequence."&lt;/U&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Probably when you inserted the blocks it was in row sequence&lt;/P&gt;&lt;P&gt;You can refine the code, you can get help from forum.&lt;/P&gt;&lt;P&gt;For user input integer you can try&amp;nbsp;&lt;SPAN&gt;intUserIntegerInput = UtilityObject.GetInteger([Prompt]) and then pass the value to insert text function.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 05:07:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10935336#M2680</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2022-02-08T05:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: Insert number into an array of blocks</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10935353#M2681</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12001896"&gt;@zka192020&lt;/a&gt;&amp;nbsp;As alternative you can pick the starting point, get coordinate ask for sequence rows or columns , ask for starting number and quantity, and the code will insert a sequence of&amp;nbsp; numbers. Or there are a lot of utilty on web already done which insert automatically a rows of numbers, made by lsp language.&lt;/P&gt;&lt;P&gt;Bye&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 05:29:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10935353#M2681</guid>
      <dc:creator>grobnik</dc:creator>
      <dc:date>2022-02-08T05:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: Insert number into an array of blocks</title>
      <link>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10935568#M2682</link>
      <description>&lt;P&gt;ok&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/472256"&gt;@grobnik&lt;/a&gt;, thanks a lot&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 07:59:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/insert-number-into-an-array-of-blocks/m-p/10935568#M2682</guid>
      <dc:creator>zka192020</dc:creator>
      <dc:date>2022-02-08T07:59:35Z</dc:date>
    </item>
  </channel>
</rss>

