<?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 Move several elements to mesh in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Move-several-elements-to-mesh/m-p/400136#M8626</link>
    <description>&lt;P&gt;I have a task to move elements down to mesh. I try to write a plugin, but i can't get all mesh polygons or vertices using API. I need it because I want to change the Z coordinate of other objects to move it closer to mesh. What else can I do? Or maybe is it a way to do what i want? I have tried to build structures&amp;nbsp;API_Element;API_ElementMemo;&amp;nbsp; using API_MeshID, but there is no information about polygons or vertices&lt;/P&gt;</description>
    <pubDate>Mon, 16 Sep 2024 12:45:57 GMT</pubDate>
    <dc:creator>tolltech</dc:creator>
    <dc:date>2024-09-16T12:45:57Z</dc:date>
    <item>
      <title>Move several elements to mesh</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Move-several-elements-to-mesh/m-p/400136#M8626</link>
      <description>&lt;P&gt;I have a task to move elements down to mesh. I try to write a plugin, but i can't get all mesh polygons or vertices using API. I need it because I want to change the Z coordinate of other objects to move it closer to mesh. What else can I do? Or maybe is it a way to do what i want? I have tried to build structures&amp;nbsp;API_Element;API_ElementMemo;&amp;nbsp; using API_MeshID, but there is no information about polygons or vertices&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 12:45:57 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Move-several-elements-to-mesh/m-p/400136#M8626</guid>
      <dc:creator>tolltech</dc:creator>
      <dc:date>2024-09-16T12:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: Move several elements to mesh</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Move-several-elements-to-mesh/m-p/400183#M8627</link>
      <description>&lt;P&gt;Hi tolltech!&lt;BR /&gt;&lt;BR /&gt;Maybe the &lt;A href="https://graphisoft.github.io/archicad-api-devkit/group___model_access.html" target="_self"&gt;ModelAccess API&lt;/A&gt; would help in your case.&lt;/P&gt;
