The problem of coordinate loss after converting dxf in aspose.cad

Hello!
When using aspose.cad to convert dwg to dxf, two issues were encountered:

  1. Use
    CadImage cadImage = (CadImage) Image.load(dwgPath);
    cadImage.save(outFile);
    When using the method, the conversion result may result in the loss of vector data such as annotated text and fillers on the drawing;
  2. Use
    CadRasterizationOptions cadOptions = new CadRasterizationOptions();
    ImageOptionsBase dxfOptions = new DxfOptions();
    cadImage.save(outFile, dxfOptions);
    When the ImageOptionsBase method is used as an input parameter, the processing result has a high degree of restoration, but the geographic coordinate information of the CAD source file will not be retained, resulting in the inability to perform secondary development of coordinate conversion in the future;
    May I ask how to balance or be compatible between the two methods, which can maintain the integrity of the original drawing data as much as possible while ensuring the coordinate information of the DWG? thank you very much!

@tianlong88,
Hi.

  1. Please, visualize what you mean exactly. Please share the initial file, code sample, so we can reproduce the issue on our side.
  2. I guess you mean here that the entire drawing shifts to another position instead of preserving the initial coordinates, we are already working with this issue. But showing us exactly what is wrong here could be useful too to avoid any confusion.

When I use the following method for conversion, I encounter the problem of incorrect coordinates in the screenshot below:
CadImage cadImage = (CadImage) Image.load(dwgPath);
CadRasterizationOptions cadOptions = new CadRasterizationOptions();
cadOptions.setPageWidth(cadImage.getWidth());
cadOptions.setPageHeight(cadImage.getHeight());
cadOptions.setDrawType(CadDrawTypeMode.UseObjectColor);
cadOptions.setExportAllLayoutContent(true);
DxfOptions dxfOptions = new DxfOptions();
dxfOptions.setVectorRasterizationOptions(cadOptions);
cadImage.save(outFile, dxfOptions);
image.png (43.5 KB)

Therefore, I would like to consult with you on how to maintain the original coordinate information of the drawing after the conversion is completed

@tianlong88,
right now there is no way to preserve the initial coordinates unfortunately and the entire drawing gets shifted. We are already working with the option to do it in the next versions. We have attached task CADJAVA-11645 to this forum thread so its status is visible at the bottom of this page.

ok, thank you!

1 Like