[LibPart] Placing on scene from plugin
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2007-12-12
10:03 AM
- last edited on
‎2023-08-04
04:13 PM
by
Doreena Deng
‎2007-12-12
10:03 AM
Hello,
I need to place LibPart using API functions from plugin. Simple Example:
I've defined box.gsm:
I've added path to it in plugin:
And successfully founded and loaded it to memory:
BUT!!!
I haven't found any function in ACAPI_LibPart_* to place it on scene and pass parameters to it (like: A, B, alfa);
Do anyone have examples how to do it...
Thanks for help, I need it badly
-edit-
I found ACAPI_LibPart_ShapePrims, but i have no idea how to use it 😕
I need to place LibPart using API functions from plugin. Simple Example:
I've defined box.gsm:
XFORM 1, cos(alfa), 0, 0, 0, 1, 0, 0, 0, 0, 1, 0 BLOCK A, B, 1
I've added path to it in plugin:
IO::Location rab("D:/GDLobjects/"); if(!rab.IsValid()) throw ElementException("bad location"); if(ACAPI_Environment (APIEnv_AddLibrariesID, reinterpret_cast<void *>(&rab), NULL) == NoError) _interface->GetReporter().Report("folder added"); else throw ElementException("registering location failed");
And successfully founded and loaded it to memory:
API_LibPart part; GSErrCode err; BNZeroMemory(&part, sizeof(API_LibPart)); CHANSI2Unicode("box.gsm", strlen("box.gsm"), part.file_UName, API_UniLongNameLen); if((err = ACAPI_LibPart_Search(&part, false)) == NoError) { if((err = ACAPI_LibPart_Get(&part)) == NoError) { // place on specified location } else _interface->GetReporter().Report(err); } else _interface->GetReporter().Report(err);
BUT!!!
I haven't found any function in ACAPI_LibPart_* to place it on scene and pass parameters to it (like: A, B, alfa);
Do anyone have examples how to do it...
Thanks for help, I need it badly
-edit-
I found ACAPI_LibPart_ShapePrims, but i have no idea how to use it 😕
Labels:
- Labels:
-
Add-On (C++)
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2007-12-12 03:27 PM
‎2007-12-12
03:27 PM
bamboos wrote:You've looked up the definition of a library part, but now you want to place an instance of it. They are completely different things.
I haven't found any function in ACAPI_LibPart_* to place it on scene and pass parameters to it (like: A, B, alfa);
To place an object in the plan, for example, you need to populate an element data structure, in this case the 'object' member of API_Element (which is of type API_ObjectType), and writing it to the element database with ACAPI_Element_Create.
Take a look at APIAny_OpenParametersID (and associated functions) for setting parameter values.
Ralph Wessel BArch
Central Innovation
Central Innovation
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2007-12-12 05:44 PM
‎2007-12-12
05:44 PM
Helped a LOT!!!
Thanks!
Thanks!
API_Element element; API_ElementMemo memo; BNZeroMemory(&element, sizeof(API_Element)); BNZeroMemory(&memo, sizeof(API_ElementMemo)); double A = 0; double B = 0; long parCount = 0; //---- element.header.typeID = API_ObjectID; ACAPI_Element_GetDefaults(&element, &memo); ACAPI_LibPart_GetParams(part.index, &A, &B, &parCount, &memo.params); element.object.angle = 0; element.object.pos.x = 0 + i; element.object.pos.y = 0 + ii; element.object.xRatio = A; element.object.yRatio = B; element.object.libInd = part.index; ACAPI_Element_Create(&element, &memo);