Điều chỉnh kích thước văn bản cho DXF/DWG
Contents
[
Hide
]Cách điều chỉnh kích thước văn bản cho DXF/DWG
Vấn đề: Cách điều chỉnh kích thước văn bản cho DXF/DWG.
Mẹo: Để làm điều này, bạn có thể sử dụng tham số TextHeight trong các thực thể, nhưng hãy nhớ rằng quyền truy cập vào tham số này có thể khác nhau đối với các đối tượng khác nhau.
Ví dụ:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fileName = @"facade_example.dwg"; | |
using CadImage cadImage = (CadImage) Image.Load(fileName); | |
foreach (CadBaseEntity entity in cadImage.Entities) | |
{ | |
if (entity is CadMText text && text.Text.Contains("Etage")) | |
{ | |
text.InitialTextHeight = 120; | |
} | |
if (entity is CadText cadText) | |
{ | |
cadText.TextHeight = 120; | |
} | |
if (entity is CadMLeader leader) | |
{ | |
leader.ContextData.TextHeight = 120; | |
} | |
if (entity is CadTolerance tolerance) | |
{ | |
cadImage.DimensionStyles[tolerance.DimensionStyleName].Dimtxt = 120; | |
} | |
} | |
cadImage.Save("facade_example_inc_text.pdf", new PdfOptions()); |