<?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: Object help using FOR NEXT Loop in Libraries &amp; objects</title>
    <link>https://community.graphisoft.com/t5/Libraries-objects/Object-help-using-FOR-NEXT-Loop/m-p/1141#M42119</link>
    <description>Oops - I glanced too quickly.  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_redface.gif" style="display : inline;" /&gt; The first tranformation is out of the loop. You might want to use this after the loop instead:&lt;BR /&gt;
&lt;BR /&gt;
DEL k&lt;BR /&gt;
&lt;BR /&gt;
It would help to know what is the code doing wrong. Is the overall height/length "Stretchy"? If it is, you will need to do a little calculation up-front (in the Master Script) before doing any geometry to allow for the stretchiness and lock-down the spacing.</description>
    <pubDate>Mon, 03 Nov 2003 15:49:53 GMT</pubDate>
    <dc:creator>David Larrew</dc:creator>
    <dc:date>2003-11-03T15:49:53Z</dc:date>
    <item>
      <title>Object help using FOR NEXT Loop</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Object-help-using-FOR-NEXT-Loop/m-p/1138#M42116</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;T&gt;Is everyone still using GDL talk or is this supposed to take the place of that too? &lt;BR /&gt;
&lt;BR /&gt;
I'll just post in both places hoping someone can help.&lt;BR /&gt;
&lt;BR /&gt;
 I made an adjustable shelf object but I want the object to make some calculations for the user. I want the standards to calculate  their spacing. I want the standards to start at 6" from one end of the shelf and stop at 6" from the other end and I want the spacing to be 2'-0" max. I've included some of the code from my object. Thanks for any help.&lt;BR /&gt;
&lt;BR /&gt;
Michele&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
!Standards&lt;BR /&gt;
PEN spen&lt;BR /&gt;
MATERIAL stmat&lt;BR /&gt;
ADDz bshigt&lt;BR /&gt;
FOR k=1 TO nstand&lt;BR /&gt;
ADDx sfromcorn&lt;BR /&gt;
BLOCK 1",.5",shigt&lt;BR /&gt;
DEL 1&lt;BR /&gt;
ADDx stspace&lt;BR /&gt;
NEXT k&lt;BR /&gt;
DEL nstand&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
!Shelf&lt;BR /&gt;
PEN shpen&lt;BR /&gt;
MATERIAL shmat&lt;BR /&gt;
LINE_TYPE shline&lt;BR /&gt;
ADDz 6"&lt;BR /&gt;
BLOCK wid,dep,0.75"&lt;BR /&gt;
&lt;BR /&gt;
IF nshelves=2.00 THEN GOSUB 500&lt;BR /&gt;
&lt;BR /&gt;
IF nshelves=3.00 THEN GOSUB 600&lt;BR /&gt;
&lt;BR /&gt;
IF nshelves=4.00 THEN GOSUB 700&lt;BR /&gt;
&lt;BR /&gt;
IF nshelves=5.00 THEN GOSUB 800&lt;BR /&gt;
&lt;BR /&gt;
IF nshelves&amp;gt;5.00 THEN nshelves=5.00&lt;BR /&gt;
IF nshelves&amp;lt;2.00 THEN nshelves=2&lt;BR /&gt;
DEL 1&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
END:!------------------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
200:!Standards&lt;BR /&gt;
ADDz 6"&lt;BR /&gt;
ADDx wid*0.5&lt;BR /&gt;
BLOCK 1",0.5",shigt&lt;BR /&gt;
DEL 2&lt;BR /&gt;
RETURN&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
300:!Standards&lt;BR /&gt;
ADDz 6"&lt;BR /&gt;
ADDx wid*0.333&lt;BR /&gt;
BLOCK 1",0.5",shigt&lt;BR /&gt;
ADDx wid*0.666&lt;BR /&gt;
BLOCK 1",0.5",shigt&lt;BR /&gt;
DEL 3&lt;BR /&gt;
RETURN&lt;/T&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 03 Nov 2003 15:03:42 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Object-help-using-FOR-NEXT-Loop/m-p/1138#M42116</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-11-03T15:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: Object help using FOR NEXT Loop</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Object-help-using-FOR-NEXT-Loop/m-p/1139#M42117</link>
      <description>Michele,&lt;BR /&gt;
