License Delivery maintenance is expected to occur on Saturday, November 30, between 8 AM and 11 AM CET. This may cause a short 3-hours outage in which license-related tasks: license key upload, download, update, SSA validation, access to the license pool and Graphisoft ID authentication may not function properly. We apologize for any inconvenience.
Archicad C++ API
About Archicad add-on development using the C++ API.

Notify Manager - New Attribute?

Erenford
Booster
Can you catch if a user creates a new attribute similar to catching new elements? Like if I create a Layer/Layer Combo, it will have an event I can handle.

Thanks,
Erenford
8 REPLIES 8
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi Erenford,

implement an AttributeSetObserver to catch events of the AttributeManager:
#include "AttributeManager.hpp" 
 
class MyAttributeSetObserver : public ADB::AttributeSetObserver { 
public: 
	MyAttributeSetObserver (); 
	virtual ~MyAttributeSetObserver (); 
 
	virtual	void	AttributeCreated (ADB::IDAttribute attributeTypeId, ADB::GeneralAttributeConstRef attribute) override; 
	virtual	void	AttributeChanged (ADB::IDAttribute attributeTypeId, ADB::GeneralAttributeConstRef attribute, const FieldMask& changes) override; 
	virtual	void	AttributeDeleted (ADB::IDAttribute attributeTypeId, short index) override; 
 
	virtual void	ActiveAttributeChanged (ADB::IDAttribute attributeTypeId, const ADB::GeneralAttributeRef& attributeRef) override; 
 
	virtual void	AttributeTypeRestored (ADB::IDAttribute attributeTypeId) override; 
}; 
 
 
MyAttributeSetObserver::MyAttributeSetObserver() 
{ 
	ADB::AttributeSetConstRef attrSet = GetCurrentAttributeSet (); 
	attrSet(ODB::LogicalConst)->Attach (*this); 
} 
 
 
MyAttributeSetObserver::~MyAttributeSetObserver() 
{ 
	ADB::AttributeSetConstRef attrSet = GetCurrentAttributeSet (); 
	attrSet(ODB::LogicalConst)->Detach (*this); 
} 
 
// Implement observer methods!

Regards,
Tibor
Anonymous
Not applicable
This looks useful. Can I ask where the class AttributeSet is defined?

I'm assuming it's in AttributeSet.hpp but I can't find it in the SDK(18.3006)

Both the class is referenced and the header is included in headers in AttributeManager
Anonymous
Not applicable
Any info on where this AttributeSet class is defined?
Akos Somorjai
Graphisoft
Graphisoft
MarkHenryC wrote:
Any info on where this AttributeSet class is defined?
This is not part of the public API; what do you need that for?

Best, Akos
Anonymous
Not applicable
I was hoping it might provide a notification when layer status has changed, such a hiding or showing. If done via main menu there's no notification.
Akos Somorjai
Graphisoft
Graphisoft
MarkHenryC wrote:
I was hoping it might provide a notification when layer status has changed, such a hiding or showing. If done via main menu there's no notification.
Thanks!

And what would you like to do when the notification arrives?

Best, Akos
Anonymous
Not applicable
I'd like to update the current render session. Notifications work fine when making changes to scene elements, but switching off a layer via the menu bypasses this system.
Anonymous
Not applicable
Hi,

I have a very similar problem and I am curious if there is any update here (SDK - AC21) or is it still an "internal function"?

Regards,
Piotr