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.
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,
mark anderson [Bentley]
Visit me at https://communities.bentley.com/communities/other_communities/bentley_innovation/default.aspx
I tried manually importing. It exported ok. Got the schema(s) in an external file.
The import process reported it succeeded.
Checking the new DGN with ECX SCHEMA LIST showed the schema there.
But no luck with the element information. Still reported the missing schema.
I even tried importing the standard attributes schema too.