We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

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

Intercept layer hidden/show events.

Anonymous
Not applicable
Hello,

I've implemented all the below functions and put a breakpoint in them. It appears that none of the below is hit when I hide a layer/show all.

ACAPI_Notify_CatchProjectEvent
ACAPI_Notify_CatchViewEvent
ACAPI_Notify_CatchToolChange
ACAPI_Notify_CatchSelectionChange
ACAPI_Notify_CatchChangeDefaults
ACAPI_Notify_CatchNewElement
ACAPI_Notify_InstallElementObserver
ACAPI_Notify_CatchElementReservationChange
ACAPI_Notify_CatchLockableReservationChange

Not sure if I am using the right function call to intersect the above events. Not sure if relevant but when right click on model and 'Move', the functions below do get called.

GSErrCode __ACENV_CALL ElementEventHandlerProc ( const API_NotifyElementType *elemType )

static void OnElementNotify ( const API_Guid &guid )

Thanks in advance,
Ian
3 REPLIES 3
Akos Somorjai
Graphisoft
Graphisoft
IanTr wrote:
Hello,

I've implemented all the below functions and put a breakpoint in them. It appears that none of the below is hit when I hide a layer/show all.

ACAPI_Notify_CatchProjectEvent
ACAPI_Notify_CatchViewEvent
ACAPI_Notify_CatchToolChange
ACAPI_Notify_CatchSelectionChange
ACAPI_Notify_CatchChangeDefaults
ACAPI_Notify_CatchNewElement
ACAPI_Notify_InstallElementObserver
ACAPI_Notify_CatchElementReservationChange
ACAPI_Notify_CatchLockableReservationChange

Not sure if I am using the right function call to intersect the above events. Not sure if relevant but when right click on model and 'Move', the functions below do get called.

GSErrCode __ACENV_CALL ElementEventHandlerProc ( const API_NotifyElementType *elemType )

static void OnElementNotify ( const API_Guid &guid )

Thanks in advance,
Ian
Hello Ian,

Yes, your observations are correct, you won't receive any such notification after the layer's visibility changed, because that is not changing the core data of the element itself, because it is a "visualisation" option. There's no explicit notification for this; what is the functionality you'd like to implement?

Regards, Akos
Anonymous
Not applicable
Hello Akos,

Currently, the way we use Archicad is:
1. User load in Archicad model.
2. We have a "Send data" button that sends all the geometries to our external program. During this initial send, I checked the layer hidden flag. If the flag is set, then will skip over the geometry.
	// Layer
	{
		API_Attribute attrib;
		BNZeroMemory( &attrib, sizeof (API_Attribute) );
		attrib.header.typeID = API_LayerID;
		attrib.header.index = element.header.layer;
		if ( NoError == ACAPI_Attribute_Get ( &attrib ) )
		{
			if ( ( attrib.layer.head.flags & APILay_Hidden ) == APILay_Hidden )
			{
				return;
			}
			pMesh->AddParameter ( L"Layer", attrib.layer.head.name );
		}
	}

3. However, after sending, I would like to receive notification if user changes the layer visibility on that object so that our program will update its state to reflect what Archicad is showing in realtime.

Currently we are doing that with position. If moved something in Archicad, our external program would update the position of that object in realtime.

Thank you,
Ian
Akos Somorjai
Graphisoft
Graphisoft
IanTr wrote:
Hello Akos,

Currently, the way we use Archicad is:
1. User load in Archicad model.
2. We have a "Send data" button that sends all the geometries to our external program. During this initial send, I checked the layer hidden flag. If the flag is set, then will skip over the geometry.
	// Layer
	{
		API_Attribute attrib;
		BNZeroMemory( &attrib, sizeof (API_Attribute) );
		attrib.header.typeID = API_LayerID;
		attrib.header.index = element.header.layer;
		if ( NoError == ACAPI_Attribute_Get ( &attrib ) )
		{
			if ( ( attrib.layer.head.flags & APILay_Hidden ) == APILay_Hidden )
			{
				return;
			}
			pMesh->AddParameter ( L"Layer", attrib.layer.head.name );
		}
	}

3. However, after sending, I would like to receive notification if user changes the layer visibility on that object so that our program will update its state to reflect what Archicad is showing in realtime.

Currently we are doing that with position. If moved something in Archicad, our external program would update the position of that object in realtime.

Thank you,
Ian
Hi Ian,

I understand.

Does updating the model require user interaction (e.g. pressing the "Send data" button)? If so, then you can check the layer visibility when the user pressed the button.
If not, then I'd recommend creating a small, always visible palette (not a modal dialog) after the first data transfer, and enable idle events for that palette. Then in your idle event handler check the state of the layers (adjust the timing by checking only on every 10th or 50th call), and update your model.

Regards, Akos