<?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: GDL For... Next Loop Issues in Libraries &amp; objects</title>
    <link>https://community.graphisoft.com/t5/Libraries-objects/GDL-For-Next-Loop-Issues/m-p/247698#M2028</link>
    <description>If you devide 2 Numbers, you always get as result a real number.&lt;BR /&gt;
And you can turn the real number back again into integer by using INT command.&lt;BR /&gt;
It would be helpful if you post your script with the issue.</description>
    <pubDate>Thu, 08 Aug 2019 16:13:13 GMT</pubDate>
    <dc:creator>Jochen Suehlo</dc:creator>
    <dc:date>2019-08-08T16:13:13Z</dc:date>
    <item>
      <title>GDL For... Next Loop Issues</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/GDL-For-Next-Loop-Issues/m-p/247697#M2027</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;R&gt;Hello,&lt;BR /&gt;
&lt;BR /&gt;
I am relatively new to GDL scripting. I am really enjoying it, however I have ran into a hiccup on my first 3D object.&lt;BR /&gt;
&lt;BR /&gt;
I'll start by giving you some context. I am currently scripting a kitchen cabinet GDL object. I have created a For... Next loop in order to create parametric shelves for the unit. &lt;BR /&gt;
&lt;BR /&gt;
The issue is that when I edit the height, either by entering a value or manually in 3D, a number of the shelves disappear. I believe this is because the value being returned is an integer and not a real number and therefore it cannot divide the shelves equally. Is it possible to change the value being returned into a real number?&lt;BR /&gt;
&lt;BR /&gt;
I have included 2 example images for your reference.&lt;BR /&gt;
&lt;BR /&gt;
The first image shows the cabinet at 900 high with equal shelving divisions:&lt;BR /&gt;



&lt;BR /&gt;
&lt;BR /&gt;
The second image shows the cabinet at 895 high with unequal shelving divisions and missing shelves.&lt;BR /&gt;



&lt;BR /&gt;
&lt;BR /&gt;
I have no idea how to go about solving this one, a simple point in the right direction would be helpful!&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance.&lt;BR /&gt;
&lt;BR /&gt;
Cheers,&lt;BR /&gt;
&lt;BR /&gt;
Jarrod Phillips&lt;/R&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 08 Aug 2019 12:56:32 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/GDL-For-Next-Loop-Issues/m-p/247697#M2027</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-08T12:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: GDL For... Next Loop Issues</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/GDL-For-Next-Loop-Issues/m-p/247698#M2028</link>
      <description>If you devide 2 Numbers, you always get as result a real number.&lt;BR /&gt;
And you can turn the real number back again into integer by using INT command.&lt;BR /&gt;
It would be helpful if you post your script with the issue.</description>
      <pubDate>Thu, 08 Aug 2019 16:13:13 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/GDL-For-Next-Loop-Issues/m-p/247698#M2028</guid>
      <dc:creator>Jochen Suehlo</dc:creator>
      <dc:date>2019-08-08T16:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: GDL For... Next Loop Issues</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/GDL-For-Next-Loop-Issues/m-p/247699#M2029</link>
      <description>&lt;BLOCKQUOTE&gt;Joachim wrote:&lt;BR /&gt;
If you devide 2 Numbers, you always get as result a real number.&lt;BR /&gt;
And you can turn the real number back again into integer by using INT command.&lt;BR /&gt;
It would be helpful if you post your script with the issue.
&lt;/BLOCKQUOTE&gt;

Thanks for the reply Joachim!&lt;BR /&gt;
&lt;BR /&gt;
I thought that this was the case, so I was confused when shelves were disappearing on unequal divisions.&lt;BR /&gt;
&lt;BR /&gt;
Please feel free to give any other pointers on best practices for formatting etc. if anything is unclear. &lt;BR /&gt;
&lt;BR /&gt;
Script is as shown below:&lt;BR /&gt;

&lt;PRE&gt;! PARAMETRIC KITCHEN CABINET
! copyright 2019 by Jarrod Phillips

! VARIABLES
width = A
depth = B
height = ZZYZX

