cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

How to move railing vertices?

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

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Akos Somorjai
Graphisoft
Graphisoft

Hi Bernd,

 

Unfortunately due to a known bug in the API this is not possible. I'll try to raise its priority...

 

Best, Akos

View solution in original post

8 REPLIES 8
Akos Somorjai
Graphisoft
Graphisoft

Hi Bernd,

 

Have you tried ACAPI_Element_Edit()?

 

Best, Akos

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

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com

Hi Akos,

 


Moving the whole railing with ACAPI_Element_Edit works. But I wasn't able to figure out how to move single vertices of the railing.
I've tried a lot of different scenarios with ACAPI_Element_Edit & ACAPI_Element_ChangeMemo.
Passing single railing nodes to the Edit function didn't work, neither does changing the poly coords with change memo.

 

Any hints or ideas what else I could try or what's the intended way is?
Unfortunately the examples also don't have anything for editing single vertices of railings.

Best,
Bernd

 

I want to move single vertices of the reference line, I wasn'tNone of it worked so far

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com
Solution
Akos Somorjai
Graphisoft
Graphisoft

Hi Bernd,

 

Unfortunately due to a known bug in the API this is not possible. I'll try to raise its priority...

 

Best, Akos

Thanks Akos for looking into this and raising the priority!

 

How does it typically work if there comes a bug fix like this. Is it typically only in the newest DevKit or are they also incorporated in older DevKits?

 

Best,

Bernd

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com

Hi Bernd,

 

A similar bug has been fixed in Archicad 28;  which version do you use?

 

Bugfixes are part of Archicad Updates or Hotfixes, and are ported back to previous versions only in very rare cases.

 

Best, Akos

Akos,

 

Thanks for the hint! If I remember correctly I've tried it with both AC26.7004 & DevKit 26.7000 and AC29.3000 & DevKit 29.3000.

I'll give it a try with newest AC28 & AC29 again and report back.

Best,
Bernd

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com

Akos,

 

I've tried it with more versions now and unfortunately it doesn't work with any of them.
This is a list of versions I've tried (all of them INT language versions)

  • 26.7004 - DevKit 26.7000
  • 27.6080 - DevKit 27.6003
  • 28.6100 - DevKit 28.4001
  • 29.3100 - DevKit 29.3100

A fix for AC29 would be great 🙂 I think AC28 would be not strictly necessary for us, but could help in case AC29 can't be used.

 

Thanks a lot for your help and all the information!

 

Best,
Bernd

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!