cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Choose your top Archicad wishes!

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

ACAPI_Element_CatchNewElement does not work with specified Type

stahL
Contributor

Hello,

I have a problem with the CatchNewElement Handler

This is my code:

 

API_ToolBoxItem elemType = {}; 
elemType.type.typeID = API_ObjectID; 
ACAPI_Element_CatchNewElement(&elemType, ElementEventHandler); 

// Other variants i tried: 

// API_ToolBoxItem elemType_Wall = { API_ObjectID, 0, 0 }; seen here: https://graphisoft.github.io/archicad-api-devkit/group___element.html#ga141f01f381503b52a3cf7af291390df0 

// nullptr -> this works, but i want to only get notified about new objects

 

When i use this code and set a breakpoint at the beginning of the ElementEventHandler, it doesnt get triggered.
With nullptr instead of elemType it gets triggered (3x: 1. APINotifyElement_BeginEvents, 2. APINotifyElement_New, 3. APINotifyElement_EndEvents)

Can someone help me with this?

Looking forward to your responses.
Jonas

2 REPLIES 2
kolioi
Booster

I think you have to set the type subcategory. Try this (not tested)

API_ToolBoxItem elemType = {};
elemType.type.typeID = API_ObjectID;
elemType.type.variationID = APIVarId_Object;
ACAPI_Element_CatchNewElement(&elemType, ElementEventHandler);

I tried this as well an it didn't work.

But thank you for the suggestion!

 

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!