ปรับขนาดตัวอักษรสำหรับ DXF/DWG

วิธีการปรับขนาดตัวอักษรสำหรับ DXF/DWG

ปัญหา: วิธีการปรับขนาดตัวอักษรสำหรับ DXF/DWG.

เคล็ดลับ: เพื่อทำเช่นนี้ คุณสามารถใช้พารามิเตอร์ TextHeight ในเอนทิตี แต่โปรดคำนึงถึงว่าการเข้าถึงพารามิเตอร์อาจแตกต่างกันสำหรับวัตถุที่แตกต่างกัน.

ตัวอย่าง:

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());