قراءة الجداول من DWG/DXF
Contents
[
Hide
]كيفية قراءة الجداول من DWG/DXF
المشكلة: كيفية قراءة الجداول من DWG/DXF.
نصائح: للقيام بذلك، يمكنك الحصول على الملف باستخدام طريقة التحميل، والحصول على الكيانات اللازمة.
ملحوظة: تعرض هذه المسألة مثالاً لاسترداد الجداول واسترداد القيم منها. بهذه الطريقة يمكنك الحصول على القيم المكتوبة في جداول الملف.
مثال:
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 var cadImage = (CadImage)Image.Load(GetFileFromDesktop(fileName1)); | |
List<CadBlockEntity> tableBlocks = new List<CadBlockEntity>(); | |
var entitys = cadImage.BlockEntities.ValuesTyped; | |
foreach (CadBlockEntity entity in entitys) | |
{ | |
if (entity.Name.StartsWith("*T")) | |
{ | |
tableBlocks.Add(entity); | |
} | |
} | |
var textElements = tableBlocks.FirstOrDefault().Entities; | |
foreach (var entity in textElements) | |
{ | |
if (entity.TypeName == CadEntityTypeName.TEXT) | |
{ | |
System.Console.WriteLine("Table Text " + (entity as CadText).DefaultValue); | |
} | |
if (entity.TypeName == CadEntityTypeName.MTEXT) | |
{ | |
System.Console.WriteLine("Table Mtext " + (entity as CadMText).FullClearText); | |
} | |
} |