! FRONT KICKBOARD
		add 0, doorPanelThickness+0.002+toedepth, 0
		building_material buildingMat1, bForePen1, bBackPen1
		cwall_ mat1, mat2, mat3,
		toeHeight, 0, width, width, 0, toeThickness,
		15, 15, 15, 15,
		0,
		0
		del 1

! REAR KICKBOARD
		add 0, depth-toeThickness, 0
		building_material buildingMat1, bForePen1, bBackPen1
		cwall_ mat1, mat2, mat3,
		toeHeight, 0, width, width, 0, toeThickness,
		15, 15, 15, 15,
		0,
		0
		del 1

! LEFT KICKBOARD
		add toeThickness, doorPanelThickness+0.002+toeThickness+toeDepth, 0
		rotz 90
		building_material buildingMat1, bForePen1, bBackPen1
		cwall_ mat1, mat2, mat3,
		toeHeight, 0, depth-(2*toeThickness+doorPanelThickness+0.002+toeDepth), depth-(2*toeThickness+doorPanelThickness+0.002+toeDepth), 0, toeThickness,
		15, 15, 15, 15,
		0,
		0
		del 2

! RIGHT KICKBOARD
		add width, doorPanelThickness+0.002+toeThickness+toeDepth, 0
		rotz 90
		building_material buildingMat1, bForePen1, bBackPen1
		cwall_ mat1, mat2, mat3,
		toeHeight, 0, depth-(2*toeThickness+doorPanelThickness+0.002+toeDepth), depth-(2*toeThickness+doorPanelThickness+0.002+toeDepth), 0, toeThickness,
		15, 15, 15, 15,
		0,
		0
		del 2

! BOTTOM PANEL
		add 0, doorPanelThickness+0.002, toeHeight
		building_material buildingMat2, bForePen2, bBackPen2
		cprism_ mat4, mat5, mat6,
       	5, bottomPanelThickness,
       	0, 0, 15,
       	width, 0, 15,
       	width, depth-(doorPanelThickness+0.002), 15,
       	0, depth-(doorPanelThickness+0.002), 15,
       	0, 0, 15
		del 1

! DOOR PANEL
	if doorOn then
		add 0.002, 0, toeHeight+0.002
		rotz 360-doorAngle
		building_material buildingMat3, bForePen3, bBackPen3
		cwall_ mat7, mat8, mat9,
       	height-(toeHeight+0.002), 0, width-0.004, width-0.004, 0, doorPanelThickness,       	
		15, 15, 15, 15,
		0,
		0			
		del 2
	endif

! REAR PANEL
		add 0, depth-rearPanelThickness, toeHeight+bottomPanelThickness
		building_material buildingMat2, bForePen2, bBackPen2
		cwall_ mat4, mat5, mat6,
       	height-(toeHeight+bottomPanelThickness), 0, width, width, 0, rearPanelThickness,       	
		15, 15, 15, 15,
		0,
		0
		del 1

! LEFT PANEL
		add 0, doorPanelThickness+0.002, toeHeight+bottomPanelThickness
		rotz 90
		building_material buildingMat2, bForePen2, bBackPen2
		cwall_ mat4, mat5, mat6,
       	height-(toeHeight+bottomPanelThickness), 0, depth-(rearPanelThickness+doorPanelThickness+0.002), depth-(rearPanelThickness+doorPanelThickness+0.002), 0, -leftPanelThickness,       	
		15, 15, 15, 15,
		0,
		0
		del 2

! RIGHT PANEL
		add width-rightPanelThickness, doorPanelThickness+0.002, toeHeight+bottomPanelThickness
		rotz 90
		building_material buildingMat2, bForePen2, bBackPen2
		cwall_ mat4, mat5, mat6,
       	height-(toeHeight+bottomPanelThickness), 0, depth-(rearPanelThickness+doorPanelThickness+0.002), depth-(rearPanelThickness+doorPanelThickness+0.002), 0, -rightPanelThickness,       	
		15, 15, 15, 15,
		0,
		0		
		del 2
	
	If braceHorizontal then

