Line types with text

1
Chris Smith
12/7/2021 5:04 AM

Hi Wout,

Just wondering if line types with text are supported in Cadlib? I saw this post which seemed to suggest it would work https://www.woutware.com/Forum/Topic/248 however it doesn't seem to when we render to png (see attached pictures, map... is the cadlib version, acad... is the autocad version).

Is this something that's become broken?

Cheers,
Chris

Chris Smith
12/7/2021 11:10 PM

Hi Wout,

Attached is a drawing with a poly line that has a complex line type with text in it.

Code to render (using Linqpad) is:

C# Code:
DxfModel dxf = DwgReader.Read(@"C:\temp\linetype.dwg");

var width = 1000;
var height = 1000;

var gdiGraphics3D = new GDIGraphics3D(GraphicsConfig.BlackBackgroundCorrectForBackColor);
gdiGraphics3D.CreateDrawables(dxf);

var bounds = new Bounds3D();
gdiGraphics3D.BoundingBox(bounds, Matrix4D.Identity);

Matrix4D transform = DxfUtil.GetScaleTransform(
                    bounds.Corner1,
                    bounds.Corner2,
                    bounds.Center,
                    new Point3D(0d, height, 0d),
                    new Point3D(width, 0d, 0d),
                    new Point3D(width / 2, height / 2, 0d)
                );


Bitmap bitmap = ImageExporter.CreateBitmap(
                        dxf,
                        transform,
                        GraphicsConfig.BlackBackgroundCorrectForBackColor,
                        System.Drawing.Drawing2D.SmoothingMode.HighQuality,
                        width,
                        height);
bitmap.Dump();

Cheers,
Chris

rammi
12/8/2021 11:18 AM

Hi Chris,

graphical line type elements are not handled by default. You'll have to set DisplayLineTypeElementShapes to true on the GraphicsConfig you use to create your GDIGraphics3D. That should do the trick.

- Rammi


Chris Smith
12/8/2021 10:44 PM

Ah great! Yes can confirm this works.

The doco suggests that there's a performance impact for enabling this - is it possible to give me some idea of how expensive it might be? (just rough order of magnitude 2x, 10x, 100x slower etc)

Or is it entirely dependent on how many lines and how many bits of text appear?

Cheers,
Chris

Wout
12/9/2021 12:02 AM

Hard to tell, it completely depends on the drawing. Since CadLib stores all shapes in memory before rendering for performance in terms of speed, it can quickly eat up a lot of memory if there's lines with lots of fine line type elements.

- Wout

1