<?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: Array item sets to &amp;quot;0&amp;quot; instead of being removed via hotspots in GDL</title>
    <link>https://community.graphisoft.com/t5/GDL/Array-item-sets-to-quot-0-quot-instead-of-being-removed-via/m-p/654000#M7496</link>
    <description>&lt;P&gt;Nope, what you can see in the code above is all there is to it. you can find the sample object attached to the original post.&lt;/P&gt;</description>
    <pubDate>Wed, 05 Mar 2025 10:56:19 GMT</pubDate>
    <dc:creator>danielk</dc:creator>
    <dc:date>2025-03-05T10:56:19Z</dc:date>
    <item>
      <title>Array item sets to "0" instead of being removed via hotspots</title>
      <link>https://community.graphisoft.com/t5/GDL/Array-item-sets-to-quot-0-quot-instead-of-being-removed-via/m-p/653910#M7490</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working on an object where I have values in an array parameter, and they are represented in 2D as points on a line. You can move them by hotspots, and if you move one over the other, the parameter script finds the duplicate values, and deletes one of them from the array.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works mostly fine, except if i try to remove the last node (last item of the array) it doesn't get removed, it just sets itself to "0", and I have no idea why. It seems like a fairly simple setup, but I still cannot see what I am doing wrong.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vmware-view_2S82PlRxTt.gif" style="width: 400px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/83944i119B30279D47271E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vmware-view_2S82PlRxTt.gif" alt="vmware-view_2S82PlRxTt.gif" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Can someone tell me what am I missing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;! ----------
! 2D script:
! ----------
unID = 1
hotspot2 0, 0, unID : unID = unID + 1

for i = 1 to vardim1(dimArray) step 1
	hotspot2 0,		0,	unID, dimArray[i], 1 + 128 : unID = unID + 1
	hotspot2 dimArray[i],	0,	unID, dimArray[i], 2 : unID = unID + 1
	hotspot2 -1,	0,	unID, dimArray[i], 3 : unID = unID + 1
next i

line2 dimArray[1], -0.5, dimArray[1], 0.5
for i = 2 to vardim1(dimArray) step 1
	line2 dimArray[i-1], 0, dimArray[i], 0
	line2 dimArray[i], -0.5, dimArray[i], 0.5
next i

! -----------------
! Parameter script:
! -----------------

put dimArray[1]

for i=1 to (vardim1(dimArray) - 1) step 1
	if dimArray[i] # dimArray[i+1] then
		put dimArray[i+1]
	endif
next i

dim _temp[]

for i = 1 to nsp step 1
	_temp[i] = get(1)
next i

parameters  dimArray = _temp&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 04 Mar 2025 12:59:29 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Array-item-sets-to-quot-0-quot-instead-of-being-removed-via/m-p/653910#M7490</guid>
      <dc:creator>danielk</dc:creator>
      <dc:date>2025-03-04T12:59:29Z</dc:date>
    </item>
    <item>
      <title>Betreff: Array item sets to "0" instead of being removed via hotspots</title>
      <link>https://community.graphisoft.com/t5/GDL/Array-item-sets-to-quot-0-quot-instead-of-being-removed-via/m-p/653914#M7491</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;edit: closer but still not right&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;in your parameter script i added following line (13)&lt;/STRIKE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;STRIKE&gt;put dimArray[vardim1(dimArray)]&lt;/STRIKE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;The corrected version below&lt;/STRIKE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/46952"&gt;@danielk&lt;/a&gt;&amp;nbsp; schrieb:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;! ----------
! 2D script:
! ----------
unID = 1
hotspot2 0, 0, unID : unID = unID + 1

for i = 1 to vardim1(dimArray) step 1
	hotspot2 0,		0,	unID, dimArray[i], 1 + 128 : unID = unID + 1
	hotspot2 dimArray[i],	0,	unID, dimArray[i], 2 : unID = unID + 1
	hotspot2 -1,	0,	unID, dimArray[i], 3 : unID = unID + 1
next i

line2 dimArray[1], -0.5, dimArray[1], 0.5
for i = 2 to vardim1(dimArray) step 1
	line2 dimArray[i-1], 0, dimArray[i], 0
	line2 dimArray[i], -0.5, dimArray[i], 0.5
next i

! -----------------
! Parameter script:
! -----------------

put dimArray[1]

for i=1 to (vardim1(dimArray) - 1) step 1
	if dimArray[i] # dimArray[i+1] then
		put dimArray[i+1]
	endif
next i

put dimArray[vardim1(dimArray)]