! FRONT HORIZONTAL BRACING MEMBER
		add leftPanelThickness, doorPanelThickness+0.002, height-frontBraceThickness
		building_material buildingMat4, bForePen4, bBackPen4
		cprism_ mat10, mat11, mat12,
		5, frontBraceThickness,
		0, 0, 15,
		width-(leftPanelThickness+rightPanelThickness), 0, 15,
		width-(leftPanelThickness+rightPanelThickness), braceHeight, 15,
		0, braceHeight, 15,
		0, 0, 15
		del 1

! REAR HORIZONTAL BRACING MEMBER
		add leftPanelThickness, depth-(braceHeight+rearPanelThickness), height-rearBraceThickness
		building_material buildingMat4, bForePen4, bBackPen4
		cprism_ mat10, mat11, mat12,
		5, rearBraceThickness,
		0, 0, 15,
		width-(leftPanelThickness+rightPanelThickness), 0, 15,
		width-(leftPanelThickness+rightPanelThickness), braceHeight, 15,
		0, braceHeight, 15,
		0, 0, 15
		del 1
	else

! FRONT VERTICAL BRACING MEMBER
		add leftPanelThickness, doorPanelThickness+0.002, height-braceHeight
		building_material buildingMat4, bForePen4, bBackPen4
		cwall_ mat10, mat11, mat12,
		braceHeight, 0, width-(leftPanelThickness+rightPanelThickness), width-(leftPanelThickness+rightPanelThickness), 0, frontBraceThickness,
		15, 15, 15, 15,
		0,
		0
		del 1

! REAR VERTICIAL BRACING MEMBER
		add leftPanelThickness, depth-(rearPanelThickness+rearBraceThickness), height-braceHeight	
		building_material buildingMat4, bForePen4, bBackPen4
		cwall_ mat10, mat11, mat12,
		braceHeight, 0, width-(leftPanelThickness+rightPanelThickness), width-(leftPanelThickness+rightPanelThickness), 0, rearBraceThickness,
		15, 15, 15, 15,
		0,
		0
		del 1
	endif

! SHELF

	if numShelf &amp;gt; 1 then

			add leftPanelThickness+0.002, doorPanelThickness+0.004, toeHeight
	
		for k= (height-toeHeight)/numShelf to (height-toeHeight)-(height-toeHeight)/numShelf step (height-toeHeight)/numShelf
			addz k
			building_material buildingMat5, bForePen5, bBackPen5
			cprism_ mat13, mat14, mat15,
       		5, adjustShelfThickness,
       		0, 0, 15,
       		width-(leftPanelThickness+0.002+0.002+rightPanelThickness), 0, 15,
       		width-(leftPanelThickness+0.002+0.002+rightPanelThickness), depth-(doorPanelThickness+0.002+0.002+0.002+rearPanelThickness), 15,
       		0, depth-(doorPanelThickness+0.002+0.002+0.002+rearPanelThickness), 15,
       		0, 0, 15
			del 1
		next k
	endif&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Aug 2019 01:13:40 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/GDL-For-Next-Loop-Issues/m-p/247699#M2029</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-09T01:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: GDL For... Next Loop Issues</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/GDL-For-Next-Loop-Issues/m-p/247700#M2030</link>
      <description>Just having a quick look at your code you might want to try this for the shelf.&lt;BR /&gt;
&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;k= (height-toeHeight)/numShelf to (height-toeHeight)-(height-toeHeight)/numShelf step (height-toeHeight)/numShelf

for count = 1 to numShelf 
addz k
.... shelf stuff
next count
DEL numShelf 
&lt;/PRE&gt;

&lt;BR /&gt;
Barry.</description>
      <pubDate>Fri, 09 Aug 2019 01:54:46 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/GDL-For-Next-Loop-Issues/m-p/247700#M2030</guid>
      <dc:creator>Barry Kelly</dc:creator>
      <dc:date>2019-08-09T01:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: GDL For... Next Loop Issues</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/GDL-For-Next-Loop-Issues/m-p/247701#M2031</link>
      <description>&lt;BLOCKQUOTE&gt;Barry wrote:&lt;BR /&gt;
Just having a quick look at your code you might want to try this for the shelf.&lt;BR /&gt;
&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;k= (height-toeHeight)/numShelf to (height-toeHeight)-(height-toeHeight)/numShelf step (height-toeHeight)/numShelf

