Modify reference entity during undo command failed

Modify reference entity during undo command failed

hbxiaogui
Advocate Advocate
474 Views
1 Reply
Message 1 of 2

Modify reference entity during undo command failed

hbxiaogui
Advocate
Advocate

I had two custom entities.

Entity B stores a soft pointer to entity A.

I override the subErase function of entity B, and hope modify entity A's property when entity B was deleted.

Acad::ErrorStatus EntityB::subErase(Adesk::Boolean pErasing)
{
	if (pErasing)
	{
		if (NULL != m_referenceId)//m_referenceId is soft pointer to EntityA
			ModifyEntityA(m_referenceId);
	}
	else
	{
		if (NULL != m_referenceId)
		{
			RevertEntityA(m_referenceId);
		}
	}
	return eOk;
}

When entity B was deleted, the entity A modified as expected (state modified).

But when I send ctrl+z to acad, the entity B was appeared, the ReverEntityA function run success, the property of entity A is correct to write into AcDbDwgFiler during call assertWriteEnabled()(state origin). After a while, acad run dwgInFields of entity A, the property  return is still state modified not origin.

So how to modify another entity during undo command?

0 Likes
Accepted solutions (1)
475 Views
1 Reply
Reply (1)
Message 2 of 2

hbxiaogui
Advocate
Advocate
Accepted solution

I called the assertWriteEnabled() function in the wrong order. It can modify other entity success during undo command now.

0 Likes