<?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: REF COMPONENT Property Script in Libraries &amp; objects</title>
    <link>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45176#M38804</link>
    <description>You need another ENDIF, Barry, or you need to move the REF statement onto the same line as your previous IF.&lt;BR /&gt;
&lt;BR /&gt;
Refer to the GDL manual for the syntax.  You can only omit the ENDIF for an IF that has a single statement immediately after the THEN (and thus also has no ELSE clause).&lt;BR /&gt;
&lt;BR /&gt;
IF expression THEN statement&lt;BR /&gt;
&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;&lt;BR /&gt;
or&lt;E&gt;&lt;/E&gt;&lt;BR /&gt;
&lt;BR /&gt;
IF expression THEN&lt;BR /&gt;
   group of statements&lt;BR /&gt;
[optional: ELSE / group of statements]&lt;BR /&gt;
ENDIF&lt;BR /&gt;
&lt;BR /&gt;
The key bit that I suppose was not obvious when you looked at the manual is that line breaks are often significant, as in this case.&lt;BR /&gt;
&lt;BR /&gt;
Karl</description>
    <pubDate>Fri, 18 Mar 2005 01:18:07 GMT</pubDate>
    <dc:creator>Karl Ottenstein</dc:creator>
    <dc:date>2005-03-18T01:18:07Z</dc:date>
    <item>
      <title>REF COMPONENT Property Script</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45167#M38795</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;R&gt;I have built a part that comprises of several beam sizes. I am trying to write another script that references a component that I created in the database library. The name of the component is "4x6x8 Spruce Beam" The Key Code is "80000" and the component code is "X31040608" I already have the value that I want to multiply by so I don't need to add it to the script. According to the Archicad help  this is what it looks like: &lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;"REF COMPONENT  code [, keycode [,&lt;BR /&gt;
                    numeric_expression]]&lt;BR /&gt;
&lt;BR /&gt;
Reference by code and keycode string to a component in an external database. The value to multiply by in the component database can be overwritten by the optional numeric expression specified here"&lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;
I have tried several different combinations with my numbers to get this script to work and can not figure out what I am doing wrong. See Below:&lt;BR /&gt;
&lt;BR /&gt;
IF beam_size='4x6' THEN&lt;BR /&gt;
IF a&amp;lt;8.00 THEN&lt;BR /&gt;
REF COMPONENT X31040608 , 80000&lt;BR /&gt;
ENDIF&lt;BR /&gt;
&lt;BR /&gt;
Everytime I run a check script I get an error, the one above requests a string type expression.&lt;BR /&gt;
&lt;BR /&gt;
Any help would be greatly appreciated. Thanks.&lt;BR /&gt;
&lt;BR /&gt;
Barry Halloran&lt;/R&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 16 Mar 2005 15:10:24 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45167#M38795</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-03-16T15:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: REF COMPONENT Property Script</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45168#M38796</link>
      <description>Hello&lt;BR /&gt;
&lt;BR /&gt;
Can you try this syntax :&lt;BR /&gt;
REF COMPONENT  X31040608 [, 80000 [, 1]]</description>
      <pubDate>Wed, 16 Mar 2005 16:28:08 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45168#M38796</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-03-16T16:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: REF COMPONENT Property Script</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45169#M38797</link>
      <description>FMR,&lt;BR /&gt;
&lt;BR /&gt;
I tried that before and it returns a Non-Declared index variable error. Thanks.&lt;BR /&gt;
&lt;BR /&gt;
Barry</description>
      <pubDate>Wed, 16 Mar 2005 16:36:42 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45169#M38797</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-03-16T16:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: REF COMPONENT Property Script</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45170#M38798</link>
      <description>I never work with components, but I think that the syntax is good but you need to declare your component somewhere.&lt;BR /&gt;
The GDL Documentation is not completely clear on this point. May be you should create and declare a Database set where are your components.&lt;BR /&gt;
&lt;BR /&gt;
Some "Master GDL scripter" can certainly help you more… &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_redface.gif" style="display : inline;" /&gt;</description>
      <pubDate>Wed, 16 Mar 2005 17:21:05 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45170#M38798</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-03-16T17:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: REF COMPONENT Property Script</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45171#M38799</link>
      <description>Thanks for your help.&lt;BR /&gt;
