How to split multiple frames in a drawing into multiple DWG files in Batches?
@fei3977071,
please, try if this is useful:
using (CadImage cadImage = (CadImage)Image.Load(fileName))
{
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
CadLayoutDictionary layouts = cadImage.Layouts;
foreach (CadLayout layout in layouts.ValuesTyped)
{
rasterizationOptions.Layouts = new string[] { layout.LayoutName };
PdfOptions pdfOptions = new PdfOptions();
pdfOptions.VectorRasterizationOptions = rasterizationOptions;
cadImage.Save(outPath, pdfOptions);
}
}
@fei3977071,
for Java it look like this:
final CadImage cadImage = (CadImage)Image.load(in, opts);
CadRasterizationOptions cadRasterizationOptions = new CadRasterizationOptions();
for (String layoutName : cadImage.getLayouts().getKeysTyped())
{
cadRasterizationOptions.setLayouts(new String[] { layoutName });
PdfOptions pdfOptions = new PdfOptions();
pdfOptions.setVectorRasterizationOptions(cadRasterizationOptions);
cadImage.save(out, pdfOptions);
}
Thank you, But for Java How do I output files in DWG or DXF format?
@fei3977071,
we do not have support to save as DWG yet, but you may save as DXF - you need to specify not PdfOptions but DxfOptions instead.
no DxfOptions It’s not in the development kit
@fei3977071,
what do you mean?
Could you try this example:
for (String layoutName : cadImage.getLayouts().getKeysTyped())
{
cadRasterizationOptions.setLayouts(new String[] { layoutName });
DxfOptions dxfOptions = new DxfOptions();
dxfOptions.setVectorRasterizationOptions(cadRasterizationOptions);
cadImage.save(out + layoutName, dxfOptions);
}