This project has moved and is read-only. For the latest updates, please go here.

Text alignment

Feb 16, 2016 at 9:05 AM
It is possible to fit a text between two points using net dxf?
I see in WriteText() function at DxfWriter.cs that the same point is used for codes 10,20,30 and 11,21,31.
This has no effect in almost all the text alignments, but in the case of a Fit, the second point coincidence makes the Fit useless. I think that the same occurs with the Aligned option.
Is there any way to change this behaviour? Is there any plan to change the code and support TextAlignment.Fit and/or TextAlignment.Aligned?
Thanks in advance!
private void WriteText(Text text)
    this.chunk.Write(10, ocsBasePoint.X);
    this.chunk.Write(20, ocsBasePoint.Y);
    this.chunk.Write(30, ocsBasePoint.Z);
    this.chunk.Write(11, ocsBasePoint.X);
    this.chunk.Write(21, ocsBasePoint.Y);
    this.chunk.Write(31, ocsBasePoint.Z);
Feb 18, 2016 at 6:07 PM
If I remember correctly when I did it, it was a long time ago, to calculate the alignment point (codes 11, 21, 31) I need it to calculate the length of the text string, and I do not have a way to do that, therefore the alignment options will not work for Text entities. I would recommend to use the MText entity instead, it supersedes the Text entity and is now the default way of writing texts in AutoCad.

Feb 19, 2016 at 1:05 PM
Thanks for your attention, Daniel
I will try to work with MText from now on.