<?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: Creating Hole In Slab in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-Hole-In-Slab/m-p/237192#M2899</link>
    <description>The polygon structure in a memo is quite messy. Note that the vertices of the outer perimeter precede any hole vertices (which I suspect is the problem in this case). For detailed documentation about API_Polygon and the associated memo, look at the documentation here: &lt;A href="http://archicadapi.graphisoft.com/documentation/api_polygon" target="_blank"&gt;&lt;LINK_TEXT text="http://archicadapi.graphisoft.com/docum ... pi_polygon"&gt;http://archicadapi.graphisoft.com/documentation/api_polygon&lt;/LINK_TEXT&gt;&lt;/A&gt;</description>
    <pubDate>Tue, 14 Apr 2020 21:24:39 GMT</pubDate>
    <dc:creator>Ralph Wessel</dc:creator>
    <dc:date>2020-04-14T21:24:39Z</dc:date>
    <item>
      <title>Creating Hole In Slab</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-Hole-In-Slab/m-p/237191#M2898</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hello,&lt;BR /&gt;i'm trying to use ACAPI_Element_ChangeMemo in order to create a hole in my slab. for some reason, i always get a APIERR_BAPARS error for some reason.&lt;BR /&gt;&lt;BR /&gt;i tried using the hole creation example in the Element_Test, but it showed the same error. here is my code:&lt;BR /&gt;
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;void Shtuiot::Do_CreateSlabHole(API_Guid SlabG, API_Guid stairG)
{
	API_Element stair, slab;
	BNZeroMemory(&amp;amp;stair, sizeof(API_Element));
	BNZeroMemory(&amp;amp;slab, sizeof(API_Element));
	slab.header.guid = SlabG;
	stair.header.guid = stairG;
	GSErrCode err = ACAPI_Element_Get(&amp;amp;slab);
	err = ACAPI_Element_Get(&amp;amp;stair);
	API_ElementMemo slabMemo;
	BNZeroMemory(&amp;amp;slabMemo, sizeof(API_ElementMemo));
	err = ACAPI_Element_GetMemo(slab.header.guid, &amp;amp;slabMemo);
	API_Box3D box3D;
	BNZeroMemory(&amp;amp;box3D, sizeof(API_Box3D));
	err = ACAPI_Database(APIDb_CalcBoundsID, &amp;amp;stair.header, &amp;amp;box3D);
	API_Coord A, B, C, D;
	A.x = box3D.xMin;
	A.y = box3D.yMin;
	B.x = box3D.xMax;
	B.y = box3D.yMin;
	C.x = box3D.xMax;
	C.y = box3D.yMax;
	D.x = box3D.xMin;
	D.y = box3D.yMax;

	API_Element poly;
	BNZeroMemory(&amp;amp;poly, sizeof(API_Element));

	poly.header.typeID = API_MeshID;
	API_ElementMemo pmemo;
	BNZeroMemory(&amp;amp;pmemo, sizeof(API_ElementMemo));
	err = ACAPI_Element_GetDefaults(&amp;amp;poly, &amp;amp;pmemo);
	if (err != NoError) {
		ErrorBeep("ACAPI_Element_GetDefaults (Polyline)", err);
		return;
	}

	poly.mesh.poly.nCoords = 5;
	poly.mesh.poly.nSubPolys = 1;
	poly.mesh.poly.nArcs = 0;
	pmemo.coords = (API_Coord**)BMAllocateHandle((poly.mesh.poly.nCoords + 1) * sizeof(API_Coord), ALLOCATE_CLEAR, 0);
	pmemo.pends = (Int32**)BMAllocateHandle((poly.mesh.poly.nSubPolys + 1) * sizeof(Int32), ALLOCATE_CLEAR, 0);

	(*pmemo.pends)[0] = 0;
	(*pmemo.pends)[1] = 5;

	(*pmemo.coords)[0].x = 0.0;
	(*pmemo.coords)[0].y = 0.0;
	(*pmemo.coords)[1] = A;
	(*pmemo.coords)[2] = B;
	(*pmemo.coords)[3] = C;
	(*pmemo.coords)[4] = D;
	(*pmemo.coords)[5] = A;


	err = ACAPI_Goodies(APIAny_InsertSubPolyID, &amp;amp;slabMemo, &amp;amp;pmemo);
	if (err == NoError) {
		API_ElementMemo tmpMemo;
		BNZeroMemory(&amp;amp;tmpMemo, sizeof(API_ElementMemo));
		tmpMemo.coords = slabMemo.coords;
		tmpMemo.pends = slabMemo.pends;
		tmpMemo.parcs = slabMemo.parcs;
		tmpMemo.vertexIDs = slabMemo.vertexIDs;
		tmpMemo.meshPolyZ = slabMemo.meshPolyZ;
		tmpMemo.edgeIDs = slabMemo.edgeIDs;
		tmpMemo.edgeTrims = slabMemo.edgeTrims;
		tmpMemo.contourIDs = slabMemo.contourIDs;
		err = ACAPI_CallUndoableCommand("Delete Poly", [&amp;amp;]() -&amp;gt; GSErrCode {
			return ACAPI_Element_ChangeMemo(slab.header.guid, APIMemoMask_Polygon, &amp;amp;slabMemo); });
		if (err != NoError)
			ErrorBeep("ACAPI_Element_ChangeMemo", err);
	}
	else
		ErrorBeep("APIAny_InsertSubPolyID", err);

	ACAPI_DisposeElemMemoHdls(&amp;amp;pmemo);
	ACAPI_DisposeElemMemoHdls(&amp;amp;slabMemo);


}