&lt;BR /&gt;
Barry</description>
      <pubDate>Wed, 16 Mar 2005 17:25:48 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45171#M38799</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-03-16T17:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: REF COMPONENT Property Script</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45172#M38800</link>
      <description>&lt;BLOCKQUOTE&gt;Barry wrote:&lt;BR /&gt;REF COMPONENT X31040608 , 80000&lt;/BLOCKQUOTE&gt;

Hi Barry,&lt;BR /&gt;
&lt;BR /&gt;
We're back to basic GDL syntax here:  X31040608 looks like a variable to GDL, and as an uninitialized variable, its value is zero (0).&lt;BR /&gt;
&lt;BR /&gt;
If these values are constants, as in your example, they must be in quotes since they are arbitrary text.  (Of course, if the code was inside a string parameter or variable, such as strCode, then of course strCode would not be in quotes ... because you want the value of that variable.)&lt;BR /&gt;
&lt;BR /&gt;
The following example works:&lt;BR /&gt;

&lt;PRE&gt;DATABASE_SET "AC_9_US"
REF COMPONENT "031-00000", "CSI.11"&lt;/PRE&gt;

But, note that "in real life" the DATABASE_SET command belongs in a MASTER_GDL script so that it is only executed once, unless you are pulling things from multiple databases.&lt;BR /&gt;
&lt;BR /&gt;
HTH,&lt;BR /&gt;
Karl&lt;BR /&gt;
&lt;BR /&gt;
PS  The above is just  for illustration purposes and assumes some logic around the REF COMPONENT, as in Barry's example.  If you just want to retrieve a component inside of an object, then use the user-friendly Components section of the GDL editor.&lt;BR /&gt;
&lt;BR /&gt;
Create a New entry, then use Link to Database Item to create a hard-coded link, like the first line int the screenshot.  All fields are locked, and match the database exactly.  If you create a new entry and do not link, then you have pop-up menus to choose the database, key, and enter a new or existing code and text, etc.  Probably not the greatest idea to do both since you could easily create conflicts with existing codes and names.&lt;BR /&gt;&lt;IMG src="https://community.graphisoft.com/t5/image/serverpage/image-id/10965i1E07CA173EE34F19/image-size/large?v=v2&amp;amp;px=999" border="0" alt="components.gif" title="components.gif" /&gt;</description>
      <pubDate>Wed, 16 Mar 2005 21:09:15 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45172#M38800</guid>
      <dc:creator>Karl Ottenstein</dc:creator>
      <dc:date>2005-03-16T21:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: REF COMPONENT Property Script</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45173#M38801</link>
      <description>Another P.S.&lt;BR /&gt;
&lt;BR /&gt;
Barry,&lt;BR /&gt;
&lt;BR /&gt;
I think you may end up looking at a huge number of IF/THEN statements to select your components if you have very many beam sizes and length combinations.  You may find that it is easier to use the various GDL string manipulation functions to "build" the database code from the input parameters, if you encode your beam information into the codes.&lt;BR /&gt;
&lt;BR /&gt;
Karl</description>
      <pubDate>Wed, 16 Mar 2005 21:35:49 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45173#M38801</guid>
      <dc:creator>Karl Ottenstein</dc:creator>
      <dc:date>2005-03-16T21:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: REF COMPONENT Property Script</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45174#M38802</link>
      <description>Karl,&lt;BR /&gt;
&lt;BR /&gt;
Thanks again for your knowledge. I will give it a shot and let you know the results. I am also taking your advice and looking into some GDL classes.&lt;BR /&gt;
&lt;BR /&gt;
Barry</description>
      <pubDate>Thu, 17 Mar 2005 03:19:41 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45174#M38802</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-03-17T03:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: REF COMPONENT Property Script</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45175#M38803</link>
      <description>Karl,&lt;BR /&gt;