&lt;P&gt;In the API there's also a related example called &lt;STRONG&gt;ModelAccess_Test&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For simple objects like walls and doors, I think it would be possible to derive the coordinates for a mesh from the information given in &lt;CODE&gt;API_Element&lt;/CODE&gt; and &lt;CODE&gt;API_ElementMemo&lt;/CODE&gt;.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Hope that helps!&lt;BR /&gt;Feel free to ask further if you get stuck.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 16:52:22 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Move-several-elements-to-mesh/m-p/400183#M8627</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2023-09-29T16:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: Move several elements to mesh</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Move-several-elements-to-mesh/m-p/401237#M8657</link>
      <description>&lt;P&gt;Sad, but i still cant solve my problem, i try to get several models, but i cant see usefull data inside. Maybe i should try use&amp;nbsp;ACAPI_ModelAccess_GetTextureCoord to determine z coordinate, but i cant understand what paramateres i should pass to this function. Please help i have no idea(&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My bad tries here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;&lt;LI-CODE lang="cpp"&gt;GS::Array&amp;lt;API_Guid&amp;gt; elemList;
ACAPI_Element_GetElemList(API_MeshID, &amp;amp;elemList, APIFilt_OnActFloor);

if (elemList.GetSize() &amp;gt; 0)
{
API_Element mesh = {};
API_ElementMemo  memo;
mesh.header.guid = elemList[0];
GSErrCode err = ACAPI_Element_Get(&amp;amp;mesh);

if (err != NoError)
return;

//https://archicadapi.graphisoft.com/documentation/api_gridmesh
if (mesh.header.hasMemo) {
err = ACAPI_Element_GetMemo(mesh.header.guid, &amp;amp;memo);
if (err != NoError) {
return;
}

//here deeper

ACAPI_DisposeElemMemoHdls(&amp;amp;memo);

API_ElemInfo3D mesh3D = {};

err = ACAPI_Element_Get3DInfo(mesh.header, &amp;amp;mesh3D);

if (err != NoError)
return;

API_Component3D          comp3D;
BNZeroMemory(&amp;amp;comp3D, sizeof(API_Component3D));
comp3D.header.index = 0;
comp3D.header.typeID = API_BodyID;
//err = ACAPI_ModelAccess_GetComponent(&amp;amp;comp3D); //compilation error

if (err != NoError)
return;
}
}&lt;/LI-CODE&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 08 Oct 2023 05:21:39 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Move-several-elements-to-mesh/m-p/401237#M8657</guid>
      <dc:creator>tolltech</dc:creator>
      <dc:date>2023-10-08T05:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: Move several elements to mesh</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Move-several-elements-to-mesh/m-p/401728#M8680</link>
      <description>&lt;P&gt;Sorry I've completely misunderstood your question before. I thought with "move down to mesh" you mean something like "convert to mesh".&lt;/P&gt;
&lt;P&gt;You actually want to get the z-coordinates from a mesh! You can use &lt;STRONG&gt;memo.meshPolyZ&lt;/STRONG&gt; for that. Here's a code example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;GS::Array&amp;lt;API_Guid&amp;gt; elemList;
ACAPI_Element_GetElemList (API_MeshID, &amp;amp;elemList, APIFilt_OnActFloor);

if (elemList.GetSize () &amp;gt; 0)
{
  API_Element mesh{};
  API_ElementMemo memo{};
  mesh.header.guid = elemList[0];
  GSErrCode err = ACAPI_Element_Get (&amp;amp;mesh);
  if (err != NoError) { return err; }

  //https://archicadapi.graphisoft.com/documentation/api_gridmesh
  if (mesh.header.hasMemo) {
    err = ACAPI_Element_GetMemo (mesh.header.guid, &amp;amp;memo);
    if (err != NoError) { return err; }

    ACAPI_WriteReport ("i: (x, y, z)", false);
    ACAPI_WriteReport ("------------", false);
    for (GS::Int32 i = 1; i &amp;lt;= mesh.mesh.poly.nCoords; ++i) {
      ACAPI_WriteReport ("%d: (%f, %f, %f): ", false, i, (*memo.coords)[i].x, (*memo.coords)[i].y, (*memo.meshPolyZ)[i]);
    }
  }
  ACAPI_DisposeElemMemoHdls (&amp;amp;memo);
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Be aware that the &lt;STRONG&gt;meshPolyZ&lt;/STRONG&gt; coordinates are relative to the mesh reference plane! So if you want the global z coordinate you also have to take &lt;STRONG&gt;element.header.level&lt;/STRONG&gt; and &lt;STRONG&gt;element.header.floor&lt;/STRONG&gt; into account.&lt;BR /&gt;&lt;BR /&gt;Hope that helps!&lt;BR /&gt;Bernd&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 06:10:08 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Move-several-elements-to-mesh/m-p/401728#M8680</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2023-10-10T06:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: Move several elements to mesh</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Move-several-elements-to-mesh/m-p/588465#M9168</link>
      <description>&lt;P&gt;Hello again!&lt;/P&gt;&lt;P&gt;Your code works, thanks a lot!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I want to change the Z coordiante of objects, i tried like this, but nothng happened&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;GSErrCode            err;
API_SelectionInfo    selectionInfo;
GS::Array&amp;lt;API_Neig&amp;gt;  selNeigs;

err = ACAPI_Selection_Get(&amp;amp;selectionInfo, &amp;amp;selNeigs, true);
BMKillHandle((GSHandle*)&amp;amp;selectionInfo.marquee.coords);

GS::Array&amp;lt;API_Guid&amp;gt; inds = GS::Array&amp;lt;API_Guid&amp;gt;();

if (selectionInfo.typeID != API_SelEmpty) 
{		
	for (const API_Neig&amp;amp; selNeig : selNeigs) {
		if (!ACAPI_Element_Filter(selNeig.guid, APIFilt_IsEditable))
			continue;

		API_Element element = {};
		element.header.guid = selNeig.guid;
		GSErrCode err = ACAPI_Element_Get(&amp;amp;element);
		if (err != NoError)
			continue;

		element.object.level = 0;

		ACAPI_Element_Change(&amp;amp;element, NULL, NULL, 0, true);
	}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Sorry I am newbie, but it is all I found in google.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also it is very strange that i see in selected objects. I select two objects, try to see element.object.level and see that the upper object has smaller value in this field&lt;/P&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 16 Feb 2024 11:10:14 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Move-several-elements-to-mesh/m-p/588465#M9168</guid>
      <dc:creator>tolltech</dc:creator>
      <dc:date>2024-02-16T11:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: Move several elements to mesh</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Move-several-elements-to-mesh/m-p/588593#M9170</link>
      <description>&lt;P&gt;You need to specify a mask for &lt;STRONG&gt;ACAPI_Element_Change&lt;/STRONG&gt; for the fields you want to change.&lt;/P&gt;
&lt;P&gt;So something like this should work (untested):&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;// .......

element.object.level = 0;

API_Element mask{};
ACAPI_ELEMENT_MASK_CLEAR (mask);
ACAPI_ELEMENT_MASK_SET (mask, API_ObjectType, level);

ACAPI_Element_Change(&amp;amp;element, &amp;amp;mask, NULL, 0, true);

// ......
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/78077"&gt;@tolltech&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Also it is very strange that i see in selected objects. I select two objects, try to see element.object.level and see that the upper object has smaller value in this field&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is likely due to the second object being placed on a different story. The field &lt;STRONG&gt;element.object.level&lt;/STRONG&gt; is relative to the story base line.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Hope that helps,&lt;BR /&gt;Bernd&lt;/P&gt;</description>
      <pubDate>Sat, 17 Feb 2024 12:18:35 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Move-several-elements-to-mesh/m-p/588593#M9170</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2024-02-17T12:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: Move several elements to mesh</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Move-several-elements-to-mesh/m-p/588788#M9175</link>
      <description>&lt;P&gt;I have tried this ones, but got the error&amp;nbsp;-2130312307 (or 7003)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;			API_Element mask{};
			ACAPI_ELEMENT_MASK_CLEAR(mask);
			ACAPI_ELEMENT_MASK_SET(mask, API_ObjectType, level);

			err = ACAPI_Element_Change(&amp;amp;element, &amp;amp;mask, NULL, 0, true);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;			API_Element mask{};
			ACAPI_ELEMENT_MASK_CLEAR(mask);
			ACAPI_ELEMENT_MASK_SET(mask, API_Element, object.level);

			err = ACAPI_Element_Change(&amp;amp;element, &amp;amp;mask, NULL, 0, true);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2024 14:27:58 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Move-several-elements-to-mesh/m-p/588788#M9175</guid>
      <dc:creator>tolltech</dc:creator>
      <dc:date>2024-02-19T14:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: Move several elements to mesh</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Move-several-elements-to-mesh/m-p/589041#M9176</link>
      <description>&lt;P&gt;You can check error codes here: &lt;A href="https://graphisoft.github.io/archicad-api-devkit/md__common_doxygen_files_2_articles_2_error___codes.html" target="_blank"&gt;https://graphisoft.github.io/archicad-api-devkit/md__common_doxygen_files_2_articles_2_error___codes.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The error you get is &lt;STRONG&gt;APIERR_NEEDSUNDOSCOPE&lt;/STRONG&gt;. So you need to wrap the above code into a &lt;A href="https://graphisoft.github.io/archicad-api-devkit/group___command.html#ga21a27f89223255c430223a51886e2bbd" target="_blank"&gt;ACAPI_CallUndoableCommand&lt;/A&gt; scope.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 15:28:19 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Move-several-elements-to-mesh/m-p/589041#M9176</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2024-02-20T15:28:19Z</dc:date>
    </item>
  </channel>
</rss>