&lt;BR /&gt;
Just glancing at your loop in the provided code... It looks like you have not accounted for all of your "ADD" commands in the loop.&lt;BR /&gt;
&lt;BR /&gt;
You have 3 "ADD"s and 1 "DEL" within the loop and you are only deleting 1 more "ADD" per loop after the "NEXT".&lt;BR /&gt;
&lt;BR /&gt;
You could either revise the loop or add to the DEL after the loop.</description>
      <pubDate>Mon, 03 Nov 2003 15:34:21 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Object-help-using-FOR-NEXT-Loop/m-p/1139#M42117</guid>
      <dc:creator>David Larrew</dc:creator>
      <dc:date>2003-11-03T15:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: Object help using FOR NEXT Loop</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Object-help-using-FOR-NEXT-Loop/m-p/1140#M42118</link>
      <description>I had an object that worked but we had to put in how many standards &amp;amp; at what spacing and I wanted to see if I could give the objects some parameters like spacing not larger than 2'-0" and start spaing at 6" from both ends and have the object put in the amount of standards needed. I just don't know how to accomplish this part of it (which is really all of it isn't it  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt; .&lt;BR /&gt;
&lt;BR /&gt;
Thanks for any help,&lt;BR /&gt;
Michele</description>
      <pubDate>Mon, 03 Nov 2003 15:43:39 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Object-help-using-FOR-NEXT-Loop/m-p/1140#M42118</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-11-03T15:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: Object help using FOR NEXT Loop</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Object-help-using-FOR-NEXT-Loop/m-p/1141#M42119</link>
      <description>Oops - I glanced too quickly.  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_redface.gif" style="display : inline;" /&gt; The first tranformation is out of the loop. You might want to use this after the loop instead:&lt;BR /&gt;
&lt;BR /&gt;
DEL k&lt;BR /&gt;
&lt;BR /&gt;
It would help to know what is the code doing wrong. Is the overall height/length "Stretchy"? If it is, you will need to do a little calculation up-front (in the Master Script) before doing any geometry to allow for the stretchiness and lock-down the spacing.</description>
      <pubDate>Mon, 03 Nov 2003 15:49:53 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Object-help-using-FOR-NEXT-Loop/m-p/1141#M42119</guid>
      <dc:creator>David Larrew</dc:creator>
      <dc:date>2003-11-03T15:49:53Z</dc:date>
    </item>
    <item>
      <title>Re: Object help using FOR NEXT Loop</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Object-help-using-FOR-NEXT-Loop/m-p/1142#M42120</link>
      <description>If I'm understanding you...&lt;BR /&gt;

&lt;BLOCKQUOTE&gt;Michele wrote:&lt;BR /&gt;
IF nshelves&amp;gt;5.00 THEN nshelves=5.00&lt;BR /&gt;
IF nshelves&amp;lt;2.00 THEN nshelves=2
&lt;/BLOCKQUOTE&gt;

Should be placed ahead of the GOSUB calls if you are trying to control the "nshelves".</description>
      <pubDate>Mon, 03 Nov 2003 16:01:55 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Object-help-using-FOR-NEXT-Loop/m-p/1142#M42120</guid>
      <dc:creator>David Larrew</dc:creator>
      <dc:date>2003-11-03T16:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: Object help using FOR NEXT Loop</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Object-help-using-FOR-NEXT-Loop/m-p/1143#M42121</link>
      <description>Sorry to confuse anyone. Here is the complete code and please remember I am trying to muddle through coding. I starting making objects in the summer and I get to work on them about 1 hour every 2 weeks if I'm lucky. This object works but we have to put in how many standards &amp;amp; at what spacing and I wanted to see if I could give the objects some parameters like spacing not larger than 2'-0" and start spaing at 6" from both ends and have the object put in the amount of standards needed and at a spacing not larger than 2'-0" when I stretched it in plan.  I just don't know how to accomplish this part of it (which is really all of it, isn't it ? &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt; It's strecthy in plan but I can't get it to calculate the no. of standards.&lt;BR /&gt;
&lt;BR /&gt;
Thanks again,&lt;BR /&gt;
Michele&lt;BR /&gt;
&lt;BR /&gt;
Here's the code:&lt;BR /&gt;
&lt;BR /&gt;
!Adjustable Shelves&lt;BR /&gt;
!3D Script - Imperial&lt;BR /&gt;
!with parameters&lt;BR /&gt;
!Michele LaBucki July 2003&lt;BR /&gt;
&lt;BR /&gt;
wid=A !Width&lt;BR /&gt;
dep=B !Depth&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
!Standards&lt;BR /&gt;
PEN spen&lt;BR /&gt;
MATERIAL stmat&lt;BR /&gt;
ADDz bshigt&lt;BR /&gt;
FOR k=1 TO nstand&lt;BR /&gt;
ADDx sfromcorn&lt;BR /&gt;
BLOCK 1",.5",shigt&lt;BR /&gt;
DEL 1&lt;BR /&gt;
ADDx stspace&lt;BR /&gt;
NEXT k&lt;BR /&gt;
DEL nstand&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
!Shelf&lt;BR /&gt;
PEN shpen&lt;BR /&gt;
MATERIAL shmat&lt;BR /&gt;
LINE_TYPE shline&lt;BR /&gt;
ADDz 6"&lt;BR /&gt;
BLOCK wid,dep,0.75"&lt;BR /&gt;
&lt;BR /&gt;
IF nshelves=2.00 THEN GOSUB 500&lt;BR /&gt;
&lt;BR /&gt;
IF nshelves=3.00 THEN GOSUB 600&lt;BR /&gt;
&lt;BR /&gt;
IF nshelves=4.00 THEN GOSUB 700&lt;BR /&gt;
&lt;BR /&gt;
IF nshelves=5.00 THEN GOSUB 800&lt;BR /&gt;
&lt;BR /&gt;
IF nshelves&amp;gt;5.00 THEN nshelves=5.00&lt;BR /&gt;
IF nshelves&amp;lt;2.00 THEN nshelves=2&lt;BR /&gt;
DEL 1&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
END:!------------------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
200:!Standards&lt;BR /&gt;
ADDz 6"&lt;BR /&gt;
ADDx wid*0.5&lt;BR /&gt;
BLOCK 1",0.5",shigt&lt;BR /&gt;
DEL 2&lt;BR /&gt;
RETURN&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
300:!Standards&lt;BR /&gt;
ADDz 6"&lt;BR /&gt;
ADDx wid*0.333&lt;BR /&gt;
BLOCK 1",0.5",shigt&lt;BR /&gt;
ADDx wid*0.666&lt;BR /&gt;
BLOCK 1",0.5",shigt&lt;BR /&gt;
DEL 3&lt;BR /&gt;
RETURN&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
400:!Standards&lt;BR /&gt;
ADDz 6"&lt;BR /&gt;
ADDx wid*0.25&lt;BR /&gt;
BLOCK 1",0.5",shigt&lt;BR /&gt;
ADDx wid*0.5&lt;BR /&gt;
BLOCK 1",.5",shigt&lt;BR /&gt;
ADDx wid*0.75&lt;BR /&gt;
BLOCK 1",.5",shigt&lt;BR /&gt;
DEL 4&lt;BR /&gt;
RETURN&lt;BR /&gt;
&lt;BR /&gt;
500:!Shelf&lt;BR /&gt;
LINE_TYPE shline&lt;BR /&gt;
ADDz 1'-2"&lt;BR /&gt;
BLOCK wid,dep,0.75"&lt;BR /&gt;
DEL 1&lt;BR /&gt;
RETURN&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
600:!Shelf&lt;BR /&gt;
LINE_TYPE shline&lt;BR /&gt;
ADDz 1'-2"&lt;BR /&gt;
BLOCK wid,dep,0.75"&lt;BR /&gt;
ADDz 1'-2"&lt;BR /&gt;
BLOCK wid,dep,0.75"&lt;BR /&gt;
DEL 2&lt;BR /&gt;
RETURN&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
700:!Shelf&lt;BR /&gt;
LINE_TYPE shline&lt;BR /&gt;
ADDz 1'-2"&lt;BR /&gt;
BLOCK wid,dep,0.75"&lt;BR /&gt;
ADDz 1'-2"&lt;BR /&gt;
BLOCK wid,dep,0.75"&lt;BR /&gt;
ADDz 1'-2"&lt;BR /&gt;
BLOCK wid,dep,0.75"&lt;BR /&gt;
DEL 3&lt;BR /&gt;
RETURN&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
800:!Shelf&lt;BR /&gt;
LINE_TYPE shline&lt;BR /&gt;
ADDz 1'-2"&lt;BR /&gt;
BLOCK wid,dep,0.75"&lt;BR /&gt;
ADDz 1'-2"&lt;BR /&gt;
BLOCK wid,dep,0.75"&lt;BR /&gt;
ADDz 1'-2"&lt;BR /&gt;
BLOCK wid,dep,0.75"&lt;BR /&gt;
ADDz 1'-2"&lt;BR /&gt;
BLOCK wid,dep,0.75"&lt;BR /&gt;
DEL 4&lt;BR /&gt;
RETURN</description>
      <pubDate>Mon, 03 Nov 2003 16:06:39 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Object-help-using-FOR-NEXT-Loop/m-p/1143#M42121</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-11-03T16:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: Object help using FOR NEXT Loop</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Object-help-using-FOR-NEXT-Loop/m-p/1144#M42122</link>
      <description>&lt;BLOCKQUOTE&gt;Michele wrote:&lt;BR /&gt;Is everyone still using GDL talk or is this supposed to take the place of that too?&lt;/BLOCKQUOTE&gt;

Both are equally valid; choose your prefered one.&lt;BR /&gt;
&lt;BR /&gt;
IMHO GDL Talk is more frequented by the hard coders, while here the company is more generally minded.&lt;BR /&gt;
&lt;BR /&gt;
Then, again, I might be wrong as usual &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt;</description>
      <pubDate>Mon, 03 Nov 2003 16:41:24 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Object-help-using-FOR-NEXT-Loop/m-p/1144#M42122</guid>
      <dc:creator>Djordje</dc:creator>
      <dc:date>2003-11-03T16:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: Object help using FOR NEXT Loop</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Object-help-using-FOR-NEXT-Loop/m-p/1145#M42123</link>
      <description>Michele,&lt;BR /&gt;
&lt;BR /&gt;
Instead of your GOSUB routines try this FOR NEXT loop instead:&lt;BR /&gt;
&lt;BR /&gt;
!_____________________________&lt;BR /&gt;
&lt;BR /&gt;
!Shelf &lt;BR /&gt;
PEN shpen &lt;BR /&gt;
MATERIAL shmat &lt;BR /&gt;
LINE_TYPE shline&lt;BR /&gt;
&lt;BR /&gt;
leadspc=6.0"                    !start space from bottom of standards&lt;BR /&gt;
spcng=(shigt-(leadspc*2))/nshelves                    !shelf spacing per overall height of standards&lt;BR /&gt;
If spcng&amp;lt;6.0" then spcng=6.0"&lt;BR /&gt;
If spcng&amp;gt;24.0" then spcng=24.0"&lt;BR /&gt;
&lt;BR /&gt;
ADDz leadspc&lt;BR /&gt;
FOR i=1 TO nshelves&lt;BR /&gt;
	ADDz spcng &lt;BR /&gt;
	BLOCK wid,dep,0.75" &lt;BR /&gt;
NEXT i&lt;BR /&gt;
&lt;BR /&gt;
DEL i+1&lt;BR /&gt;
!_____________________________&lt;BR /&gt;
&lt;BR /&gt;
This is a little cleaner code. FYI - Anytime you need to calculate quantities, lengths, numbers, etc. from the overall dimensions of an object - you should do the coding in the "Master Script".&lt;BR /&gt;
&lt;BR /&gt;
Hope this gets you on the right track.</description>
      <pubDate>Mon, 03 Nov 2003 16:45:59 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Object-help-using-FOR-NEXT-Loop/m-p/1145#M42123</guid>
      <dc:creator>David Larrew</dc:creator>
      <dc:date>2003-11-03T16:45:59Z</dc:date>
    </item>
  </channel>
</rss>

