Line weights seems to apply incorrectly for proxy object

1
Emilsson
3/8/2019 8:42 AM

Hi

I'm having a problem with line weights in proxy objects.

Consider the attached drawing. It contains a proxy object with two perpendicular lines centered on a circle. All objects have lineweights set to "ByLayer", with the circle's layer having 0.5 mm line width and the lines' layer 0.25 mm. To the left of the proxy object is an identical block I made of it using EXPLODE/MOVE/BLOCK. When I convert this drawing to PDF using my test program the block's line widths are rendered correctly in the PDF, but for some reason the perpendicular lines in the proxy object are rendered with the same width as the circle (0.5 mm).

If I use Autocad to plot to PDF the two objects look identical, so it would seem that Cadlib's rendering is incorrect.

I've attached the dwg and the pdf. Below is the code I use.

Best regards
Tomas Emilsson

C# Code:
namespace CadlibTest
{
    using System;
    using System.Diagnostics;
    using System.Drawing.Printing;
    using System.IO;
    using WW.Cad.Base;
    using WW.Cad.Drawing;
    using WW.Cad.IO;
    using WW.Cad.Model;
    using WW.Math;

    class Program
    {
        static void Main(string[] args)
        {
            const float Margin = .1f;
            string dwgPath = @"C:\Temp\Test.dwg";
            string pdfPath = dwgPath + ".pdf";

            DwgReader reader = new DwgReader(dwgPath)
            {
                LoadUnknownObjects = true
            };

            DxfModel model = reader.Read();
            model.Header.DisplayLineWeight = true;

            using (FileStream outStream = new FileStream(pdfPath, FileMode.Create))
            {
                PdfExporter pdfExporter = new PdfExporter(outStream) {PackContent = false};

                Bounds3D bounds = new Bounds3D(
                        model.Header.LimitsMin.X,
                        model.Header.LimitsMin.Y,
                        0.0d,
                        model.Header.LimitsMax.X,
                        model.Header.LimitsMax.Y,
                        0.0d);

                var boundsCorner1 = bounds.Corner1;
                var boundsCorner2 = bounds.Corner2;

                boundsCorner1.Add(-100, -100, 0);
                boundsCorner2.Add(100, 100, 0);

                bounds.Corner1 = boundsCorner1;
                bounds.Corner2 = boundsCorner2;
                PaperSize paperSize = PaperSizes.GetPaperSize(PaperKind.A3);

                paperSize.Width = Math.Max(paperSize.Width, (int)(bounds.Delta.X / bounds.Delta.Y * paperSize.Height));

                float pageWidth = paperSize.Width / 100f;
                float pageHeight = paperSize.Height / 100f;

                double scaling;
                Matrix4D to2DTransform = DxfUtil.GetScaleTransform(
                    bounds.Corner1,
                    bounds.Corner2,
                    new Point3D(bounds.Center.X, bounds.Corner2.Y, 0d),
                    new Point3D(new Vector3D(Margin, Margin, 0d) * PdfExporter.InchToPixel),
                    new Point3D(new Vector3D(pageWidth - Margin, pageHeight - Margin, 0d) * PdfExporter.InchToPixel),
                    new Point3D(new Vector3D(pageWidth / 2d, pageHeight - Margin, 0d) * PdfExporter.InchToPixel),
                    out scaling);

                GraphicsConfig graphicsConfig = (GraphicsConfig)GraphicsConfig.AcadLikeWithWhiteBackground.Clone();

                pdfExporter.DrawPage(model, graphicsConfig, to2DTransform, scaling, null, null, paperSize);
                pdfExporter.EndDocument();

                Process.Start(pdfPath);
            }
        }
    }
}

Emilsson
4/10/2019 7:17 AM

Has anyone looked at this?

Emilsson
5/7/2019 7:28 AM

Can I please get some feedback on this issue? Even if you're not going to fix it anytime soon, I would at least like to know that.

Wout
5/8/2019 12:52 AM

Apologies for the delay, I've just fixed the issue. A new version is available under Your resources in your user profile.

- Wout

Emilsson
5/8/2019 8:40 AM

That is great! Thank you!

1