<?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 Shrinking a Dynamic Array in GDL</title>
    <link>https://community.graphisoft.com/t5/GDL/Shrinking-a-Dynamic-Array/m-p/325958#M2436</link>
    <description>&lt;P&gt;I have a two dimensional parameter array which by default is dynamic and grows according to the number of elements in my parametric object. What I am wondering is how do you get the array to shrink if the object no longer needs as many points e.g. if A = 10 it creates an array of 10 points but if I reduce A to 5 I am still left with a 10 point array?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to avoid having a parameter array for 100 x 20 = 2000 values when I might only need 5 x 20 = 100 values.&lt;/P&gt;</description>
    <pubDate>Sun, 02 Jan 2022 17:19:43 GMT</pubDate>
    <dc:creator>DGSketcher</dc:creator>
    <dc:date>2022-01-02T17:19:43Z</dc:date>
    <item>
      <title>Shrinking a Dynamic Array</title>
      <link>https://community.graphisoft.com/t5/GDL/Shrinking-a-Dynamic-Array/m-p/325958#M2436</link>
      <description>&lt;P&gt;I have a two dimensional parameter array which by default is dynamic and grows according to the number of elements in my parametric object. What I am wondering is how do you get the array to shrink if the object no longer needs as many points e.g. if A = 10 it creates an array of 10 points but if I reduce A to 5 I am still left with a 10 point array?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to avoid having a parameter array for 100 x 20 = 2000 values when I might only need 5 x 20 = 100 values.&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jan 2022 17:19:43 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Shrinking-a-Dynamic-Array/m-p/325958#M2436</guid>
      <dc:creator>DGSketcher</dc:creator>
      <dc:date>2022-01-02T17:19:43Z</dc:date>
    </item>
    <item>
      <title>Re: Shrinking a Dynamic Array</title>
      <link>https://community.graphisoft.com/t5/GDL/Shrinking-a-Dynamic-Array/m-p/325969#M2437</link>
      <description>&lt;P&gt;I control the growing and shrinking of all my arrays (I have hundreds across my objects) using the following technique (master script):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;!!array name = arrName
!!array rows = rowDim

dim _arrName[]

for i = 1 to rowDim
    if i &amp;gt; vardim1(arrName) then
        _arrName = 0          !!depends on the type of parameter; could be string ""
    else
        _arrName = arrName
    endif
next i

arrName = _arrName
parameters arrName = arrName
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This sets the size of the array to a locally declared array and then maps the parameter array to the local array.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It also means you can use the latest array values, before they are updated in the parameter array, by referencing the local array instead (_arrayName). This is the most important feature as it makes the object respond more dynamically.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jan 2022 22:32:01 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Shrinking-a-Dynamic-Array/m-p/325969#M2437</guid>
      <dc:creator>Kristian Bursell</dc:creator>
      <dc:date>2022-01-02T22:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: Shrinking a Dynamic Array</title>
      <link>https://community.graphisoft.com/t5/GDL/Shrinking-a-Dynamic-Array/m-p/325973#M2438</link>
      <description>&lt;P&gt;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/1918"&gt;@Kristian Bursell&lt;/a&gt;&amp;nbsp;Thank you ! I did try assigning a local array but it didn't seem to work. Up and running now. I have consolidated your suggestion as my object array values are always rebuilt from scratch while being added to the parameter. Basically I have set the local array to be 1 x 1 and use that to reset the parameter.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;!Create local single cell array
DIM _arrNull[1][1]
_arrNull[1][1] = 0.0
arrName = _arrNull
PARAMETERS arrName = arrName
...
!Add new values to parameter array&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 00:09:51 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Shrinking-a-Dynamic-Array/m-p/325973#M2438</guid>
      <dc:creator>DGSketcher</dc:creator>
      <dc:date>2022-01-03T00:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: Shrinking a Dynamic Array</title>
      <link>https://community.graphisoft.com/t5/GDL/Shrinking-a-Dynamic-Array/m-p/326003#M2439</link>
      <description>&lt;P&gt;Maybe this is something similuar to your approach &lt;A href="https://community.graphisoft.com/t5/Developer-forum/how-to-make-infinite-hostpots-with-array/m-p/241115#M4037" target="_self"&gt;thread&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 12:38:46 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Shrinking-a-Dynamic-Array/m-p/326003#M2439</guid>
      <dc:creator>A_ Smith</dc:creator>
      <dc:date>2022-01-03T12:38:46Z</dc:date>
    </item>
  </channel>
</rss>

