<?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: [SOLVED] Parameters in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247915#M5445</link>
    <description>&lt;BLOCKQUOTE&gt;kzaremba wrote:&lt;BR /&gt;&lt;BLOCKQUOTE&gt;Ralph wrote:&lt;BR /&gt;GSSize parameterCount = BMGetHandleSize(getParams.params) / sizeof(API_AddParType);&lt;/BLOCKQUOTE&gt;
I have tried this part and got error:&lt;BR /&gt;
API_AddParType is not valid with GS::GSConstHandle&lt;/BLOCKQUOTE&gt;
The compiler only sees 2 different types that have no defined conversion. In this case we know they are actually the same thing, so the simplest solution (given that this part of the API is C) is to use a C-style cast:&lt;PRE&gt;GSSize parameterCount = BMGetHandleSize((GS::GSConstHandle) getParams.params) / sizeof(API_AddParType);&lt;/PRE&gt;

I wouldn't recommend that approach for C++, but the technique still exists for bridging to C in situations like this.</description>
    <pubDate>Tue, 20 Nov 2018 08:54:37 GMT</pubDate>
    <dc:creator>Ralph Wessel</dc:creator>
    <dc:date>2018-11-20T08:54:37Z</dc:date>
    <item>
      <title>[SOLVED] Parameters</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247907#M5437</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Could i get parameters using ACAPI_Element_Select. &lt;BR /&gt;F.e. get parameters from selected object and use these parameters for other object. I need hight, width, lenght, and position, probably sym_pos, or is there other way to get position? &lt;BR /&gt;&lt;BR /&gt;I hope this makes sense.&lt;/DIV&gt;</description>
      <pubDate>Tue, 01 Aug 2023 11:38:04 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247907#M5437</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-08-01T11:38:04Z</dc:date>
    </item>
    <item>
      <title>Re: Parameters</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247908#M5438</link>
      <description>&lt;BLOCKQUOTE&gt;New wrote:&lt;BR /&gt;Could i get parameters using ACAPI_Element_Select.  &lt;BR /&gt;
F.e. get parameters from selected object and use these parameters for other object. I need hight, width, lenght, and position, probably sym_pos, or is there other way to get position?&lt;/BLOCKQUOTE&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;ACAPI_Element_Select&lt;E&gt;&lt;/E&gt; gives you a list of indices to the selected elements. To retrieve the parameters from one of those indices, look at &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;APIAny_OpenParametersID&lt;E&gt;&lt;/E&gt; and &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;APIAny_GetActParametersID&lt;E&gt;&lt;/E&gt;. This will give you access to all the parameter including the A, B, and zzyzx, but that isn't necessarily the actual bounding size. It would be easier to use &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;APIDb_CalcBoundsID&lt;E&gt;&lt;/E&gt; for that purpose.&lt;BR /&gt;
&lt;BR /&gt;
The parameters do not contain the object position. You need to retrieve the other element settings through &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;ACAPI_Element_Get&lt;E&gt;&lt;/E&gt;. For an ordinary object, e.g. not a door/window, the 2D position is &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;API_ObjectType.pos&lt;E&gt;&lt;/E&gt;</description>
      <pubDate>Fri, 20 Feb 2015 11:46:57 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247908#M5438</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2015-02-20T11:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: Parameters</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247909#M5439</link>
      <description>Thanks for help Ralph.  &lt;BR /&gt;
&lt;BR /&gt;
Will try to make it work.</description>
      <pubDate>Fri, 20 Feb 2015 12:14:22 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247909#M5439</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-02-20T12:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: Parameters</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247910#M5440</link>
      <description>Haven't figured out how to get rest of the parameters, did get a and b. &lt;BR /&gt;
 &lt;BR /&gt;
API_AddParType and call parameter index ? or i could call by parameter name ?</description>
      <pubDate>Tue, 03 Mar 2015 14:21:06 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247910#M5440</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-03T14:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: Parameters</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247911#M5441</link>
      <description>As i understand getParams.params is a list of all the rest parameters how do i choose one of them ? &lt;BR /&gt;
 &lt;BR /&gt;
I belive this would be right approach but not sure how to go further... &lt;BR /&gt;
 
