2010-10-11 05:48 AM - last edited on 2023-08-03 10:54 AM by Doreena Deng
2010-10-11 11:54 AM
wcyoot wrote:Are you first calling
After used ACAPI_Element_UnLink to delete all links of an element , the number of the links got by ACAPI_Element_GetLinks is still not zero.
(The links is created and deleted by the same add-on, alos set undo functions )
2010-10-11 03:04 PM
Ralph wrote:Yes, I am first calling
Are you first callingACAPI_Element_GetLinksto retrieve a list of linked elements, and then repeatedly calling ACAPI_Element_UnLinkto remove each link? Does ACAPI_Element_UnLinkreturn an error? And are you sure the guid_linkFromand guid_linkToparameters are in the right order?
2010-10-11 07:32 PM
wcyoot wrote:I'm not sure what else to suggest - this call works for me. Which version of ArchiCAD are you developing for? Can you post some of the essential code that demonstrates this problem?
Yes, I am first callingACAPI_Element_GetLinks, and then calling ACAPI_Element_UnLinkone by one, and sure ACAPI_Element_UnLinkreturns no error, and sure parameters are in the right order
2010-10-12 08:05 AM
Ralph wrote:AC13.
I'm not sure what else to suggest - this call works for me. Which version of ArchiCAD are you developing for? Can you post some of the essential code that demonstrates this problem?
err = ACAPI_Element_Get (&element); API_Guid linkFrom = element.header.guid; API_Guid** linkToList = NULL; err = ACAPI_Element_GetLinks (linkFrom, &linkToList, &nLinks); for (GSIndex index = 0; index < nLinks; index++) { err = ACAPI_Element_Unlink (linkFrom, (*linkToList)[index]); } BMKillHandle ((GSHandle *) &linkToList); Int32 nLinksTemp = 0; err = ACAPI_Element_GetLinks(linkFrom, NULL, &nLinksTemp); // There nLinksTemp is not zero
2010-10-12 01:37 PM
wcyoot wrote:That looks OK to me. Are you doing this within an Undo session, i.e. using
AC13.err = ACAPI_Element_Get (&element); API_Guid linkFrom = element.header.guid; API_Guid** linkToList = NULL; err = ACAPI_Element_GetLinks (linkFrom, &linkToList, &nLinks); for (GSIndex index = 0; index < nLinks; index++) { err = ACAPI_Element_Unlink (linkFrom, (*linkToList)[index]); } BMKillHandle ((GSHandle *) &linkToList); Int32 nLinksTemp = 0; err = ACAPI_Element_GetLinks(linkFrom, NULL, &nLinksTemp); // There nLinksTemp is not zero
2010-10-13 03:31 AM
Ralph wrote:Yes, Of course. I am sure.
That looks OK to me. Are you doing this within an Undo session, i.e. usingACAPI_OpenUndoableSession?
2010-10-13 10:07 AM
wcyoot wrote:These functions work for me, so I don't know what else to suggest. I recommend cutting the add-on functionality down to the bare minimum required to test this code. Then you can be sure that the problem isn't caused by some earlier corruption.Ralph wrote:Yes, Of course. I am sure.
That looks OK to me. Are you doing this within an Undo session, i.e. usingACAPI_OpenUndoableSession?
2010-10-14 04:50 AM
Ralph wrote:In my test, there is nothing else to do.
These functions work for me, so I don't know what else to suggest. I recommend cutting the add-on functionality down to the bare minimum required to test this code. Then you can be sure that the problem isn't caused by some earlier corruption.