cart: empty [ Login ]

Polyline is filled when exporting to png

1 
IgorK
7/18/2019 2:53 PM
Hi, Consider the attached dwg file. When I export it to png using the code below, the model is exported correctly, but the layout (A2.png) shows some entities filled with the color red.
C# Code:
public static void ExportToPng(string inputFile, string outPutFolder) { DxfModel model = DwgReader.Read(inputFile); foreach (DxfLayout layout in model.OrderedLayouts) { if (layout.Entities.Count > 0) { double xMin = 0; double yMin = 0; double xMax = 0; double yMax = 0; if (layout.PaperSpace) { xMin = layout.MinExtents.X; yMin = layout.MinExtents.Y; xMax = layout.MaxExtents.X; yMax = layout.MaxExtents.Y; } else { var boundsCalculator = new BoundsCalculator(); boundsCalculator.GetBounds(model); var boundsModel = boundsCalculator.Bounds; xMin = boundsModel.Min.X; yMin = boundsModel.Min.Y; xMax = boundsModel.Max.X; yMax = boundsModel.Max.Y; } if ((xMin + yMin + xMax + yMax) == 0) break; double larguraDesenho = xMax - xMin; double alturaDesenho = yMax - yMin; WW.Math.Point3D pontoATotal = new WW.Math.Point3D(xMin, yMin, 0); WW.Math.Point3D pontoBTotal = new WW.Math.Point3D(xMax, yMax, 0); Bounds3D boundsTotal = new Bounds3D(); boundsTotal.Update(pontoATotal); boundsTotal.Update(pontoBTotal); int width = 1800; int height = (int)((alturaDesenho * width) / larguraDesenho); var point1 = new WW.Math.Point3D(0, height - 1, 0); var point2 = new WW.Math.Point3D(width - 1, 0, 0); var to2DTransform = DxfUtil.GetScaleTransform(boundsTotal.Corner1, boundsTotal.Corner2, point1, point2); GraphicsConfig config = config = (GraphicsConfig)GraphicsConfig.AcadLikeWithBlackBackground.Clone(); config.DisplayLineTypeElementShapes = true; config.TryDrawingTextAsText = false; config.DisplayLineWeight = false; Bitmap bmp = ImageExporter.CreateBitmap(model, layout, null, config, System.Drawing.Color.Black, to2DTransform, new System.Drawing.Size(width, height)); using (MemoryStream stream = new MemoryStream()) { ImageExporter.EncodeImageToPng(bmp, stream); File.WriteAllBytes(string.Format("{0}{1}.png", outPutFolder, layout.Name), stream.ToArray()); } bmp.Dispose(); } } model.Dispose(); }
Is it a bug or there is something I can change in my code to correct that? Thank you.
A2.png
Model.png
IgorK
7/25/2019 7:18 PM
Hi, Any news about this issue? Thanks, Igor
Wout
7/29/2019 11:40 AM
Hi, The problem has been fixed, please download the latest version from Your resources in your user profile. - Wout
IgorK
11/18/2019 2:24 PM
Hi, We are having the same problem with another drawing. See attched example. Tested with version 4.0.38.200 Thanks, Igor
output.png
Wout
11/22/2019 3:49 PM
Hi, I can't seem to reproduce it, see attached screenshot. - Wout
lwpolyline.jpg
IgorK
12/10/2019 12:34 PM
Hi Wout, Please note that the problem occurs only on the layout A1, Model works fine. Also, just tested again with the original file on this topic and that problem is back as well. Testing with version 4.0.38.203 Thanks, Igor
Wout
12/12/2019 7:17 PM
Hi Igor, Should be fixed now, the problem was something different than I initially thought, there was a tricky floating point rounding issue in the viewport clipping. - Wout
1