dim _temp[]

for i = 1 to nsp step 1
	_temp[i] = get(1)
next i

parameters  dimArray = _temp&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Mar 2025 13:30:14 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Array-item-sets-to-quot-0-quot-instead-of-being-removed-via/m-p/653914#M7491</guid>
      <dc:creator>Xandros</dc:creator>
      <dc:date>2025-03-04T13:30:14Z</dc:date>
    </item>
    <item>
      <title>Betreff: Array item sets to "0" instead of being removed via hotspots</title>
      <link>https://community.graphisoft.com/t5/GDL/Array-item-sets-to-quot-0-quot-instead-of-being-removed-via/m-p/653919#M7492</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is supposed to go through the array, and put each value into the buffer, except if 2 items are identical, and then in the next step, feed them into a temporary array, then assign the temporary array to the parameter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, if I had an array of 1,2,3,4,4, it would first put 1,2,3,4 into the buffer, then create a new array with these values, and assign that array back to the parameter, so it would also be 1,2,3,4.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think what your addition would do is just grab the 4 from the end, and put it back into the temporary array, so at the end I would end up with 1,2,3,4,4? Or am I misunderstanding something?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 04 Mar 2025 14:09:07 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Array-item-sets-to-quot-0-quot-instead-of-being-removed-via/m-p/653919#M7492</guid>
      <dc:creator>danielk</dc:creator>
      <dc:date>2025-03-04T14:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: Array item sets to "0" instead of being removed via hotspots</title>
      <link>https://community.graphisoft.com/t5/GDL/Array-item-sets-to-quot-0-quot-instead-of-being-removed-via/m-p/653920#M7493</link>
      <description>&lt;P&gt;Another thing is, it works perfectly fine if I just change the value in the Object settings dialog. It only does this, if I use the hotspots to change the value.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Mar 2025 14:10:36 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Array-item-sets-to-quot-0-quot-instead-of-being-removed-via/m-p/653920#M7493</guid>
      <dc:creator>danielk</dc:creator>
      <dc:date>2025-03-04T14:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Array item sets to "0" instead of being removed via hotspots</title>
      <link>https://community.graphisoft.com/t5/GDL/Array-item-sets-to-quot-0-quot-instead-of-being-removed-via/m-p/653958#M7494</link>
      <description>&lt;P&gt;Is the parameter that your Hotspot modifies the one you are changing in the settings dialog? Or is the modification indirect? (eg. IF Dn &amp;lt; EPS then Hmax = Hmax - 1) Working in the settings dialogue and not with the Hotspots sounds like an inconsistency in the dependancy between two parameters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ling.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 03:16:21 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Array-item-sets-to-quot-0-quot-instead-of-being-removed-via/m-p/653958#M7494</guid>
      <dc:creator>Lingwisyer</dc:creator>
      <dc:date>2025-03-05T03:16:21Z</dc:date>
    </item>
    <item>
      <title>Re: Array item sets to "0" instead of being removed via hotspots</title>
      <link>https://community.graphisoft.com/t5/GDL/Array-item-sets-to-quot-0-quot-instead-of-being-removed-via/m-p/654000#M7496</link>
      <description>&lt;P&gt;Nope, what you can see in the code above is all there is to it. you can find the sample object attached to the original post.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 10:56:19 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Array-item-sets-to-quot-0-quot-instead-of-being-removed-via/m-p/654000#M7496</guid>
      <dc:creator>danielk</dc:creator>
      <dc:date>2025-03-05T10:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: Array item sets to "0" instead of being removed via hotspots</title>
      <link>https://community.graphisoft.com/t5/GDL/Array-item-sets-to-quot-0-quot-instead-of-being-removed-via/m-p/654003#M7497</link>
      <description>&lt;P&gt;Have you tried to make the array one indice bigger than actually needed? I had a similar problem with an object inspired from &lt;A href="https://community.graphisoft.com/t5/GDL/Dynamic-Polyline-base-code-object/m-p/198874" target="_blank" rel="noopener"&gt;https://community.graphisoft.com/t5/GDL/Dynamic-Polyline-base-code-object/m-p/198874&lt;/A&gt; When removing the last point, it was set to zero, if the array's length was exactly the same as the number of points. I have no idea, why this happened though.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 11:59:30 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/Array-item-sets-to-quot-0-quot-instead-of-being-removed-via/m-p/654003#M7497</guid>
      <dc:creator>vlahtinen</dc:creator>
      <dc:date>2025-03-05T11:59:30Z</dc:date>
    </item>
  </channel>
</rss>

