קריאת טבלאות מ-DWG/DXF
Contents
[
Hide
]איך לקרוא טבלאות מ-DWG/DXF
בעיה: איך לקרוא טבלאות מ-DWG/DXF.
טיפים: כדי לעשות זאת, אתה יכול לקבל את הקובץ באמצעות המתודולוגיה load, לקבל את הישויות הדרושות.
הערה: קטע הקוד הזה מציג דוגמה לשליפת טבלאות ושליפת ערכים מהן. כך תוכל לקבל את הערכים כתובים בטבלאות של הקובץ.
דוגמה:
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); | |
} | |
} |