Skip to content

TextEntity Vertical and Horizontal Alignment on Dwg Writer #730

@thaiguer

Description

@thaiguer

Describe the bug
The TextEntity objects have incorrect visual aspect when VerticalAlignment and HorizontalAlignment properties are set in the given way.

To Reproduce
Use the following code:

using ACadSharp;
using ACadSharp.Entities;
using ACadSharp.IO;
using CSMath;

var doc = new CadDocument();

var text = new TextEntity
{
    Value = "My Text Content",
    InsertPoint = new XYZ(0, 0, 0),
    AlignmentPoint = new XYZ(0, 0, 0),
    Height = 2,
    VerticalAlignment = TextVerticalAlignmentType.Middle, //this line generates a problem with dwg files
    HorizontalAlignment = TextHorizontalAlignment.Center //and this line also generates a problem dwg files
};
doc.ModelSpace.Entities.Add(text);

using (var dwgWriter = new DwgWriter(@"c:\dev\dwgFileIncorrectBehavior.dwg", doc))
{
    dwgWriter.Write();
}

using (var dxfWriter = new DxfWriter(@"c:\dev\dxfFileAwesome.dxf", doc, false))
{
    dxfWriter.Write();
}

Two files are going to be created. The dxf file works as expected. The dwg file has the visual issue.

Print of dxf file on BricsCad:
Image

Print of dwg file on BricsCad:
Image

Expected behavior
The TextEntity should have on dwg file the same visual aspect as in the dxf file (centralized).

Additional context
The dwg isn't all incorrect. If the TextEntity objects are moved, the expected behavior is shown (the TextEntity start to be visually is centralized):

Print after using the command MOVE on the TextEntity on the dwg file:
Image


Release needed

  • Yes, using the Nuget package.
  • No, using the github repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions