We encountered the following error message while processing a DGN file of version 8:
" Drawing loading failed : The Dgn version isn’t valid. Only Dgn: V7 are currently supported."
For imaging, we also see the error:
“class com.aspose.cad.cadexceptions.ImageLoadException: Drawing loading failed: The Dgn version isn’t valid. Only Dgn: V7 are currently supported. —> class com.aspose.cad.cadexceptions.imageformats.CadException: The Dgn version isn’t valid. Only Dgn: V7 are currently supported.”
Code Snippet–
String filename = “…”;
final DgnImage dgnImage = (DgnImage)Image.load(filename);
for (DgnDrawableEntityBase element : dgnImage.getEntities()) {
** if (element instanceof DgnTextElement)**
** {**
** DgnTextElement textElement = (DgnTextElement) element;**
** System.out.println(textElement.getText() + System.lineSeparator());**
** }** }
We are using the above code snippet provided by the Aspose Support Team in the following ticket:
The error message you’re encountering indicates that the DGN file you are trying to process is of version 8, while the current version of Aspose.CAD only supports DGN version 7. This is why the loading of the drawing fails.
Solution
To resolve this issue, you have a couple of options:
Convert the DGN File: If possible, convert your DGN version 8 file to version 7 using a CAD software that supports this conversion. Once converted, you should be able to load the file without any issues.
Check for Updates: Ensure you are using the latest version of Aspose.CAD. Newer versions may add support for additional file formats or versions.
Use LoadOptions: To handle errors more gracefully, consider using the LoadOptions class. This allows you to specify how to handle errors during loading. You can set the IgnoreErrors property to true if you want to bypass certain errors.
Code
Here’s a sample code snippet using LoadOptions:
LoadOptions options = new LoadOptions();
options.setIgnoreErrors(true); // Ignore errors during loading
DgnImage dgnImage = (DgnImage) Image.load(filename, options);
for (DgnDrawableEntityBase element : dgnImage.getEntities()) {
if (element instanceof DgnTextElement) {
DgnTextElement textElement = (DgnTextElement) element;
System.out.println(textElement.getText() + System.lineSeparator());
}
}
Next Steps
Convert your DGN file to version 7 and see if that resolves the issue.
If you continue to face problems, check for updates to the Aspose.CAD library.
Implement the LoadOptions to manage loading errors as needed.
Please proceed with these steps, and let me know if you need further assistance!
@aweech@SinghAnnu
Hi,
we have previously investigated this possibility and found that DGN V8 is a closed format, specification, documentation for which is not available. The complexity of implementation is unknown as well. So we don’t have plans to implement it. But let us investigate this question internally one more time and come back with more information.
@SinghAnnu@aweech,
Hello,
we hope we have found a way to implement support for DGN V8 file version. The estimated time of delivery is close to the end of the year, but we will be happy to deliver faster.