&lt;BR /&gt;
That worked. My only problem now is similar to what I had before. I can't figure out why whenever I add a &amp;lt; statement the script fails. For example if the length of the beam:&lt;BR /&gt;
&lt;BR /&gt;
IF beam_size="4x6" THEN&lt;BR /&gt;
  IF A&amp;lt;8'-0" THEN&lt;BR /&gt;
REF COMPONENT "X31040608" , "80000" &lt;BR /&gt;
ENDIF&lt;BR /&gt;
&lt;BR /&gt;
The script works perfect without the nested IF statement. I must be missing something. Thanks for your help.&lt;BR /&gt;
&lt;BR /&gt;
Barry</description>
      <pubDate>Thu, 17 Mar 2005 03:41:54 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45175#M38803</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-03-17T03:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: REF COMPONENT Property Script</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45176#M38804</link>
      <description>You need another ENDIF, Barry, or you need to move the REF statement onto the same line as your previous IF.&lt;BR /&gt;
&lt;BR /&gt;
Refer to the GDL manual for the syntax.  You can only omit the ENDIF for an IF that has a single statement immediately after the THEN (and thus also has no ELSE clause).&lt;BR /&gt;
&lt;BR /&gt;
IF expression THEN statement&lt;BR /&gt;
&lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;&lt;BR /&gt;
or&lt;E&gt;&lt;/E&gt;&lt;BR /&gt;
&lt;BR /&gt;
IF expression THEN&lt;BR /&gt;
   group of statements&lt;BR /&gt;
[optional: ELSE / group of statements]&lt;BR /&gt;
ENDIF&lt;BR /&gt;
&lt;BR /&gt;
The key bit that I suppose was not obvious when you looked at the manual is that line breaks are often significant, as in this case.&lt;BR /&gt;
&lt;BR /&gt;
Karl</description>
      <pubDate>Fri, 18 Mar 2005 01:18:07 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45176#M38804</guid>
      <dc:creator>Karl Ottenstein</dc:creator>
      <dc:date>2005-03-18T01:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: REF COMPONENT Property Script</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45177#M38805</link>
      <description>Karl,&lt;BR /&gt;
&lt;BR /&gt;
After some work on it, I finally figured out that I had missed that endif statement. Thanks again for your help. Maybe once i get more advanced I will rewrite the script as you had previously suggested, it is very long but it works.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Barry</description>
      <pubDate>Fri, 18 Mar 2005 12:09:27 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45177#M38805</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-03-18T12:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: REF COMPONENT Property Script</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45178#M38806</link>
      <description>Karl,&lt;BR /&gt;
&lt;BR /&gt;
Just an update to the script. I have evolved what you had shown me and added a few thinsg to it. By using if then statements I have made the part even more intuitive, I added calculations using gdl global parameters to the REF COMPONANT command. See Below:&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;IF joist_size="2x4 Blocking" THEN&lt;BR /&gt;
REF COMPONENT "X40020416" , "200" , (((SYMB_A_SIZE*3.2808)/16)*1.10)&lt;BR /&gt;
ENDI&lt;/B&gt;F &lt;BR /&gt;
&lt;BR /&gt;
The above script calculates the 2x4x16 Blocking the 1.10 is to add a 10% overage. Granted the script may not be efficient but it works. If I am able to figure out how to string script, I will go back and rewrite it. This command has made a HUGE difference in the way I will build parts for my Bill of Materials, I am able to take a lot of the responsibility off of the "Drafter" and put it in the program. Thanks again.&lt;BR /&gt;
&lt;BR /&gt;
Barry</description>
      <pubDate>Fri, 18 Mar 2005 23:52:42 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45178#M38806</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-03-18T23:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: REF COMPONENT Property Script</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45179#M38807</link>
      <description>Thanks, Barry.  Glad I could help.&lt;BR /&gt;
&lt;BR /&gt;
Karl</description>
      <pubDate>Sat, 19 Mar 2005 03:31:08 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/REF-COMPONENT-Property-Script/m-p/45179#M38807</guid>
      <dc:creator>Karl Ottenstein</dc:creator>
      <dc:date>2005-03-19T03:31:08Z</dc:date>
    </item>
  </channel>
</rss>

