<?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: Archicad crashes when using API_WallRelation in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Archicad-crashes-when-using-API-WallRelation/m-p/216837#M6363</link>
    <description>&lt;BLOCKQUOTE&gt;Andre wrote:&lt;BR /&gt; It seems to me that the pointer returned by wallRelation.conRef[1] is invalid for some reason. Is this a bug in the API or am I doing something wrong?&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;wallRelation.conRef&lt;E&gt;&lt;/E&gt; is a handle, so you need to first dereference the handle and then subscript into the item you need. So rather than this: &lt;PRE&gt;wallRelation.conRef[1]-&amp;gt;guid&lt;/PRE&gt;...you need to do this:&lt;PRE&gt;(*wallRelation.conRef)[1].guid&lt;/PRE&gt;</description>
    <pubDate>Mon, 16 Jan 2012 22:24:34 GMT</pubDate>
    <dc:creator>Ralph Wessel</dc:creator>
    <dc:date>2012-01-16T22:24:34Z</dc:date>
    <item>
      <title>Archicad crashes when using API_WallRelation</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Archicad-crashes-when-using-API-WallRelation/m-p/216836#M6362</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I'm developing an Add-on that generates some information from a selected wall. For that, I need information on the connections of a wall. I've been using the &lt;A href="http://www.graphisoft.com/ftp/techsupport/documentation/developer_docs/AC15/APIDevKit/APIHTMLLibrary/Structures/API_WallRelation.html" target="_blank" rel="noopener"&gt;API_WallRelation&lt;/A&gt; and, for the most part of the cases, everything works fine (conBeg, conEnd and con types of connection).&lt;BR /&gt;&lt;BR /&gt;But, for the highlighted wall on the attached image, I need to use the conRef type of connection (from docs: "walls connected with their reference line to the beginning or the end point of the wall"). In this case, the wall has two connections (one at the beginning and the other one at the end). When I access the second conRef connection, Archicad crashes. Here's the code:&lt;BR /&gt;
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;	API_WallRelation wallRelation;
	BNZeroMemory(&amp;amp;wallRelation, sizeof(API_WallRelation));
	ACAPI_Element_GetRelations(guid, API_WallID, (void*) &amp;amp;wallRelation);
	...
	if (wallRelation.nConRef == 2) {
		API_Element wallBegin;
		API_Element wallEnd;
		if (wallRelation.conRef[0]-&amp;gt;conWithBeg) {
			wallBegin = FindWall(wallRelation.conRef[0]-&amp;gt;guid);
			// Crashes here...
			wallEnd = FindWall(wallRelation.conRef[1]-&amp;gt;guid);
		} else {
			// Or Crashes here...
			wallBegin = FindWall(wallRelation.conRef[1]-&amp;gt;guid);
			wallEnd = FindWall(wallRelation.conRef[0]-&amp;gt;guid);
		}
		...
	}
&lt;/PRE&gt;
I've kept only the relevant parts of the code. It seems to me that the pointer returned by wallRelation.conRef[1] is invalid for some reason. Is this a bug in the API or am I doing something wrong?&lt;BR /&gt;&lt;BR /&gt;I'm using the API DevKit 14.2550 on macOS X 10.6.8.&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;/DIV&gt;&lt;BR /&gt;&lt;IMG src="http://community.graphisoft.com/t5/image/serverpage/image-id/67746iC0704DCEFE93DEF9/image-size/large?v=v2&amp;amp;px=999" border="0" alt="walls.png" title="walls.png" /&gt;</description>
      <pubDate>Wed, 02 Aug 2023 14:27:06 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Archicad-crashes-when-using-API-WallRelation/m-p/216836#M6362</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-08-02T14:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Archicad crashes when using API_WallRelation</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Archicad-crashes-when-using-API-WallRelation/m-p/216837#M6363</link>
      <description>&lt;BLOCKQUOTE&gt;Andre wrote:&lt;BR /&gt; It seems to me that the pointer returned by wallRelation.conRef[1] is invalid for some reason. Is this a bug in the API or am I doing something wrong?&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;wallRelation.conRef&lt;E&gt;&lt;/E&gt; is a handle, so you need to first dereference the handle and then subscript into the item you need. So rather than this: &lt;PRE&gt;wallRelation.conRef[1]-&amp;gt;guid&lt;/PRE&gt;...you need to do this:&lt;PRE&gt;(*wallRelation.conRef)[1].guid&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Jan 2012 22:24:34 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Archicad-crashes-when-using-API-WallRelation/m-p/216837#M6363</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2012-01-16T22:24:34Z</dc:date>
    </item>
  </channel>
</rss>