&lt;/PRE&gt;
Would really appreciate some help!&lt;BR /&gt;&lt;BR /&gt;Thank you &lt;IMG style="display: inline;" src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" border="0" /&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 15 Sep 2021 09:53:01 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-Hole-In-Slab/m-p/237191#M2898</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-15T09:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Hole In Slab</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-Hole-In-Slab/m-p/237192#M2899</link>
      <description>The polygon structure in a memo is quite messy. Note that the vertices of the outer perimeter precede any hole vertices (which I suspect is the problem in this case). For detailed documentation about API_Polygon and the associated memo, look at the documentation here: &lt;A href="http://archicadapi.graphisoft.com/documentation/api_polygon" target="_blank"&gt;&lt;LINK_TEXT text="http://archicadapi.graphisoft.com/docum ... pi_polygon"&gt;http://archicadapi.graphisoft.com/documentation/api_polygon&lt;/LINK_TEXT&gt;&lt;/A&gt;</description>
      <pubDate>Tue, 14 Apr 2020 21:24:39 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-Hole-In-Slab/m-p/237192#M2899</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2020-04-14T21:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Hole In Slab</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-Hole-In-Slab/m-p/237193#M2900</link>
      <description>Hi Ralph,&lt;BR /&gt;
I'm aware of the messiness of the polygon inside the memo. I've read this document carefully a few times &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_smile.gif" style="display : inline;" /&gt;&lt;BR /&gt;
in order to maintain the necessary logic inside the polygon, i used APIAny_​InsertSubPolyID, which doesn't return any error. That's why i thought all the polygon-related issues are not a problem. How can i make sure that the outer vertices precede the inner ones? is there an alternative to this goodies function?&lt;BR /&gt;
Thanks!</description>
      <pubDate>Wed, 15 Apr 2020 11:29:34 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-Hole-In-Slab/m-p/237193#M2900</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-15T11:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Hole In Slab</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-Hole-In-Slab/m-p/237194#M2901</link>
      <description>How can i do this correctly?</description>
      <pubDate>Wed, 22 Apr 2020 11:07:04 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-Hole-In-Slab/m-p/237194#M2901</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-22T11:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Hole In Slab</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-Hole-In-Slab/m-p/237195#M2902</link>
      <description>There's some code for this in the &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;Do_Poly_NewHole&lt;E&gt;&lt;/E&gt; function of the example project &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;Element_Test&lt;E&gt;&lt;/E&gt;. I can't comment specifically on this problem because we've written a C++ polygon class to simplify coding and only convert to/from the API memo structure on an as-need basis.</description>
      <pubDate>Wed, 22 Apr 2020 11:31:22 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-Hole-In-Slab/m-p/237195#M2902</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2020-04-22T11:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Hole In Slab</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Creating-Hole-In-Slab/m-p/237196#M2903</link>
      <description>I also need the APIAny_InsertSubPolyID function to be working on the slabs and roofs.&lt;BR /&gt;
&lt;BR /&gt;
I have tested the example in the Element Test API. I can only make it work on the Fill Element. &lt;BR /&gt;
When I tried on Slab or Roof Elements, they all returned APIERR_BADPARS.&lt;BR /&gt;
&lt;BR /&gt;
May be the function is not working properly yet!</description>
      <pubDate>Mon, 25 May 2020 04:43:07 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Creating-Hole-In-Slab/m-p/237196#M2903</guid>
      <dc:creator>Hoa Tu</dc:creator>
      <dc:date>2020-05-25T04:43:07Z</dc:date>
    </item>
  </channel>
</rss>

