【MSCE C++】读取DgnAttachment的XAttribute

如题,我有一个a.dgn,在a.dgn的file和designmodel上分别写入了xattribute

现在在b.dgn中参考了a.dgn的designmodel。使用以下代码,在b.dgn中无法读取xattribute。

DgnAttachmentP att = ACTIVEMODEL->GetDgnAttachmentsCP()->at(0);
DgnFileP dgnFileP = att->GetDgnFileP();
ApplicationSettings appSet = IDgnSettings::GetCurrentSettings().GetFileApplicationSettings(*dgnFileP);
//ApplicationSettings appSet = IDgnSettings::GetCurrentSettings().GetModelApplicationSettings(*att);
//改成读取model也不行
XAttributeHandlerId xAttHandlerId(100, 1);

ElementRefP elRef = appSet.GetElementRef();
XAttributeHandle xah(elRef, xAttHandlerId, 3);

if (xah.IsValid())//这里判断无效,无法读取
{
	char* chars = (char*)xah.PeekData();
}

看起来GetCurrentSettings只对当前dgn有效?

请问以上需求该如何实现?