for count = 1 to numShelf 
addz k
.... shelf stuff
next count
DEL numShelf 
&lt;/PRE&gt;

&lt;BR /&gt;
Barry.
&lt;/BLOCKQUOTE&gt;

Hello Barry,&lt;BR /&gt;
&lt;BR /&gt;
This is great, I will give this a go!&lt;BR /&gt;
&lt;BR /&gt;
Thanks for the pointers  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_cool.gif" style="display : inline;" /&gt; &lt;BR /&gt;
&lt;BR /&gt;
Jarrod</description>
      <pubDate>Fri, 09 Aug 2019 02:05:50 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/GDL-For-Next-Loop-Issues/m-p/247701#M2031</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-09T02:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: GDL For... Next Loop Issues</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/GDL-For-Next-Loop-Issues/m-p/247702#M2032</link>
      <description>&lt;BLOCKQUOTE&gt;Barry wrote:&lt;BR /&gt;
Just having a quick look at your code you might want to try this for the shelf.&lt;BR /&gt;
&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;k= (height-toeHeight)/numShelf to (height-toeHeight)-(height-toeHeight)/numShelf step (height-toeHeight)/numShelf

for count = 1 to numShelf 
addz k
.... shelf stuff
next count
DEL numShelf 
&lt;/PRE&gt;

&lt;BR /&gt;
Barry.
&lt;/BLOCKQUOTE&gt;

Hello Barry,&lt;BR /&gt;
&lt;BR /&gt;
I had a play around with your suggested code and with a little tinkering got it to work for me.&lt;BR /&gt;
&lt;BR /&gt;
My solution was as follows:&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;! SHELF

	if numShelf &amp;gt; 1 then

			add leftPanelThickness+0.002, doorPanelThickness+0.004, toeHeight

			k= (height-toeHeight)/numShelf
			for count = 1 to numShelf-1 
			addz k
			building_material buildingMat5, bForePen5, bBackPen5
			cprism_ mat13, mat14, mat15,
       		5, adjustShelfThickness,
       		0, 0, 15,
       		width-(leftPanelThickness+0.002+0.002+rightPanelThickness), 0, 15,
       		width-(leftPanelThickness+0.002+0.002+rightPanelThickness), depth-(doorPanelThickness+0.002+0.002+0.002+rearPanelThickness), 15,
       		0, depth-(doorPanelThickness+0.002+0.002+0.002+rearPanelThickness), 15,
       		0, 0, 15
			next count
			DEL numShelf

	endif&lt;/PRE&gt;

Thanks for you help!&lt;BR /&gt;
&lt;BR /&gt;
Jarrod.</description>
      <pubDate>Sat, 10 Aug 2019 07:26:07 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/GDL-For-Next-Loop-Issues/m-p/247702#M2032</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-10T07:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: GDL For... Next Loop Issues</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/GDL-For-Next-Loop-Issues/m-p/247703#M2033</link>
      <description>I am glad that you have this working.&lt;BR /&gt;
But a couple of things you may want to watch out for.&lt;BR /&gt;
&lt;BR /&gt;
You are counting from 1 to numShelf-1 and inside the loop you have one ADD command.&lt;BR /&gt;
However after the loop you are DEL-ing numShelf.&lt;BR /&gt;
So you are DEL-eting more than you have ADD-ed.&lt;BR /&gt;
This may cause problems if you have following script.&lt;BR /&gt;
&lt;BR /&gt;
Also if you are counting the base of the cabinet as shelf number 1, then the loop from 1 to numShelf-1 is fine, as you already have the base shelf and you don't want to add any more - you don't want to execute the loop.&lt;BR /&gt;
But if you are counting 1 shelf in the middle of the cabinet a 'one' shelf, then you will want to loop from 1 to numShelf.&lt;BR /&gt;
&lt;BR /&gt;
Barry.</description>
      <pubDate>Mon, 12 Aug 2019 01:57:20 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/GDL-For-Next-Loop-Issues/m-p/247703#M2033</guid>
      <dc:creator>Barry Kelly</dc:creator>
      <dc:date>2019-08-12T01:57:20Z</dc:date>
    </item>
  </channel>
</rss>

