2011-01-10 11:22 AM - last edited on 2024-09-09 10:58 AM by Doreena Deng
static void Do_MyFunction(void) { API_Element element; API_ElementMemo memo; BNZeroMemory(&element, sizeof(API_Element)); BNZeroMemory(&memo, sizeof(API_ElementMemo)); double A = 0; double B = 0; Int32 parCount = 0; //---- element.header.typeID = API_ObjectID; ACAPI_Element_GetDefaults(&element, NULL); ACAPI_LibPart_GetParams(20, &A, &B, &parCount, &memo.params); element.object.pos.x = 1; element.object.pos.y = 1; element.object.xRatio = A; element.object.yRatio = B; element.object.libInd = 20; GSErrCode err = ACAPI_Element_Create(&element, &memo); if( err == NoError) { ACAPI_WriteReport("Ok ",true); } else { ACAPI_WriteReport("Error ",true); } ACAPI_DisposeElemMemoHdls (&memo); }It's all return Error only
2011-01-10 09:41 PM
Paodekcal wrote:Are you using
It's all return Error only
P.S. I want to test on library index 20.
2011-01-11 02:47 AM
2011-01-11 03:04 AM
API_LibPart part; GSErrCode err; BNZeroMemory(&part, sizeof(API_LibPart)); part.index = 20; err = ACAPI_LibPart_Search(&part, false); err = ACAPI_LibPart_Get(&part); API_Element element; API_ElementMemo memo; BNZeroMemory(&element, sizeof(API_Element)); BNZeroMemory(&memo, sizeof(API_ElementMemo)); double A = 0; double B = 0; Int32 parCount = 0; //---- element.header.typeID = API_ObjectID; err = ACAPI_Element_GetDefaults(&element, NULL); err = ACAPI_LibPart_GetParams(part.index, &A, &B, &parCount, &memo.params); element.object.pos.x = 1; element.object.pos.y = 1; element.object.xRatio = A; element.object.yRatio = B; element.object.libInd = part.index; err = ACAPI_Element_Create(&element, &memo); if( err == NoError) { ACAPI_WriteReport("Ok ",true); } else { ACAPI_WriteReport("Error ",true); } ACAPI_DisposeElemMemoHdls (&memo);I use above code and it's error too
err = ACAPI_Element_Create(&element, &memo);err return
APIERR_REFUSEDCMD -2130312312 81060388 The passed identifier is not subject to the operation.
2011-01-11 03:25 AM
2011-01-11 04:27 AM
ACAPI_OpenUndoableSession("Test Lib"); err = ACAPI_Element_Create(&element, &memo); ACAPI_CloseUndoableSession();OK thx.
2011-01-11 10:42 AM
Paodekcal wrote:If you ask for an object with an index of '20', ArchiCAD will return whatever object has that index. But if you change the loaded libraries and ask for the object at index '20', don't be surprised if you get a
I confuse this sentence
"library part index is temporary"
Can you explain me in detail?
2011-01-11 10:51 AM