Достъп до елементите вътре в блокови обекти
Contents
[
Hide
]Как да достъпвате елементите вътре в блокови обекти
Проблем: Как да достъпите елементите вътре в блокови обекти (CADNET-552).
Съвети: За да постигнете това, трябва да достъпите елементите вътре в блоковите обекти, трябва да достъпите блоковете в чертежа, след което трябва да използвате класа CadBlockEntity за достъп.
Пример:
This file contains 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(GetPath(fileName))) | |
{ | |
for (int i = 0; i < cadImage.Entities.Length; i++) | |
{ | |
if (cadImage.Entities[i].TypeName == CadEntityTypeName.INSERT) | |
{ | |
CadBlockEntity block = cadImage.BlockEntities[(cadImage.Entities[i] as CadInsertObject).Name]; | |
foreach (CadBaseEntity baseEntity in block.Entities) | |
{ | |
System.Console.WriteLine("Type = " + baseEntity.TypeName); | |
} | |
} |