BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

Archicad C++ API
About Archicad add-on development using the C++ API.

Window height and width problem

Anonymous
Not applicable
Hello there,

I was trying to alter the width and height of a window using the corresponding parameters width and height of API_OpeningBaseType that each window/door/skylight elements have, and noticed that the window didn't updated its height or width.

For the changes to effect on the window it required me to open the window options and click OK so the changes take effect.

As a work-around, and to simulate the update, I thought of after creating the window calling Element_Change, without actually changing anything, but 'forcing' an update to the window, and it worked. The changes to width and height of the window were visible on the window.

However, this function (ACAPI_Element_Change), as stated in the documentation only works on specific databases, "The current database should be the floor plan, a section/elevation, a detail or a worksheet". Alas, when I tried to create a window in a 3D view it gave me the corresponding error APIERR_BADDATABASE.

Due to this, I was wondering two things:

First, there is a way of correctly modifying the window's width and height without the need to call ACAPI_Element_Change.

And second, if there is an operation that allows me to go from the 3DView to a story view. I tried using ACAPI_Environment(APIEnv_ChangeStorySettingsID, ...) with the command to change story, APIStory_GoTo, but it only worked when my view is already in a story (for example, when I change from story 1 to story 0), and it does not work when going from 3Dview to story.

Thanks in advance,
Xylios


DoorBug.png

2 REPLIES 2
Oleg
Expert
Look at:
APIDb_GetCurrentDatabaseID
APIDb_ChangeCurrentDatabaseID
APIDo_ChangeWindowID

Usual steps, if current database is not floor plan:
  • Keep current database ( APIDb_GetCurrentDatabaseID )
    Set floor plan database (ChangeCurrentDatabaseID )
    Do floor plan updates ( like ACAPI_Element_Change )
    Restore keeped database (ChangeCurrentDatabaseID )
Go to story and floor pan:
  • Activate floor plan window (APIDo_ChangeWindowID)
    Go to story (APIStory_GoTo)
Anonymous
Not applicable
Hello,

I tried following your advice and it works!

Thank you for the reply,
Xylios
Learn and get certified!