Add-On Template
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2018-10-03 12:26 PM - last edited on ‎2022-10-06 01:05 PM by Daniel Kassai
Would like to see a template that includes a simple test menu with say one item/function and the standard 'Hello World' WriteReport message.
Are there any instruction available as how to create my own template in xcode to do this?
Windows 11 - Visual Studio 2022; ArchiCAD 27
Solved! Go to Solution.
- Labels:
-
Add-On (C++)
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2018-10-05 01:23 PM
Hai wrote:So, in your RegisterInterface() function:
Hi Ralph,
Thank you so much but I'm a beginner and sorry I don't understand where menu handler is.
GSErrCode __ACENV_CALL RegisterInterface (void) { ACAPI_Register_Menu (32500, 0, MenuCode_UserDef, MenuFlag_Default); return NoError; } // RegisterInterfaceHere 32500 is the ID of the string resource that appears in the menu; add this to the .grc file:
'STR#' 32500 "Strings for the Menu" { /* [ 1] */ "Hello world" }Then in your Initialize() function add the following:
GSErrCode __ACENV_CALL Initialize (void) { GSErrCode err = ACAPI_Install_MenuHandler (32500, MenuCommandHandler); // other stuff }Last, in your MenuCommandHandler function call Do_CreateHelloWord():
GSErrCode __ACENV_CALL MenuCommandHandler (const API_MenuParams *params) { if (params->menuItemRef.itemIndex == 1) { Do_CreateHelloWord (); } }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2018-10-03 04:08 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2018-10-04 03:59 AM
kzaremba wrote:I'm using VS 2017 but I don't know how to start with Hello World Blog. How can I use that code and necessary resource to get Hello World in AC. Could you show me how to do it step by step? Thanks for your kind.
It would be good to have one for Visual Studio as well. So you can start project instantly on custom path.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2018-10-04 10:34 AM
// ----------------------------------------------------------------------------- // DoCommand // called to perform the user-asked command // ----------------------------------------------------------------------------- GSErrCode __ACENV_CALL MenuCommandHandler (const API_MenuParams *params) { if (params->menuItemRef.itemIndex == 1) { //Your code here } return NoError; } // MenuCommandHandler
Active Thread Ltd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2018-10-04 04:49 PM
Thank you so much but I'm a beginner and sorry I don't understand where menu handler is.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2018-10-04 06:17 PM
Hai wrote:Search the project for
Thank you so much but I'm a beginner and sorry I don't understand where menu handler is.
Active Thread Ltd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2018-10-05 01:23 PM
Hai wrote:So, in your RegisterInterface() function:
Hi Ralph,
Thank you so much but I'm a beginner and sorry I don't understand where menu handler is.
GSErrCode __ACENV_CALL RegisterInterface (void) { ACAPI_Register_Menu (32500, 0, MenuCode_UserDef, MenuFlag_Default); return NoError; } // RegisterInterfaceHere 32500 is the ID of the string resource that appears in the menu; add this to the .grc file:
'STR#' 32500 "Strings for the Menu" { /* [ 1] */ "Hello world" }Then in your Initialize() function add the following:
GSErrCode __ACENV_CALL Initialize (void) { GSErrCode err = ACAPI_Install_MenuHandler (32500, MenuCommandHandler); // other stuff }Last, in your MenuCommandHandler function call Do_CreateHelloWord():
GSErrCode __ACENV_CALL MenuCommandHandler (const API_MenuParams *params) { if (params->menuItemRef.itemIndex == 1) { Do_CreateHelloWord (); } }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2018-10-05 07:27 PM
Ralph wrote:Thank you very much. I will learn it and reply for result as soon.
Search the project forMenuCommandHandler. For that particular project, it's in the file AddOnObject_Manager.cpp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2018-10-05 07:32 PM
Thank you very much for the detailed guide for me. It's very helpful for the beginner like me.
P/S: Thanks for Ralph, I can build more example without any errors and maybe I knew how API work and folder structure. Thank so much for supporting. I will do something by myself ^.^