xdata 쓰기 예제입니다.
if (mdlElmdscr_read(&pDescr, filePosP , modelRef , FALSE , NULL) != 0)
{
ElementId regAppID;
static MSWChar *s_applicationName = L"Rev.Pro";
if (SUCCESS == mdlRegApp_idFromName (®AppID, s_applicationName , mdlModelRef_getDgnFile(MASTERFILE), TRUE))
{
XDataValueUnion data;
int dataType;
int groupCode;
UInt32 dataSize;
UInt32 index = NULL;
if(pDescr->h.isHeader && pDescr->h.firstElem)
{
for(MSElementDescrP ptr = pDescr->h.firstElem;NULL != ptr;ptr = ptr->h.next)
{
UInt32 color = 0;
mdlElement_getSymbology(&color, NULL , NULL , &(ptr->el));
//기존 데이타 있는지 체크..
if (SUCCESS != mdlLinkage_getXDataGroupCode (&data, &dataType, &dataSize, &groupCode, &(ptr->el) , &index))
{
const int iSize1 = sizeof(&OriginColor);
const int iSize2 = sizeof(OriginColor);
if (SUCCESS == mdlLinkage_addXDataGroupCode (&ptr, DWGXDATA_Integer, &color, sizeof(color)))
{
}
else
{
AfxMessageBox(_T("XData 안들어 감"));
}
}
}
}
if (SUCCESS != mdlLinkage_getXDataGroupCode (&data, &dataType, &dataSize, &groupCode, &(pDescr->el) , &index))
{
const int iSize1 = sizeof(&OriginColor);
const int iSize2 = sizeof(OriginColor);
if (SUCCESS == mdlLinkage_addXDataGroupCode (&pDescr, DWGXDATA_Integer, &OriginColor, sizeof(OriginColor)))
{
}
else
{
AfxMessageBox(_T("XData 안들어 감"));
}
}
}
mdlElmdscr_rewrite(pDescr,pDescr,filePosP);
mdlElmdscr_freeAll (&pDescr);
}
댓글
댓글 쓰기