2 weeks ago
Hi,
I'm struggling with moving the vertices of a railing. Here's a minimal example of the code I'm using:
err = ACAPI_CallUndoableCommand ("Move Railing Test", [](){
GS::Array<API_Guid> railingList{};
GSErrCode err = ACAPI_Element_GetElemList (API_RailingID, &railingList,
APIFilt_IsEditable | APIFilt_InMyWorkspace | APIFilt_OnActFloor
);
if (err != NoError) { return err; }
for (auto elemGuid : railingList) {
API_Element elem{};
elem.header.guid = elemGuid;
err = ACAPI_Element_Get (&elem, 0);
if (err != NoError) { return err; }
API_ElementMemo memo{};
GS::UInt64 memoMask = APIMemoMask_Polygon;
err = ACAPI_Element_GetMemo (elemGuid, &memo, memoMask);
if (err != NoError) { return err; }
for (GS::UInt32 i = 1; i <= elem.railing.nVertices; ++i) {
(*memo.coords)[i].x += 1.0;
}
err = ACAPI_Element_ChangeMemo (elemGuid, memoMask, &memo);
if (err != NoError) { return err; }
}
return err;
});
If you draw a railing and the try to execute the command, I want it to move all vertices 1m to the right.
The `ACAPI_Element_ChangeMemo` command doesn't return any errors but also the railing doesn't change it's position. I've also tried `ACAPI_Element_Change` without success.
The example projects don't seem to contain any similar code either. The other railing elements (nodes etc.) don't seem to contain coordinates, so I'm not sure what I'm missing.
Any ideas?
Thanks!
Bernd
2 weeks ago
Hi Bernd,
Have you tried ACAPI_Element_Edit()?
Best, Akos
a week ago
Hi Akos,
I haven't tried it, because for my actual problem I want to move the vertices in different directions. Everything +1m to the right was just to simplify the code here.
I'll try it though! Maybe I also have to move the railing nodes etc. with the edit command.
Thanks so much for the hint! I'll report back once I'm home from GSIgnite and have time to try it. Hope to see you in Budapest 🙂
Bernd