ดึงทุกเอนทิตี TEXT/MTEXT จาก DWG/DXF
Contents
[
Hide
]วิธีการดึงทุกเอนทิตี TEXT/MTEXT จาก DWG/DXF
ปัญหา: วิธีการดึงทุกเอนทิตี TEXT/MTEXT จาก DWG/DXF.
เคล็ดลับ: เพื่อทำเช่นนี้ คุณต้องดึงเอนทิตี CadText(DefaultValue) และ CadMText(FullClearText) จากภาพวาด.
ตัวอย่าง:
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
using CadImage cadImage = (CadImage)Image.Load(fileName); | |
foreach (CadBaseEntity entity in cadImage.Entities) | |
{ | |
if (entity.GetType() == typeof(CadText)) | |
{ | |
CadText text = (CadText)entity; | |
System.Console.WriteLine(text.DefaultValue); | |
} | |
if (entity.GetType() == typeof(CadMText)) | |
{ | |
CadMText mtext = (CadMText)entity; | |
System.Console.WriteLine(mtext.FullClearText); | |
} | |
} |