Hello,
We have been using the aspose.imaging product family to convert .svg to .dxf.
However, the aspose.imaging product doesn’t support layers in the output .dxf file. Does the aspose.CAD product family support the ability to transform .svg to .dxf and include multiple layers?
@colinletson
Yes, the Aspose.CAD product family does support the ability to transform SVG files into DXF format while including multiple layers. Unlike Aspose.Imaging, which does not support layers in the output DXF file, Aspose.CAD allows you to work with layers effectively.
You can specify which layers to include during the conversion process. For example, you can create an instance of CadRasterizationOptions
and set the desired layers using the setLayers
method. This allows you to control which layers from the original CAD drawing are included in the output DXF file.
Here’s a brief code example demonstrating how to convert a DXF file while specifying layers:
import com.aspose.cad.Image;
import com.aspose.cad.imageoptions.CadRasterizationOptions;
import com.aspose.cad.imageoptions.PdfOptions;
public class ConvertDXFWithLayers {
public static void main(String[] args) {
// Load the DXF file
String srcFile = "path/to/your/file.dxf";
Image image = Image.load(srcFile);
// Create an instance of CadRasterizationOptions
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
rasterizationOptions.setPageWidth(1600);
rasterizationOptions.setPageHeight(1600);
// Specify the layers to include
List<String> layers = Arrays.asList("Layer1", "Layer2"); // Replace with your layer names
rasterizationOptions.setLayers(layers);
// Create PDF options and set the rasterization options
PdfOptions pdfOptions = new PdfOptions();
pdfOptions.setVectorRasterizationOptions(rasterizationOptions);
// Save the output as a PDF
image.save("output.pdf", pdfOptions);
}
}
In this example, you can replace "Layer1"
and "Layer2"
with the actual names of the layers you want to include in the output. This flexibility allows you to manage the layers effectively during the conversion process.
For more detailed information, you can refer to the Aspose.CAD documentation here.
If you have any further questions or need additional assistance, feel free to ask!
Thank you for the input, but we are not trying to convert a DXF to PDF. Instead we want to convert SVG to DXF
@colinletson,
Hi,
we don’t have this feature too unfortunately. We have logged the corresponding CADNET-9904 ticket to investigate this and implement if possible.
@colinletson,
Hello.
Could you please share the sample SVG file with layers?
Here are two files we have used:
The original dwg with layers
and a converted svg from the dwg that we would want to convert to dxf
Sorry, it seems that the files aren’t supported to be uploaded here
I have created a .zip file
Aspose_Docs.zip (25.9 KB)