<?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 Problem of using ACAPI_Element_Edit on DetailElement in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Problem-of-using-ACAPI-Element-Edit-on-DetailElement/m-p/126647#M6122</link>
    <description>&lt;DIV class="actalk-migrated-content"&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;We attached door and detail after creating detailElement using
&lt;PRE&gt;err = ACAPI_Element_Create(&amp;amp;detailElement, &amp;amp;memo);
if(err == noErr)
{
	GSFlags flags = EDITELEMS | DELETEELEMS;
	err = ACAPI_Element_Link(doorElement.header.guid, detailElement.header.guid, flags);
	if(err != noErr)
		GiveMsg_Err("Problem createing link in InsertDetail().\n\nPlease see your CAD Supervisor.\n", err);
}&lt;/PRE&gt;
detailElement is created and liked without errors.&lt;BR /&gt;If I draged my door element I am trying to drag detail element useing fallowing code.
&lt;PRE&gt;GSErrCode DoEditElement(API_Guid paramsUNotifyGuid, API_ElemTypeID paramsUNotifyTypeID)
{
API_ActTranPars actTranPars;
API_EditPars editPars;
	switch (paramsUNotifyTypeID)
	{
	case API_DoorID:
		err = ACAPI_Element_GetLinks (element.header.guid, &amp;amp;linkGuids, &amp;amp;nLinks);
		if(err == noErr &amp;amp;&amp;amp; !(linkGuids == NULL || nLinks == 0))
		{
			ACAPI_Notify_GetTranParams (&amp;amp;actTranPars);
			ActTranPars_To_EditPars (&amp;amp;actTranPars, &amp;amp;editPars);
			API_Elem_Head**	elemHeadHdl = NULL;
			err = ACAPI_Database (APIDb_GuidToElemHeadID, (void*) linkGuids, (void*) &amp;amp;elemHeadHdl);
			if (err == noErr &amp;amp;&amp;amp; elemHeadHdl != NULL) 
			{
				API_Neig**	neigHdl = reinterpret_cast&amp;lt;API_Neig**&amp;gt; (BMAllocateHandle (nLinks * sizeof (API_Neig), ALLOCATE_CLEAR, 0));
				if (neigHdl == NULL)
					return APIERR_MEMFULL;

				for (GSIndex index = 0; index &amp;lt; nLinks; index++) 
				{
					ElemHead_To_Neig ((*neigHdl) + index, (*elemHeadHdl) + index);
				}

				err = ACAPI_Element_Edit (neigHdl, nLinks, &amp;amp;editPars); // noErrors
				BMKillHandle (reinterpret_cast&amp;lt;GSHandle*&amp;gt; (&amp;amp;elemHeadHdl));
				BMKillHandle (reinterpret_cast&amp;lt;GSHandle*&amp;gt; (&amp;amp;neigHdl));
			}
		}
	}
}
bool ActTranPars_To_EditPars(const API_ActTranPars *actTranPars, API_EditPars *editPars)
{
	BNZeroMemory (editPars, sizeof (API_EditPars));
	editPars-&amp;gt;withDelete = true;
	editPars-&amp;gt;typeID = (API_EditCmdID) 0;

	switch (actTranPars-&amp;gt;typeID) {
		case APIEdit_Drag:
			editPars-&amp;gt;typeID = APIEdit_Drag;
			editPars-&amp;gt;endC.x = actTranPars-&amp;gt;theDisp.x;
			editPars-&amp;gt;endC.y = actTranPars-&amp;gt;theDisp.y;
			editPars-&amp;gt;endC.z = actTranPars-&amp;gt;theDispZ;
			break;
		case APIEdit_Rotate:
			editPars-&amp;gt;typeID = APIEdit_Rotate;
			editPars-&amp;gt;origC = actTranPars-&amp;gt;theOrigo;
			editPars-&amp;gt;begC.x = editPars-&amp;gt;origC.x + 1.0;
			editPars-&amp;gt;begC.y = editPars-&amp;gt;origC.y;
			editPars-&amp;gt;endC.x = editPars-&amp;gt;origC.x + actTranPars-&amp;gt;theCosA;
			editPars-&amp;gt;endC.y = editPars-&amp;gt;origC.y + actTranPars-&amp;gt;theSinA;
			break;
		case APIEdit_Mirror:
			editPars-&amp;gt;typeID = APIEdit_Mirror;
			editPars-&amp;gt;begC.x = actTranPars-&amp;gt;theOrigo.x;
			editPars-&amp;gt;begC.y = actTranPars-&amp;gt;theOrigo.y;
			editPars-&amp;gt;endC.x = actTranPars-&amp;gt;theOrigo.x + actTranPars-&amp;gt;theAxeVect.x;
			editPars-&amp;gt;endC.y = actTranPars-&amp;gt;theOrigo.y + actTranPars-&amp;gt;theAxeVect.y;
			break;
		case APIEdit_Stretch:
			editPars-&amp;gt;typeID = APIEdit_Stretch;
			editPars-&amp;gt;begC.x = actTranPars-&amp;gt;theOrigo.x;
			editPars-&amp;gt;begC.y = actTranPars-&amp;gt;theOrigo.y;
			editPars-&amp;gt;endC.x = actTranPars-&amp;gt;theOrigo.x + actTranPars-&amp;gt;theDisp.x;
			editPars-&amp;gt;endC.y = actTranPars-&amp;gt;theOrigo.y + actTranPars-&amp;gt;theDisp.y;
			break;
		case APIEdit_PDirStretch:
			editPars-&amp;gt;typeID = APIEdit_PDirStretch;
			editPars-&amp;gt;begC.x = actTranPars-&amp;gt;theOrigo.x;
			editPars-&amp;gt;begC.y = actTranPars-&amp;gt;theOrigo.y;
			editPars-&amp;gt;endC.x = actTranPars-&amp;gt;theOrigo.x + actTranPars-&amp;gt;theDisp.x;
			editPars-&amp;gt;endC.y = actTranPars-&amp;gt;theOrigo.y + actTranPars-&amp;gt;theDisp.y;
			break;
		case APIEdit_PHeightStretch:
			editPars-&amp;gt;typeID = APIEdit_PHeightStretch;
			editPars-&amp;gt;begC.x = actTranPars-&amp;gt;theOrigo.x;
			editPars-&amp;gt;begC.y = actTranPars-&amp;gt;theOrigo.y;
			editPars-&amp;gt;endC.x = actTranPars-&amp;gt;theOrigo.x + actTranPars-&amp;gt;theDisp.x;
			editPars-&amp;gt;endC.y = actTranPars-&amp;gt;theOrigo.y + actTranPars-&amp;gt;theDisp.y;
			break;
		case APIEdit_Resize:
			editPars-&amp;gt;typeID = APIEdit_Resize;
			editPars-&amp;gt;begC.x = actTranPars-&amp;gt;theOrigo.x;
			editPars-&amp;gt;begC.y = actTranPars-&amp;gt;theOrigo.y;
			editPars-&amp;gt;endC.x = actTranPars-&amp;gt;theOrigo.x + 1;
			editPars-&amp;gt;endC.y = actTranPars-&amp;gt;theOrigo.y;
			editPars-&amp;gt;endC2.x = actTranPars-&amp;gt;theOrigo.x + actTranPars-&amp;gt;theRatio;
			editPars-&amp;gt;endC2.y = actTranPars-&amp;gt;theOrigo.y;
			break;
		case APIEdit_Elevate:
			editPars-&amp;gt;typeID = APIEdit_Elevate;
			editPars-&amp;gt;endC.z = actTranPars-&amp;gt;theDispZ;
			break;
		case APIEdit_VertStretch:
			editPars-&amp;gt;typeID = APIEdit_VertStretch;
			editPars-&amp;gt;endC.z = actTranPars-&amp;gt;theDispZ;
			break;
	}

	return editPars-&amp;gt;typeID != (API_EditCmdID) 0;
}&lt;/PRE&gt;
But at the end detail is not moving on the plan.&lt;BR /&gt;Please any one give me what went wrong?&lt;/DIV&gt;</description>
    <pubDate>Thu, 03 Aug 2023 08:52:09 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-08-03T08:52:09Z</dc:date>
    <item>
      <title>Problem of using ACAPI_Element_Edit on DetailElement</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Problem-of-using-ACAPI-Element-Edit-on-DetailElement/m-p/126647#M6122</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;We attached door and detail after creating detailElement using
