2023-10-23 01:45 PM - last edited on 2024-09-16 02:36 PM by Doreena Deng
Hello! I've been trying to modify an element selection, but I'm having no success pulling the desired guids. It counts the elements in the selection.
ACAPI_Element_GetElemList (API_WallID, &elemList); would work but actually only selects things accoding to the first ever selection. After that, it'll only modify the elements first selected. can't reset selection.
element.header.guid = elemList[i].guid; did the trick, selNeigs[I].guid won't, it compiles without warnings though.
I've tried ACAPI_Selection_GetSelectedElement(&selNeigs, &elemList); but it's not recognized.
API_SelectionInfo selectionInfo;
GS::Array<API_Neig> selNeigs;
// GS::Array<API_Guid> elemList;
ACAPI_Selection_Get (&selectionInfo, &selNeigs, false, false);
GSErrCode err = ACAPI_CallUndoableCommand ("Wall change",
[&] () -> GSErrCode {
// ACAPI_Selection_GetSelectedElement(&selNeigs, &elemList);
// err = ACAPI_Element_GetElemList (API_WallID, &elemList);
for (uint32 i = 0; i < selNeigs.GetSize () && err == NoError; ++i) {
API_Element element = {};
element.header.guid = selNeigs[i].guid;
// element.header.guid = elemList[i].guid;
if (ACAPI_Element_Get (&element) == NoError) {
/* do what you want */
ACAPI_Element_Get (&element);
// FlipWall(element.header.guid);
Solved! Go to Solution.
2023-10-24 05:03 PM
Made it work with a lot of trial and error.
This time, it was able to request the guids from the selected Neigs without using:
ACAPI_Selection_GetSelectedElement
Actually, I declared GSErrCode err = NoError; and then just tried err = ACAPI_Selection_Get instead and it did the trick. For reference, the way it actually worked (selection_get will also work before callUndoable):
GSErrCode err = NoError;
API_SelectionInfo selectionInfo;
GS::Array<API_Neig> selNeigs;
err = ACAPI_CallUndoableCommand ("Wall change",
[&] () -> GSErrCode {
err = ACAPI_Selection_Get (&selectionInfo, &selNeigs, false, false);
for (uint32 i = 0; i < selNeigs.GetSize () && err == NoError; ++i) {
API_Element element = {};
element.header.guid = selNeigs[i].guid;
if (ACAPI_Element_Get (&element) == NoError) {
/* do what you want */
ACAPI_Element_Get (&element);
// FlipWall(element.header.guid);
2023-10-24 05:03 PM
Made it work with a lot of trial and error.
This time, it was able to request the guids from the selected Neigs without using:
ACAPI_Selection_GetSelectedElement
Actually, I declared GSErrCode err = NoError; and then just tried err = ACAPI_Selection_Get instead and it did the trick. For reference, the way it actually worked (selection_get will also work before callUndoable):
GSErrCode err = NoError;
API_SelectionInfo selectionInfo;
GS::Array<API_Neig> selNeigs;
err = ACAPI_CallUndoableCommand ("Wall change",
[&] () -> GSErrCode {
err = ACAPI_Selection_Get (&selectionInfo, &selNeigs, false, false);
for (uint32 i = 0; i < selNeigs.GetSize () && err == NoError; ++i) {
API_Element element = {};
element.header.guid = selNeigs[i].guid;
if (ACAPI_Element_Get (&element) == NoError) {
/* do what you want */
ACAPI_Element_Get (&element);
// FlipWall(element.header.guid);
2023-10-24 10:23 PM
Hi Vítor,
ACAPI_Selection_GetSelectedElement is only available since AC27. So if you are using <=AC26 you'll have to use ACAPI_Selection_Get as you've found.
2023-10-25 02:45 PM
In any case, ACAPI_Selection_GetSelectedElement would have to take an input from an auxiliary function as it seems? ACAPI_Selection_Get actually outs outs the neighs, that could be converted.
2023-10-26 12:12 PM
Ups sry! you are right. ACAPI_Selection_Get stays the same in AC27.
The AC26 equivalent to ACAPI_Selection_GetSelectedElement is ACAPI_Goodies(APIAny_GetSelectedElementID,...).