Hi,
I am getting a nested Cell's level ID using the code below.
But this code fails because there is Smart Solid header which does not contain any level ID in the element information below.
So, it returns default level ID but this is wrong.
I don't want to test all element types and I think there must be a better way to find a nested Cell's level ID.
// Get level of a cell
void akElmdscr_getLevel
(
MSElementDescr **edP,
ULong *levelid
)
{
*levelid = 0;
#if defined (MSVERSION) && (MSVERSION >= 0x8b0)
/*status = */mdlModify_elementDescr2(edP,ACTIVEMODEL,MODIFY_REQUEST_NOHEADERS, naElmfunc_getLevel,levelid,0);
#else
/*status = */mdlModify_elementDescr(edP,ACTIVEMODEL,MODIFY_REQUEST_NOHEADERS, naElmfunc_getLevel,levelid,0);
#endif
}
/* Element function to get level of first element after the header */
int naElmfunc_getLevel
(
MSElementUnion *elP, /* <=> element to be modified */
UInt32 *level, /* => user parameter ( level of elmdscr ) */
DgnModelRefP fileNum, /* => file # for current elem */
MSElementDescr *elmDscrP, /* => element descr for elem */
MSElementDescr **newDscrPP /* <= if replacing entire descr */
)
{
if( mdlElement_getType(elP) != CELL_HEADER_ELM )
{
/* Get level of the element */
mdlElement_getProperties (level, NULL, NULL, NULL, NULL, NULL, NULL, NULL, elP);
return (MODIFY_STATUS_ABORT); /* Level got, abort process */
}
return (MODIFY_STATUS_NOCHANGE);
}
![]()
Regards,
Ahmet Sedat ALIS