&lt;PRE&gt;err = ACAPI_Element_Create(&amp;amp;detailElement, &amp;amp;memo);
if(err == noErr)
{
	GSFlags flags = EDITELEMS | DELETEELEMS;
	err = ACAPI_Element_Link(doorElement.header.guid, detailElement.header.guid, flags);
	if(err != noErr)
		GiveMsg_Err("Problem createing link in InsertDetail().\n\nPlease see your CAD Supervisor.\n", err);
}&lt;/PRE&gt;
detailElement is created and liked without errors.&lt;BR /&gt;If I draged my door element I am trying to drag detail element useing fallowing code.
&lt;PRE&gt;GSErrCode DoEditElement(API_Guid paramsUNotifyGuid, API_ElemTypeID paramsUNotifyTypeID)
{
API_ActTranPars actTranPars;
API_EditPars editPars;
	switch (paramsUNotifyTypeID)
	{
	case API_DoorID:
		err = ACAPI_Element_GetLinks (element.header.guid, &amp;amp;linkGuids, &amp;amp;nLinks);
		if(err == noErr &amp;amp;&amp;amp; !(linkGuids == NULL || nLinks == 0))
		{
			ACAPI_Notify_GetTranParams (&amp;amp;actTranPars);
			ActTranPars_To_EditPars (&amp;amp;actTranPars, &amp;amp;editPars);
			API_Elem_Head**	elemHeadHdl = NULL;
			err = ACAPI_Database (APIDb_GuidToElemHeadID, (void*) linkGuids, (void*) &amp;amp;elemHeadHdl);
			if (err == noErr &amp;amp;&amp;amp; elemHeadHdl != NULL) 
			{
				API_Neig**	neigHdl = reinterpret_cast&amp;lt;API_Neig**&amp;gt; (BMAllocateHandle (nLinks * sizeof (API_Neig), ALLOCATE_CLEAR, 0));
				if (neigHdl == NULL)
					return APIERR_MEMFULL;

				for (GSIndex index = 0; index &amp;lt; nLinks; index++) 
				{
					ElemHead_To_Neig ((*neigHdl) + index, (*elemHeadHdl) + index);
				}

				err = ACAPI_Element_Edit (neigHdl, nLinks, &amp;amp;editPars); // noErrors
				BMKillHandle (reinterpret_cast&amp;lt;GSHandle*&amp;gt; (&amp;amp;elemHeadHdl));
				BMKillHandle (reinterpret_cast&amp;lt;GSHandle*&amp;gt; (&amp;amp;neigHdl));
			}
		}
	}
}
bool ActTranPars_To_EditPars(const API_ActTranPars *actTranPars, API_EditPars *editPars)
{
	BNZeroMemory (editPars, sizeof (API_EditPars));
	editPars-&amp;gt;withDelete = true;
	editPars-&amp;gt;typeID = (API_EditCmdID) 0;

	switch (actTranPars-&amp;gt;typeID) {
		case APIEdit_Drag:
			editPars-&amp;gt;typeID = APIEdit_Drag;
			editPars-&amp;gt;endC.x = actTranPars-&amp;gt;theDisp.x;
			editPars-&amp;gt;endC.y = actTranPars-&amp;gt;theDisp.y;
			editPars-&amp;gt;endC.z = actTranPars-&amp;gt;theDispZ;
			break;
		case APIEdit_Rotate:
			editPars-&amp;gt;typeID = APIEdit_Rotate;
			editPars-&amp;gt;origC = actTranPars-&amp;gt;theOrigo;
			editPars-&amp;gt;begC.x = editPars-&amp;gt;origC.x + 1.0;
			editPars-&amp;gt;begC.y = editPars-&amp;gt;origC.y;
			editPars-&amp;gt;endC.x = editPars-&amp;gt;origC.x + actTranPars-&amp;gt;theCosA;
			editPars-&amp;gt;endC.y = editPars-&amp;gt;origC.y + actTranPars-&amp;gt;theSinA;
			break;
		case APIEdit_Mirror:
			editPars-&amp;gt;typeID = APIEdit_Mirror;
			editPars-&amp;gt;begC.x = actTranPars-&amp;gt;theOrigo.x;
			editPars-&amp;gt;begC.y = actTranPars-&amp;gt;theOrigo.y;
			editPars-&amp;gt;endC.x = actTranPars-&amp;gt;theOrigo.x + actTranPars-&amp;gt;theAxeVect.x;
			editPars-&amp;gt;endC.y = actTranPars-&amp;gt;theOrigo.y + actTranPars-&amp;gt;theAxeVect.y;
			break;
		case APIEdit_Stretch:
			editPars-&amp;gt;typeID = APIEdit_Stretch;
			editPars-&amp;gt;begC.x = actTranPars-&amp;gt;theOrigo.x;
			editPars-&amp;gt;begC.y = actTranPars-&amp;gt;theOrigo.y;
			editPars-&amp;gt;endC.x = actTranPars-&amp;gt;theOrigo.x + actTranPars-&amp;gt;theDisp.x;
			editPars-&amp;gt;endC.y = actTranPars-&amp;gt;theOrigo.y + actTranPars-&amp;gt;theDisp.y;
			break;
		case APIEdit_PDirStretch:
			editPars-&amp;gt;typeID = APIEdit_PDirStretch;
			editPars-&amp;gt;begC.x = actTranPars-&amp;gt;theOrigo.x;
			editPars-&amp;gt;begC.y = actTranPars-&amp;gt;theOrigo.y;
			editPars-&amp;gt;endC.x = actTranPars-&amp;gt;theOrigo.x + actTranPars-&amp;gt;theDisp.x;
			editPars-&amp;gt;endC.y = actTranPars-&amp;gt;theOrigo.y + actTranPars-&amp;gt;theDisp.y;
			break;
		case APIEdit_PHeightStretch:
			editPars-&amp;gt;typeID = APIEdit_PHeightStretch;
			editPars-&amp;gt;begC.x = actTranPars-&amp;gt;theOrigo.x;
			editPars-&amp;gt;begC.y = actTranPars-&amp;gt;theOrigo.y;
			editPars-&amp;gt;endC.x = actTranPars-&amp;gt;theOrigo.x + actTranPars-&amp;gt;theDisp.x;
			editPars-&amp;gt;endC.y = actTranPars-&amp;gt;theOrigo.y + actTranPars-&amp;gt;theDisp.y;
			break;
		case APIEdit_Resize:
			editPars-&amp;gt;typeID = APIEdit_Resize;
			editPars-&amp;gt;begC.x = actTranPars-&amp;gt;theOrigo.x;
			editPars-&amp;gt;begC.y = actTranPars-&amp;gt;theOrigo.y;
			editPars-&amp;gt;endC.x = actTranPars-&amp;gt;theOrigo.x + 1;
			editPars-&amp;gt;endC.y = actTranPars-&amp;gt;theOrigo.y;
			editPars-&amp;gt;endC2.x = actTranPars-&amp;gt;theOrigo.x + actTranPars-&amp;gt;theRatio;
			editPars-&amp;gt;endC2.y = actTranPars-&amp;gt;theOrigo.y;
			break;
		case APIEdit_Elevate:
			editPars-&amp;gt;typeID = APIEdit_Elevate;
			editPars-&amp;gt;endC.z = actTranPars-&amp;gt;theDispZ;
			break;
		case APIEdit_VertStretch:
			editPars-&amp;gt;typeID = APIEdit_VertStretch;
			editPars-&amp;gt;endC.z = actTranPars-&amp;gt;theDispZ;
			break;
	}

	return editPars-&amp;gt;typeID != (API_EditCmdID) 0;
}&lt;/PRE&gt;
But at the end detail is not moving on the plan.&lt;BR /&gt;Please any one give me what went wrong?&lt;/DIV&gt;</description>
      <pubDate>Thu, 03 Aug 2023 08:52:09 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Problem-of-using-ACAPI-Element-Edit-on-DetailElement/m-p/126647#M6122</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-08-03T08:52:09Z</dc:date>
    </item>
  </channel>
</rss>

