DGN Version 8 files - Processing and Imaging issues

Dear Team,

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:

Extract Text from DGN file - Free Support Forum - aspose.com

Looking forward to your support !

Best Regards,
Annu Singh

@SinghAnnu

Cause

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:

  1. 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.

  2. Check for Updates: Ensure you are using the latest version of Aspose.CAD. Newer versions may add support for additional file formats or versions.

  3. 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

  1. Convert your DGN file to version 7 and see if that resolves the issue.
  2. If you continue to face problems, check for updates to the Aspose.CAD library.
  3. Implement the LoadOptions to manage loading errors as needed.

Please proceed with these steps, and let me know if you need further assistance!

@SinghAnnu,
Hi,
we don’t have support for DGN V8, only V7 is supported.

@oleksii.gorokhovatskyi is there any plan to support DGN v8? If not, can you please have it put on your product roadmap to support this?

@Professionalize.Discourse @oleksii.gorokhovatskyi

Thanks for your quick response!

We are using the code snippet below to convert a DGN file into a PDF, but we are encountering the same exception as mentioned earlier.

@CaptureSpan(subtype = “Aspose”, action = “convert”)
public static void convertDgnToPdf(String inputFilePath, String outputFilePath) throws IOException { ElasticApm.currentSpan().setLabel(INPUT_FORMAT_LABEL, “AutoCAD Design”); ElasticApm.currentSpan().setLabel(OUTPUT_FORMAT_LABEL, “PDF”);
try (com.aspose.cad.Image cadImage = com.aspose.cad.Image.load(inputFilePath)) {
cadImage.save(outputFilePath, new com.aspose.cad.imageoptions.PdfOptions());
} catch (Exception ex) {
throw new IOException("Cannot convert AutoCAD Design inputFilePath: " + inputFilePath + " outputFilePath: " + outputFilePath, ex); }}

Best Regards,
Annu Singh

@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.