&lt;PRE&gt;    BNZeroMemory (&amp;amp;getParams, sizeof (API_GetParamsType));  
         err = ACAPI_Goodies (APIAny_GetActParametersID, &amp;amp;getParams, NULL);  
         if (err == NoError)  
         {  
            BNZeroMemory (&amp;amp;element, sizeof (API_Element));  
            BNZeroMemory (&amp;amp;memo, sizeof (API_ElementMemo));  
            element.header.typeID = API_ObjectID;  
            element.header.index = selectedInd;  
	    ACAPI_ELEMENT_MASK_CLEAR (mask);  
            memo.params = getParams.params; &lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Mar 2015 07:51:17 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247911#M5441</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-05T07:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: Parameters</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247912#M5442</link>
      <description>&lt;BLOCKQUOTE&gt;New wrote:&lt;BR /&gt;As i understand getParams.params is a list of all the rest parameters how do i choose one of them ?&lt;/BLOCKQUOTE&gt;
If you look at the structure of &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;API_GetParamsType&lt;E&gt;&lt;/E&gt;, you will see the the params member declared like this:&lt;PRE&gt;	API_AddParType					**params;&lt;/PRE&gt;
This means that params is a handle, or a pointer to a pointer. You could get the first parameter by simply dereferencing the handle twice, e.g. &lt;PRE&gt;API_AddParType firstParameter = **getParams.params;&lt;/PRE&gt;
But what you really want to do is access all the values. The easiest approach is to dereference the handle once and then treat the resulting pointer as an array, so the first parameter could also be expressed like this: &lt;PRE&gt;API_AddParType firstParameter = (*getParams.params)[0];&lt;/PRE&gt;
The nth parameter could be accessed like this: &lt;PRE&gt;API_AddParType nthParameter = (*getParams.params)&lt;N&gt;;&lt;/N&gt;&lt;/PRE&gt;
To determine how many parameters the handle contains, you want to divide the total amount of memory allocated to the handle by the size of a single parameter:&lt;PRE&gt;GSSize parameterCount = BMGetHandleSize(getParams.params) / sizeof(API_AddParType);&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Mar 2015 10:15:47 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247912#M5442</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2015-03-05T10:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Parameters</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247913#M5443</link>
      <description>Big thanks Ralph!!!&lt;BR /&gt;
&lt;BR /&gt;
I think i got it now, thanks. &lt;BR /&gt;
Will get right on it &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt;</description>
      <pubDate>Thu, 05 Mar 2015 10:22:16 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247913#M5443</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-03-05T10:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] Parameters</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247914#M5444</link>
      <description>&lt;BLOCKQUOTE&gt;Ralph wrote:&lt;BR /&gt;GSSize parameterCount = BMGetHandleSize(getParams.params) / sizeof(API_AddParType);&lt;/BLOCKQUOTE&gt;
I have tried this part and got error:&lt;BR /&gt;
API_AddParType is not valid with GS::GSConstHandle&lt;BR /&gt;
&lt;BR /&gt;
Why ?</description>
      <pubDate>Mon, 19 Nov 2018 23:26:46 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247914#M5444</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-19T23:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] Parameters</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247915#M5445</link>
      <description>&lt;BLOCKQUOTE&gt;kzaremba wrote:&lt;BR /&gt;&lt;BLOCKQUOTE&gt;Ralph wrote:&lt;BR /&gt;GSSize parameterCount = BMGetHandleSize(getParams.params) / sizeof(API_AddParType);&lt;/BLOCKQUOTE&gt;
I have tried this part and got error:&lt;BR /&gt;
API_AddParType is not valid with GS::GSConstHandle&lt;/BLOCKQUOTE&gt;
The compiler only sees 2 different types that have no defined conversion. In this case we know they are actually the same thing, so the simplest solution (given that this part of the API is C) is to use a C-style cast:&lt;PRE&gt;GSSize parameterCount = BMGetHandleSize((GS::GSConstHandle) getParams.params) / sizeof(API_AddParType);&lt;/PRE&gt;

I wouldn't recommend that approach for C++, but the technique still exists for bridging to C in situations like this.</description>
      <pubDate>Tue, 20 Nov 2018 08:54:37 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247915#M5445</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2018-11-20T08:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] Parameters</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247916#M5446</link>
      <description>&lt;BLOCKQUOTE&gt;Ralph wrote:&lt;BR /&gt; C in situations&lt;/BLOCKQUOTE&gt;

I see mysteries of C... &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_biggrin.gif" style="display : inline;" /&gt; Thanks a lot it's working!&lt;BR /&gt;
&lt;BR /&gt;
Why it used to work without casting before ?</description>
      <pubDate>Tue, 20 Nov 2018 20:59:52 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247916#M5446</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-20T20:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] Parameters</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247917#M5447</link>
      <description>&lt;BLOCKQUOTE&gt;kzaremba wrote:&lt;BR /&gt;Why it used to work without casting before ?&lt;/BLOCKQUOTE&gt;
It didn't necessarily –&amp;nbsp;I may have written that straight into the forum rather than a copy/paste from code. Can't be sure because C++ and the API are both constantly evolving, and old code won't necessarily compile in the future.</description>
      <pubDate>Wed, 21 Nov 2018 10:13:22 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247917#M5447</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2018-11-21T10:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] Parameters</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247918#M5448</link>
      <description>&lt;BLOCKQUOTE&gt;Ralph wrote:&lt;BR /&gt;
Can't be sure because C++ and the API &lt;/BLOCKQUOTE&gt;

So true &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_biggrin.gif" style="display : inline;" /&gt;  &lt;BR /&gt;
&lt;BR /&gt;
Anyway, I have put it inside a class and suddenly it's starting to crash again. I'm not sure why. Is putting it to the class changes handle somehow?</description>
      <pubDate>Thu, 22 Nov 2018 18:48:50 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247918#M5448</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-22T18:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] Parameters</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247919#M5449</link>
      <description>No, we've wrapped the whole API in classes without problems.</description>
      <pubDate>Thu, 22 Nov 2018 19:29:13 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247919#M5449</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2018-11-22T19:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: [SOLVED] Parameters</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247920#M5450</link>
      <description>Thanks Ralph. You made me double check and I forgot to initialize getParam in the constructor. Now it's working.</description>
      <pubDate>Thu, 22 Nov 2018 22:03:36 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SOLVED-Parameters/m-p/247920#M5450</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-22T22:03:36Z</dc:date>
    </item>
  </channel>
</rss>

