DXF to image: change lineweight

we built our first mockup of our new software and tested the aspose CAD API for converting existing dxf to images. everything works fine except sometimes the lineweight is to “light” and we want to make the line better visible. I have found this support topic:

maybe there could be some interesting information in the *.docx but I can not open it.

many thanks for tips how to change the lineweight

Best regards,

Good to hear your integration goes smoothly. Here a situation with line weights:
Displaying of lineweights in Autocad is subjective. Showing of them is controlled by LWDISPLAY command, which is saved in the header of the file.
Lineweight thickness view in Autocad is controlled with LWEIGHT command and “Adjust display scale” bar in it. It is not stored in file and we do not know from the drawing what is this display scale coefficient.

So, we can not scale lineweight exactly like Autocad. We can rely only on the lineweight numerical values and we always apply them in drawing. For instance, the lineweight of the purple color in this file (HOLZ + GLAS layer) is 0.3 mm, and the default value (thin lines) is 0.25, the difference is not so sufficient, like it is shown in Autocad due to this “Display scale” option.
But you can adjust line weights manually with such code example before the export to make lines showing thicker:

foreach (CadLayerTable layer in cadImage.Layers)
      System.Console.WriteLine(layer.Name + " " + layer.LineWeight);                        
      // -3 means default linewidth set by LWDEFAULT, may be processed separately
      if (layer.LineWeight > 0)
          layer.LineWeight *= 5;

Please contact us if you have ay other questions.

I wrote a Code like below, but my cadImage object doesn’t have layers-properties

What’s wrong here?

I want to save a (AutoCAD-)dxf file to jpg with thicker lines than it would do without any changes. The drawings are usually without specific lineweights (they are defined by layer > and in the layer-properties is the lineweight ‘default’) like in mydrawing.dxf attached.

string filePath = "C:\mydrawing.dxf";
string jpgPath = "C:\picture.jpg";

using (Aspose.CAD.Image cadImage = Aspose.CAD.Image.Load(filePath))

     // when I do this, the compiler told me there is no definition for Layers, is there a using-directive missing..
     // foreach(CadLayerTable layer in cadImage.Layers) {}

    Aspose.CAD.ImageOptions.CadRasterizationOptions options = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
    options.PageWidth = (float)800 / cadImage.Height * cadImage.Width;
    if (options.PageWidth < 200)
        options.PageWidth = 200;
    options.PageHeight = 800;

   options.Layouts = new string[] { "Model" };
    var jpgOptions = new Aspose.CAD.ImageOptions.JpegOptions();
    jpgOptions.VectorRasterizationOptions = options;
    cadImage.Save(jpgPath, jpgOptions);

mydrawing.zip (9.0 KB)

Many thanks,

please try using this load of an image:

 using (CadImage cadImage = (CadImage)Aspose.CAD.Image.Load(filePath))

Many thanks! this works well

Thanks for your feedback