<?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 Help Please in Libraries &amp; objects</title>
    <link>https://community.graphisoft.com/t5/Libraries-objects/GDL-Help-Please/m-p/106402#M36285</link>
    <description>&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;!!Pipe Column
FOR k=1 to NUMOPC 
	HOTSPOT2 0, 0, hsid, X4PC&lt;K&gt;, 1 : hsid=hsid+1 !b 
	HOTSPOT2 X4PC&lt;K&gt;, 0, hsid, X4PC&lt;K&gt;, 2 : hsid=hsid+1 !m 
	HOTSPOT2 -1, 0, hsid, X4PC&lt;K&gt;, 3 : hsid=hsid+1 !r 
	
	ADD2 (PCT/2)*(-1),0
	RECT2 X4PC&lt;K&gt;,O,PCT+X4PC&lt;K&gt;,S2SF-SFT-HDRS	
	DEL TOP

	!!FOOTER
	SET FILL 6
	POLY2_B{2}       6,     7,      6,     91,  
			-1'-2",-ST, 1, 
			(-1'-2")+2",(ST+4")*(-1), 1, 
			(-1'-2")+2",(ST+4"+10")*(-1), 1, 
			(1'-2")-2",(ST+4"+10")*(-1), 1, 
			(1'-2")-2",(ST+4")*(-1), 1,
			1'-2",-ST,1,
			-1'-2",-ST,1
	
	PEN 91
	LINE2 -1'-2",-ST,1'-2",-ST
	PEN 2
	LINE2 (-1'-2")+2",(ST+4")*(-1),(1'-2")-2",(ST+4")*(-1)	

NEXT k &lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/PRE&gt;

&lt;BR /&gt;
First off thanks for the help on getting me this far. I'm starting to see the light at the end of the tunnel. Anyway the pipe column is working great as you can see above. Now I'm trying to add the footer which is the 2nd POLY2_B{2}  and the two LINE2. Will I need to reference all of their "X" values as a parameter plus add the &lt;K&gt; for them to follow the pipe column as I move it. Or am I going about it all wrong? See the attached picture.&lt;/K&gt;</description>
    <pubDate>Fri, 24 Jun 2005 13:22:13 GMT</pubDate>
    <dc:creator>Red</dc:creator>
    <dc:date>2005-06-24T13:22:13Z</dc:date>
    <item>
      <title>GDL Help Please</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/GDL-Help-Please/m-p/106397#M36280</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;R&gt;What I'm trying to do is multiple as many copies as I need of an 2D object (&lt;FONT color="#ff0048"&gt;rect2 0,0,2',2' &lt;/FONT&gt;) by an integer parameter. Could someone show me how I can do this. Also can each copy have a movable (SMART) hotspot in the middle allowing it to only move in the x axis. Would array be used in this process?&lt;/R&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 16 Jun 2005 15:15:34 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/GDL-Help-Please/m-p/106397#M36280</guid>
      <dc:creator>Red</dc:creator>
      <dc:date>2005-06-16T15:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: GDL Help Please</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/GDL-Help-Please/m-p/106398#M36281</link>
      <description>&lt;BLOCKQUOTE&gt;Red wrote:&lt;BR /&gt;What I'm trying to do is multiple as many copies as I need of an 2D object (&lt;FONT color="#ff0048"&gt;rect2 0,0,2',2' &lt;/FONT&gt;) by an integer parameter. &lt;/BLOCKQUOTE&gt;

FOR/NEXT loop. I assume the RECT2s need to be spaced out in some way.&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;FOR k=1 TO RedsIntegerParam
ADD2 (k-1)*x_spacing, (k-1)*y_spacing
RECT2 0,0,2',2'
DEL 1
NEXT k
&lt;/PRE&gt;

For an array multiply you need to nest another loop inside.&lt;BR /&gt;

&lt;BLOCKQUOTE&gt;Red wrote:&lt;BR /&gt;Also can each copy have a movable (SMART) hotspot in the middle allowing it to only move in the x axis. Would array be used in this process?&lt;/BLOCKQUOTE&gt;

In principle, yes. The array might be helpful/needed, or maybe not. 8-ball says, answer hazy, post screenshot.  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_biggrin.gif" style="display : inline;" /&gt;</description>
      <pubDate>Thu, 16 Jun 2005 16:25:52 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/GDL-Help-Please/m-p/106398#M36281</guid>
      <dc:creator>James Murray</dc:creator>
      <dc:date>2005-06-16T16:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: GDL Help Please</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/GDL-Help-Please/m-p/106399#M36282</link>
      <description>&lt;BLOCKQUOTE&gt;James wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;FOR k=1 TO RedsIntegerParam
ADD2 (k-1)*x_spacing, (k-1)*y_spacing
RECT2 0,0,2',2'
DEL 1
NEXT k
&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;

Is it possible to add something to this code for each of them to move independently?</description>
      <pubDate>Thu, 16 Jun 2005 17:25:44 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/GDL-Help-Please/m-p/106399#M36282</guid>
      <dc:creator>Red</dc:creator>
      <dc:date>2005-06-16T17:25:44Z</dc:date>
    </item>
    <item>
      <title>Re: GDL Help Please</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/GDL-Help-Please/m-p/106400#M36283</link>
      <description>&lt;BLOCKQUOTE&gt;Red wrote:&lt;BR /&gt;each of them to move independently?&lt;/BLOCKQUOTE&gt;

So we have a object made of some number of squares, each with its own offset from some origin, each position graphically editable. &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_question.gif" style="display : inline;" /&gt; &lt;BR /&gt;
&lt;BR /&gt;
For that you need an array. To edit the offset graphically, it needs to be a parameter, that means a parameter array. Since (I'm pretty sure) you can't have a dynamic parameter array, you'll need to pick number as a limit. It can be big. I don't know how big, it's more than 256.&lt;BR /&gt;
&lt;BR /&gt;
To make an array parameter click the button to the right of the parameter type (length, etc.) button. This opens the array values dialog. Since you only have one offset, you need just one column and some number of rows. Click the "1" button to the left of the top row, and then click insert however many times. OK. To change this later, don't click the array button again, click 'Set' at the top next to delete.&lt;BR /&gt;
&lt;BR /&gt;
(The number of rows will be the limit. I would also offer users a parameter for how many copies they actually want; tell them about the limit there.)&lt;BR /&gt;
&lt;BR /&gt;
Assuming each offset is from 0. Also assuming a hard-coded 2'x2' RECT2:&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;!Parameter: Qty is user's # of copies
!Array parameter: x_offset is offset distances

FOR k=1 to Qty
	HOTSPOT2 0, 0, hsid, x_offset&lt;K&gt;, 1 : hsid=hsid+1 !b
	HOTSPOT2 x_offset&lt;K&gt;, 0, hsid, x_offset&lt;K&gt;, 2 : hsid=hsid+1 !m
	HOTSPOT2 -1, 0, hsid, x_offset&lt;K&gt;, 3 : hsid=hsid+1 !r

	RECT2 x_offset&lt;K&gt;-1.0', -1.0', x_offset&lt;K&gt;+1.0', 1.0'
	!optional corner spots on rect2
	HOTSPOT2 x_offset&lt;K&gt;-1.0', -1.0'
	HOTSPOT2 x_offset&lt;K&gt;+1.0', -1.0'
	HOTSPOT2 x_offset&lt;K&gt;-1.0', 1.0'
	HOTSPOT2 x_offset&lt;K&gt;+1.0', 1.0'
NEXT k
&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/PRE&gt;

For each copy, it reads the value in the array in the slot numbered 'k' and builds everything from that.&lt;BR /&gt;
&lt;BR /&gt;
If you want default values in the array of other than zero, you need to put them in using the set button.&lt;BR /&gt;
&lt;BR /&gt;
If the squares all start at zero, the user doesn't know which one they're moving, but to me it wouldn't matter.&lt;BR /&gt;
&lt;BR /&gt;
The array parameter can be hidden. The user only needs to interact with it graphically IMO.&lt;BR /&gt;
&lt;BR /&gt;
Put in an error handler for the Qty: IF Qty&amp;gt;RedsArraySize THEN Qty= RedsArraySize. Note: RedsArraySize exists in your mind, it's not a variable.</description>
      <pubDate>Thu, 16 Jun 2005 18:40:49 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/GDL-Help-Please/m-p/106400#M36283</guid>
      <dc:creator>James Murray</dc:creator>
      <dc:date>2005-06-16T18:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: GDL Help Please</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/GDL-Help-Please/m-p/106401#M36284</link>
      <description>x_spacing and y_spacing would both need to be array variables.&lt;BR /&gt;
&lt;BR /&gt;
You will also need some way to define all those array values, probably stretchy hotspots.&lt;BR /&gt;
&lt;BR /&gt;
That would be:
&lt;PRE&gt; unID = 1
FOR k=1 TO RedsIntegerParam 
DIM x_spacing[], y_spacing[]    ! Define two dynamic arrays
HOTSPOT2		x_spacing&lt;K&gt;, 0, 		unID, y_spacing&lt;K&gt;, 1+128 : unID = unID +1
HOTSPOT2		x_spacing&lt;K&gt;, -1, 		unID, y_spacing&lt;K&gt;, 3 : unID = unID +1
HOTSPOT2		x_spacing&lt;K&gt;, y_spacing, 	unID, y_spacing&lt;K&gt;, 2 : unID = unID +1

HOTSPOT2		0, y_spacing&lt;K&gt;, 		unID, x_spacing&lt;K&gt;, 1+128 : unID = unID +1
HOTSPOT2		-1, y_spacing&lt;K&gt;, 		unID, x_spacing&lt;K&gt;, 3 : unID = unID +1
HOTSPOT2		x_spacing&lt;K&gt;, y_spacing&lt;K&gt;,	unID, x_spacing&lt;K&gt;, 2 : unID = unID +1
&amp;lt;the rest of your code&amp;gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Jun 2005 18:44:43 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/GDL-Help-Please/m-p/106401#M36284</guid>
      <dc:creator>TomWaltz</dc:creator>
      <dc:date>2005-06-16T18:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: GDL Help Please</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/GDL-Help-Please/m-p/106402#M36285</link>
      <description>&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;!!Pipe Column
FOR k=1 to NUMOPC 
	HOTSPOT2 0, 0, hsid, X4PC&lt;K&gt;, 1 : hsid=hsid+1 !b 
	HOTSPOT2 X4PC&lt;K&gt;, 0, hsid, X4PC&lt;K&gt;, 2 : hsid=hsid+1 !m 
	HOTSPOT2 -1, 0, hsid, X4PC&lt;K&gt;, 3 : hsid=hsid+1 !r 
	
	ADD2 (PCT/2)*(-1),0
	RECT2 X4PC&lt;K&gt;,O,PCT+X4PC&lt;K&gt;,S2SF-SFT-HDRS	
	DEL TOP

	!!FOOTER
	SET FILL 6
	POLY2_B{2}       6,     7,      6,     91,  
			-1'-2",-ST, 1, 
			(-1'-2")+2",(ST+4")*(-1), 1, 
			(-1'-2")+2",(ST+4"+10")*(-1), 1, 
			(1'-2")-2",(ST+4"+10")*(-1), 1, 
			(1'-2")-2",(ST+4")*(-1), 1,
			1'-2",-ST,1,
			-1'-2",-ST,1
	
	PEN 91
	LINE2 -1'-2",-ST,1'-2",-ST
	PEN 2
	LINE2 (-1'-2")+2",(ST+4")*(-1),(1'-2")-2",(ST+4")*(-1)	

NEXT k &lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/PRE&gt;

&lt;BR /&gt;
First off thanks for the help on getting me this far. I'm starting to see the light at the end of the tunnel. Anyway the pipe column is working great as you can see above. Now I'm trying to add the footer which is the 2nd POLY2_B{2}  and the two LINE2. Will I need to reference all of their "X" values as a parameter plus add the &lt;K&gt; for them to follow the pipe column as I move it. Or am I going about it all wrong? See the attached picture.&lt;/K&gt;</description>
      <pubDate>Fri, 24 Jun 2005 13:22:13 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/GDL-Help-Please/m-p/106402#M36285</guid>
      <dc:creator>Red</dc:creator>
      <dc:date>2005-06-24T13:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: GDL Help Please</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/GDL-Help-Please/m-p/106403#M36286</link>
      <description>Everything that you're repeating should relate to the offset parameter.&lt;BR /&gt;
&lt;BR /&gt;
It can become cumbersome to put in operations for the offset in every XY coord pair of the shapes. The alternative is to use a transformation of the offset distance instead.&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;FOR k=1 to Qty 
	HOTSPOT2 0, 0, hsid, x_offset&lt;K&gt;, 1 : hsid=hsid+1 !b 
	HOTSPOT2 x_offset&lt;K&gt;, 0, hsid, x_offset&lt;K&gt;, 2 : hsid=hsid+1 !m 
	HOTSPOT2 -1, 0, hsid, x_offset&lt;K&gt;, 3 : hsid=hsid+1 !r

		ADDx x_offset&lt;K&gt;

	RECT2 -1.0', -1.0', +1.0', 1.0' 
	!optional corner spots on rect2 
	HOTSPOT2 -1.0', -1.0' 
	HOTSPOT2 +1.0', -1.0' 
	HOTSPOT2 -1.0', 1.0' 
	HOTSPOT2 +1.0', 1.0' 

		DEL  1

NEXT k
&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/PRE&gt;

For each iteration:&lt;BR /&gt;
&lt;BR /&gt;
Do the hotspots for x_offset&lt;K&gt;.&lt;BR /&gt;
&lt;BR /&gt;
Move the origin to x_offset&lt;K&gt;. (ADDx)&lt;BR /&gt;
&lt;BR /&gt;
Draw the stuff.&lt;BR /&gt;
&lt;BR /&gt;
Go back to 0. (DEL 1)&lt;BR /&gt;
&lt;BR /&gt;
A couple more tips: Rather than typing 1'-2" over and over, create a variable. You can call it anything, I would call it X1. This is faster for AC to parse and easier for you to read/understand/change later. I would write your polygon like this:&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;X1=14"
X2=X1-2"
Y1=-ST
Y2=-(ST+4")
Y3=-(Y2+10")
POLY2_B{2}       6,     7,      6,     91,  
         -X1, Y1, 1, 
         -X2, Y2, 1, 
         -X2, Y3, 1, 
         X2, Y3, 1, 
         X2, Y2, 1, 
         X1, Y1, 1, 
         -X1, Y1, 1
&lt;/PRE&gt;

There's probably a typo in there but you get the idea. Also, use inches rather than feet &amp;amp; inches; faster parsing again. If you have fractions, convert them to decimals. (1.5" not 1 1/2")&lt;BR /&gt;
&lt;BR /&gt;
Don't use DEL TOP. The only place you can safely use it is at the very end of a script. Once you start doing more complexly structured scripts (subroutines, macros), DEL TOP will wreck your life. Always delete only the number you need to. You can get help keeping track of the transformation stack by using PRINT NTR(), which tells you the number of trans at that point in the script.&lt;/K&gt;&lt;/K&gt;</description>
      <pubDate>Fri, 24 Jun 2005 16:08:08 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/GDL-Help-Please/m-p/106403#M36286</guid>
      <dc:creator>James Murray</dc:creator>
      <dc:date>2005-06-24T16:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: GDL Help Please</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/GDL-Help-Please/m-p/106404#M36287</link>
      <description>I've gotten in the habit of using a variable: delNum.&lt;BR /&gt;
&lt;BR /&gt;
Whenever I start a new loop, I set delNum to 0.  Then I make compound statements, such as : ADD2 xOffset, yOffset : delNum = delNum + 1&lt;BR /&gt;
&lt;BR /&gt;
Then at the end of the loop, I DEL delNum&lt;BR /&gt;
&lt;BR /&gt;
This allows me to bury ADD, MUL and ROT statements inside loops anywhere, and DEL the proper varying number at the end.</description>
      <pubDate>Fri, 24 Jun 2005 18:36:50 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/GDL-Help-Please/m-p/106404#M36287</guid>
      <dc:creator>TomWaltz</dc:creator>
      <dc:date>2005-06-24T18:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: GDL Help Please</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/GDL-Help-Please/m-p/106405#M36288</link>
      <description>&lt;BLOCKQUOTE&gt;TomWaltz wrote:&lt;BR /&gt;I've gotten in the habit of using a variable: delNum.&lt;BR /&gt;
&lt;BR /&gt;
Whenever I start a new loop, I set delNum to 0.  Then I make compound statements, such as : ADD2 xOffset, yOffset : delNum = delNum + 1&lt;BR /&gt;
&lt;BR /&gt;
Then at the end of the loop, I DEL delNum&lt;BR /&gt;
&lt;BR /&gt;
This allows me to bury ADD, MUL and ROT statements inside loops anywhere, and DEL the proper varying number at the end.&lt;/BLOCKQUOTE&gt;
Tom,&lt;BR /&gt;
&lt;BR /&gt;
I seem to recognize the programmer spirit sleeping in you, but this is an interesting tip. &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt; &lt;BR /&gt;
Thank you for sharing!</description>
      <pubDate>Fri, 24 Jun 2005 19:29:34 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/GDL-Help-Please/m-p/106405#M36288</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-06-24T19:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: GDL Help Please</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/GDL-Help-Please/m-p/106406#M36289</link>
      <description>A similar trick is good for cutting. Every time you use a cutting command, increment a counter.&lt;BR /&gt;
&lt;BR /&gt;
CUTPLANE : cutz=cutz+1&lt;BR /&gt;
CUTPOLY yada yada&lt;BR /&gt;
cutz=cutz+1&lt;BR /&gt;
&lt;BR /&gt;
etc., then at the end,&lt;BR /&gt;
&lt;BR /&gt;
FOR k=1 TO cutz&lt;BR /&gt;
		CUTEND&lt;BR /&gt;
NEXT k&lt;BR /&gt;
&lt;BR /&gt;
I was thinking that counting the transformations isn't any better than using NTR(), but it is better, because in a macro you can have it delete only the local transformations.</description>
      <pubDate>Tue, 28 Jun 2005 18:17:37 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/GDL-Help-Please/m-p/106406#M36289</guid>
      <dc:creator>James Murray</dc:creator>
      <dc:date>2005-06-28T18:17:37Z</dc:date>
    </item>
  </channel>
</rss>

