mdlElmdscr_copy element color issue

In a function I wrote, I need to copy element from a workdgn to another work dgn. When I open the file where elements have been copied, element color are altered. For example, color 22 in the first workdgn becomes 6 in the destination, color 34 becomes 58... I can't find a rule...

Some remarks :

  • Color tables are the same in both files
  • The application is written in native code
  • We use MicroStation V8 2004 (the project is in a complex structure with interaction with many other tools)

Source and destination workdgn will be opened and processed like this :

 

// we create the destination
if( mdlWorkDgn_createFile( &pModelRefDest, 

chFichierTemp,
DGNFILE_FORMAT_V8,
pModelRefSeed,
SEED_CopyDefaultData,
NULL,
NULL,
bThreeD ) != SUCCESS )

{

// we open the source file
if( mdlWorkDgn_openFile( &pModelRefSource, NULL, NULL, chTempFilename, NULL, TRUE ) == SUCCESS )
{

CopyContextP  pCC = mdlCopyContext_create(); // a copycontext is created

// we have here a scanner to find elements to copy

// for each element corresponding to the scan criteria, we do:

// element color is correct (pElmdscr->el.hdr.dhdr.symb.color)

if( mdlElmdscr_copy( &pElmdscr, pModelRefSource, pModelRefDest, pCopyContext ) == SUCCESS )
{

// pElmdscr->el.hdr.dhdr.symb.color is different

}

mdlWorkDgn_closeFile( pModelRefSource );

mdlCopyContext_free( &pCopyContext ); // copycontext is freed

}

}

mdlWorkDgn_closeFile( pModelRefDest );

 

In the MDL help file, for the function mdlElmdscr_copy, we found this description for the parameter "elDscrPP :

MSElementDescr** elDscrPP IN OUT element descriptor to copy to the destModelRef. It may be modified by this function. The returned value will be the element descriptor as written to the destination. 

I agree with the sentence in red for levels or linestyle. For the color I don't know if it applies ?

 

My question is : Anybody has encountered this kind of issue ? There is a way to solve it ?

 

Many thanks in advance.

 

Philippe