Hello,
We were looking for documentation and questions, but didn’t find anything relevant related to this topic, so we would like to know if there is a way to generate a single DXF file consisting from many DXF files we load as CadImage objects.
Could you please let us know if this is feasible?
Thank you,
Andrei
@andreimoldovansnapon,
Hi.
We do not have a sort of native support for merging DXF, the complexity of this problem depends on the content of DXF. It is possible to copy entities from one CadImage to another, but except of entities it is required to copy all text and dimension styles, blocks, objects, layouts, layers, etc., preserving the uniqueness of object handles and relations between entities inside every drawing in the scope of the bigger drawing.
1 Like
@oleksii.gorokhovatskyi, thank you for your follow-up.
We managed to add the content (of separate DXFs) in two rectangles inside a SVG file, but when we convert the SVG to DXF, our rectangles are placed inside another (outer) rectangle.
Please let us know whether there is a way to deactivate the generation of the outer border from rasterization or DXF options objects. These borders seem to be extra entities for us.
Below is the code we use to convert SVG to DXF. It uses Aspose.Imaging library.
Regards,
Andrei
public static void ConvertSvgToDxf(string inputFile, string outputFile)
{
using (var image = Image.Load(inputFile))
{
ImageOptionsBase exportOptions = new DxfOptions
{
TextAsLines = false,
ConvertTextBeziers = false
};
if (image is VectorImage)
{
using (VectorRasterizationOptions rasterizationOptions = new SvgRasterizationOptions())
{
var ratio = 71.6f;
rasterizationOptions.PageWidth = image.Width / ratio;
rasterizationOptions.PageHeight = image.Height / ratio;
exportOptions.VectorRasterizationOptions = rasterizationOptions;
}
}
image.Save(outputFile, exportOptions);
}
}
@andreimoldovansnapon,
could you please also share the code for merging DXF, drawing rectangles and initial files, so we can see the entire picture of the processing?
Abcd123.zip (1.3 KB)
@oleksii.gorokhovatskyi , we didn’t write any code to merge DXFs. Instead, we created (without Aspose) a SVG file that contains what both DXFs contain by putting each DXF content inside a rectangle.
The problem with the code above is that the SVG input is added inside a (new) rectangle (rectangle size is rasterizationOptions.PageWidth x rasterizationOptions.PageHeight).
We would like to only get rid of the newly created rectangle (the outer one) in the output DXF.
As per your request, we attached a zip with a sample SVG file and the DXF created by the code above. As you can see, the SVG has no rectangle, this is added during the conversion on the output DXF file.
Could you please advise?
Thank you,
Andrei
@andreimoldovansnapon,
thank you, I can see. Please give us some time to look at this, I have also invited colleagues from Aspose.Imaging team to comment on this.
@andreimoldovansnapon, Hi,
Could you please add the following option:
rasterizationOptions.BackgroundColor = Color.Empty;
This should help.
1 Like
@stanislav.popov , thank your for your feedback.
I confirm the option worked for us.
Regards,
Andrei
1 Like