How to copy a ECSchema to a work file

I have a DGN containing elements with XAttributes (from a Shape file) and wish to create a new DGN as a work dgn, copying some of the elements with their XAttributes. 

In the new file checking the elements with "element information"  gives the error

           "Invalid ECXAttribute refers to a stored ECSchema that does not exist in the file."

Which makes sense. 

How can I copy the ECSchema into the new file from the original DGN?

Cheers.

Parents
  • I don't see a direct call in the api but I would try using the keyins ecx schema export and ecx schema import to extract the schema (as xml) from the original file then you can import it to the new file. To use these commands do this:

    MDL LOAD bentley.ecxAttributesAddin.dll

    ECX SCHEMA LIST         -----    This will list all the embedded schemas in the Message Center

    ECX SCHEMA EXPORT  {SchemaName.MM.mm} {directoryName}   -----    export an xml version of the schema

    ECX SCHEMA IMPORT  

    There is an xmlinstance api equivalent to this but again you will need to be in the file that you want to extract from and then the file that you import into.

    HTH,

Reply
  • I don't see a direct call in the api but I would try using the keyins ecx schema export and ecx schema import to extract the schema (as xml) from the original file then you can import it to the new file. To use these commands do this:

    MDL LOAD bentley.ecxAttributesAddin.dll

    ECX SCHEMA LIST         -----    This will list all the embedded schemas in the Message Center

    ECX SCHEMA EXPORT  {SchemaName.MM.mm} {directoryName}   -----    export an xml version of the schema

    ECX SCHEMA IMPORT  

    There is an xmlinstance api equivalent to this but again you will need to be in the file that you want to extract from and then the file that you import into.

    HTH,

Children