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

Wall Tool from favorite

dushyant
Enthusiast
Hello,
Is there a way to activate the wall tool for drawing the wall, with a particular favorite wall’s settings? I can place a favorite wall with begC and endC. But I need the wall tool to get activated with the favorite’s settings applied & ready to draw.

Basically from the menu: Design > Design Tools > Wall , should get activated and instead of Default Settings, it should be ready with the settings of a particular favorite wall.

Thanks,
Dushyant
25 REPLIES 25
Ralph Wessel
Mentor
How about using ACAPI_Element_ChangeDefaults to apply the favorite setings to the tool defaults? And APIEnv_SetToolBoxModeID can be used to make the tool active.
Ralph Wessel BArch
dushyant
Enthusiast
Thanks Ralph, I will try and work with those.
dushyant
Enthusiast
I am now able to set the current tool to Wall tool. However, I don’t know what to set for the ‘mask’ part of:
GSErrCode ACAPI_Element_ChangeDefaults (
API_Element* element,
API_ElementMemo* memo,
const API_Element* mask
);

Code snippet:
API_Favorite    favorite (favName);
favorite.memo.New ();
API_Element& favElement = favorite.element;
API_ElementMemo& favMemo = favorite.memo.Get();
ACAPI_Element_ChangeDefaults(&favElement, &favMemo, <MASK?>);
Thanks,
Dushyant
Ralph Wessel
Mentor
Try using this:
	API_Element mask;
	ACAPI_ELEMENT_MASK_SETFULL(mask);
…and use mask in your call to ACAPI_Element_ChangeDefaults. That will cause everything in the favorite to be applied to the default settings.
Ralph Wessel BArch
dushyant
Enthusiast
Hi Ralph,
Thanks. Just wondering, how would an API_Element mask set the properties of my favorite element when it is not linked to the favorite? Or how does it fetch the properties of the favorite?

Dushyant
dushyant
Enthusiast
Ralph,
I tried:
API_Element mask;
ACAPI_ELEMENT_MASK_SETFULL(mask);
It does change the default settings as per the Favorite set in code, except for the Classification..

Does something else need to be done to change the classification as per the Favorite?

Dushyant
Ralph Wessel
Mentor
The mask is just a filter that allows you to define which values you want to change. In this case I assume you want to apply all the settings from the favorite, which is achieved with the macro ACAPI_ELEMENT_MASK_SETFULL

A description of this macro and the application of masks is available in the API document if you need more detail.
Ralph Wessel BArch
dushyant
Enthusiast
Okay, thanks a lot!
dushyant
Enthusiast
Any idea why the Classification is not getting set to that of the Favorite? (It's not changing at all)