Page 1 of 1

Add DXF to the specified layer of CADImage

Posted: 10 Aug 2016, 05:20
by alex7210
HI,

I need to add the entity of DXF to the specified layer of CADImage.

I Found the function "CADmage.AddScaledDXF", but there was no layer parameter.

and so DXF data was added to "0" layer of CADIMage.

Is there any way to specify the target layer?

Best regards.

Alex

Re: Add DXF to the specified layer of CADImage

Posted: 10 Aug 2016, 16:47
by support
Hello Alex,

Unfortunately, there is no way to specify the target layer when adding a DXF file as external reference. However, you can change a layer for the added XREF later:

Code: Select all

private void ChangeXRefLayer(CADImage cadImage, string xRefName, string layerName)
{
    foreach (CADEntity entity in cadImage.Converter.Entities)
    {
        if ((entity.EntType == EntityType.Insert) & (entity.EntName == xRefName))
        {
            entity.Layer = cadImage.Converter.LayerByName(layerName);
            cadImage.Converter.Loads(entity);
        }
    }
}
Note: xRefName value should be equal to the external reference file name without the file extension. For example, if the XREF was loaded from the file "c:\drawing1.dxf", xRefName should be "drawing1".


Mikhail