Free Support Forum - aspose.com

Cannot get layout of some DXF file

Hi.

I cannot get layout of this DXF file.
MHMD02__31N.zip (17.0 KB)

I use the following code:

public static void main(String[] args) 
    {
       //ExStart:ListLayouts
       String dataDir = Utils.getDataDir(ListLayouts.class) + "CADConversion/";
       String sourceFilePath = dataDir + "MHMD02__31N.dxf";
     
       Image image = Image.load(sourceFilePath);
       
       CadImage cadImage = (CadImage)image;
       
        CadLayoutDictionary layouts = cadImage.getLayouts();
        for (CadLayout layout : layouts.getValues())
        {
                    
            System.out.println("Layout " +layout.getLayoutName());
        }
       
       //ExEnd:ListLayouts
    }
 

Other DXF files, I can get.
Except this.

Are there specific DXF files restricted by the CadLayoutDictionary getLayouts method?

Note that if you use AutoCad software, you can see that there are 2 layouts “Model” and “Layout1”.

@franciss

It seems to be an issue while accessing the layouts of the DXF file you have shared. A ticket with ID CADJAVA-10154 has been created to further investigate and resolve the issue . This thread has been linked with the issue so that you may be notified once the issue will be fixed.

1 Like

@franciss

The DXF file that you have shared has DXF R12 format. According to this, it does not store any information about layouts except their names. So, in this case, the CadLayoutDictionary contains only the keys with the layer names and values that are null. You can use the following code snipped to walk over all layouts names:

CadLayoutDictionary layouts = cadImage.Layouts;
for (string layout : layouts.KeysTyped) {
    rasterizationOptions.Layouts = new string[] {layout};
}