<?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 creating new parameters with FOR NEXT loop? in Libraries &amp; objects</title>
    <link>https://community.graphisoft.com/t5/Libraries-objects/creating-new-parameters-with-FOR-NEXT-loop/m-p/172255#M13879</link>
    <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;T&gt;Hi everyone,&lt;BR /&gt;
&lt;BR /&gt;
I'm trying to create rectangular symbol and give movable hotspot for each rect.&lt;BR /&gt;
&lt;BR /&gt;
My code looks like this:&lt;BR /&gt;
!-------------------------------------------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
nRect = 3&lt;BR /&gt;
unID = 100&lt;BR /&gt;
&lt;BR /&gt;
for i = 1 to nRect&lt;BR /&gt;
	add2 1.5, 0&lt;BR /&gt;
&lt;BR /&gt;
	hotspot2	0, moveY, unID, moveX, 1+128			:unID = unID+1	! Move X&lt;BR /&gt;
	hotspot2	moveX, moveY, unID, moveX, 2+256	:unID = unID+1&lt;BR /&gt;
	hotspot2	-1, moveY, unID, moveX, 3				:unID = unID+1&lt;BR /&gt;
	&lt;BR /&gt;
	hotspot2	moveX, 0, unID, moveY, 1+128			:unID = unID+1	! Move Y&lt;BR /&gt;
	hotspot2	moveX, moveY, unID, moveY, 2+256	:unID = unID+1&lt;BR /&gt;
	hotspot2	moveX, -1, unID, moveY, 3				:unID = unID+1&lt;BR /&gt;
	&lt;BR /&gt;
	add2 moveX, moveY&lt;BR /&gt;
		rect2 -A/2, -B/2, A/2, B/2&lt;BR /&gt;
	del 1&lt;BR /&gt;
next i&lt;BR /&gt;
del nRect&lt;BR /&gt;
&lt;BR /&gt;
!-------------------------------------------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
What I aim for is that, each hotspot can move each rect attached to it freely, not all at the same time. Right now I can create new parameters like "moveX1" , "moveY1", ... and use them for each rect (using subroutine)....something like :&lt;BR /&gt;
&lt;BR /&gt;
if nRect = 1 then gosub "rect1"&lt;BR /&gt;
if nRect = 2 then gosub "rect2"&lt;BR /&gt;
&lt;BR /&gt;
Then I realize, if I want nRect to be 20, I will have to create 40 more parameters.&lt;BR /&gt;
&lt;BR /&gt;
Is there a smarter way, something that works like unID=unID+1, maybe? Any comment is appreciated.&lt;/T&gt;&lt;/DIV&gt;</description>
    <pubDate>Thu, 18 Jul 2013 09:28:16 GMT</pubDate>
    <dc:creator>Palawat</dc:creator>
    <dc:date>2013-07-18T09:28:16Z</dc:date>
    <item>
      <title>creating new parameters with FOR NEXT loop?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/creating-new-parameters-with-FOR-NEXT-loop/m-p/172255#M13879</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;T&gt;Hi everyone,&lt;BR /&gt;
&lt;BR /&gt;
I'm trying to create rectangular symbol and give movable hotspot for each rect.&lt;BR /&gt;
&lt;BR /&gt;
My code looks like this:&lt;BR /&gt;
!-------------------------------------------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
nRect = 3&lt;BR /&gt;
unID = 100&lt;BR /&gt;
&lt;BR /&gt;
for i = 1 to nRect&lt;BR /&gt;
	add2 1.5, 0&lt;BR /&gt;
&lt;BR /&gt;
	hotspot2	0, moveY, unID, moveX, 1+128			:unID = unID+1	! Move X&lt;BR /&gt;
	hotspot2	moveX, moveY, unID, moveX, 2+256	:unID = unID+1&lt;BR /&gt;
	hotspot2	-1, moveY, unID, moveX, 3				:unID = unID+1&lt;BR /&gt;
	&lt;BR /&gt;
	hotspot2	moveX, 0, unID, moveY, 1+128			:unID = unID+1	! Move Y&lt;BR /&gt;
	hotspot2	moveX, moveY, unID, moveY, 2+256	:unID = unID+1&lt;BR /&gt;
	hotspot2	moveX, -1, unID, moveY, 3				:unID = unID+1&lt;BR /&gt;
	&lt;BR /&gt;
	add2 moveX, moveY&lt;BR /&gt;
		rect2 -A/2, -B/2, A/2, B/2&lt;BR /&gt;
	del 1&lt;BR /&gt;
next i&lt;BR /&gt;
del nRect&lt;BR /&gt;
&lt;BR /&gt;
!-------------------------------------------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
What I aim for is that, each hotspot can move each rect attached to it freely, not all at the same time. Right now I can create new parameters like "moveX1" , "moveY1", ... and use them for each rect (using subroutine)....something like :&lt;BR /&gt;
&lt;BR /&gt;
if nRect = 1 then gosub "rect1"&lt;BR /&gt;
if nRect = 2 then gosub "rect2"&lt;BR /&gt;
&lt;BR /&gt;
Then I realize, if I want nRect to be 20, I will have to create 40 more parameters.&lt;BR /&gt;
&lt;BR /&gt;
Is there a smarter way, something that works like unID=unID+1, maybe? Any comment is appreciated.&lt;/T&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 18 Jul 2013 09:28:16 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/creating-new-parameters-with-FOR-NEXT-loop/m-p/172255#M13879</guid>
      <dc:creator>Palawat</dc:creator>
      <dc:date>2013-07-18T09:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: creating new parameters with FOR NEXT loop?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/creating-new-parameters-with-FOR-NEXT-loop/m-p/172256#M13880</link>
      <description>Hi Palawat,&lt;BR /&gt;
&lt;BR /&gt;
you have to use arrays for moveX/moveY.&lt;BR /&gt;
&lt;BR /&gt;
The unID is right.</description>
      <pubDate>Thu, 18 Jul 2013 11:44:04 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/creating-new-parameters-with-FOR-NEXT-loop/m-p/172256#M13880</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-07-18T11:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: creating new parameters with FOR NEXT loop?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/creating-new-parameters-with-FOR-NEXT-loop/m-p/172257#M13881</link>
      <description>Thank you very much, ila2.&lt;BR /&gt;
&lt;BR /&gt;
I'll look into it. &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt;</description>
      <pubDate>Thu, 18 Jul 2013 13:43:39 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/creating-new-parameters-with-FOR-NEXT-loop/m-p/172257#M13881</guid>
      <dc:creator>Palawat</dc:creator>
      <dc:date>2013-07-18T13:43:39Z</dc:date>
    </item>
  </channel>
</rss>

