We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2010-11-05 05:25 AM - last edited on 2023-08-03 10:52 AM by Doreena Deng
err = ACAPI_Element_Create(&detailElement, &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); }detailElement is created and liked without errors.
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, &linkGuids, &nLinks); if(err == noErr && !(linkGuids == NULL || nLinks == 0)) { ACAPI_Notify_GetTranParams (&actTranPars); ActTranPars_To_EditPars (&actTranPars, &editPars); API_Elem_Head** elemHeadHdl = NULL; err = ACAPI_Database (APIDb_GuidToElemHeadID, (void*) linkGuids, (void*) &elemHeadHdl); if (err == noErr && elemHeadHdl != NULL) { API_Neig** neigHdl = reinterpret_cast<API_Neig**> (BMAllocateHandle (nLinks * sizeof (API_Neig), ALLOCATE_CLEAR, 0)); if (neigHdl == NULL) return APIERR_MEMFULL; for (GSIndex index = 0; index < nLinks; index++) { ElemHead_To_Neig ((*neigHdl) + index, (*elemHeadHdl) + index); } err = ACAPI_Element_Edit (neigHdl, nLinks, &editPars); // noErrors BMKillHandle (reinterpret_cast<GSHandle*> (&elemHeadHdl)); BMKillHandle (reinterpret_cast<GSHandle*> (&neigHdl)); } } } } bool ActTranPars_To_EditPars(const API_ActTranPars *actTranPars, API_EditPars *editPars) { BNZeroMemory (editPars, sizeof (API_EditPars)); editPars->withDelete = true; editPars->typeID = (API_EditCmdID) 0; switch (actTranPars->typeID) { case APIEdit_Drag: editPars->typeID = APIEdit_Drag; editPars->endC.x = actTranPars->theDisp.x; editPars->endC.y = actTranPars->theDisp.y; editPars->endC.z = actTranPars->theDispZ; break; case APIEdit_Rotate: editPars->typeID = APIEdit_Rotate; editPars->origC = actTranPars->theOrigo; editPars->begC.x = editPars->origC.x + 1.0; editPars->begC.y = editPars->origC.y; editPars->endC.x = editPars->origC.x + actTranPars->theCosA; editPars->endC.y = editPars->origC.y + actTranPars->theSinA; break; case APIEdit_Mirror: editPars->typeID = APIEdit_Mirror; editPars->begC.x = actTranPars->theOrigo.x; editPars->begC.y = actTranPars->theOrigo.y; editPars->endC.x = actTranPars->theOrigo.x + actTranPars->theAxeVect.x; editPars->endC.y = actTranPars->theOrigo.y + actTranPars->theAxeVect.y; break; case APIEdit_Stretch: editPars->typeID = APIEdit_Stretch; editPars->begC.x = actTranPars->theOrigo.x; editPars->begC.y = actTranPars->theOrigo.y; editPars->endC.x = actTranPars->theOrigo.x + actTranPars->theDisp.x; editPars->endC.y = actTranPars->theOrigo.y + actTranPars->theDisp.y; break; case APIEdit_PDirStretch: editPars->typeID = APIEdit_PDirStretch; editPars->begC.x = actTranPars->theOrigo.x; editPars->begC.y = actTranPars->theOrigo.y; editPars->endC.x = actTranPars->theOrigo.x + actTranPars->theDisp.x; editPars->endC.y = actTranPars->theOrigo.y + actTranPars->theDisp.y; break; case APIEdit_PHeightStretch: editPars->typeID = APIEdit_PHeightStretch; editPars->begC.x = actTranPars->theOrigo.x; editPars->begC.y = actTranPars->theOrigo.y; editPars->endC.x = actTranPars->theOrigo.x + actTranPars->theDisp.x; editPars->endC.y = actTranPars->theOrigo.y + actTranPars->theDisp.y; break; case APIEdit_Resize: editPars->typeID = APIEdit_Resize; editPars->begC.x = actTranPars->theOrigo.x; editPars->begC.y = actTranPars->theOrigo.y; editPars->endC.x = actTranPars->theOrigo.x + 1; editPars->endC.y = actTranPars->theOrigo.y; editPars->endC2.x = actTranPars->theOrigo.x + actTranPars->theRatio; editPars->endC2.y = actTranPars->theOrigo.y; break; case APIEdit_Elevate: editPars->typeID = APIEdit_Elevate; editPars->endC.z = actTranPars->theDispZ; break; case APIEdit_VertStretch: editPars->typeID = APIEdit_VertStretch; editPars->endC.z = actTranPars->theDispZ; break; } return editPars->typeID != (API_EditCmdID) 0; }But at the end detail is not moving on the plan.