Acceso a entidades dentro de objetos de bloque
Contents
[
Hide
]Cómo acceder a entidades dentro de objetos de bloque
Problema: Cómo acceder a entidades dentro de objetos de bloque (CADNET-552).
Consejos: Para hacer esto, necesitas acceder a las entidades dentro de los objetos de bloque, necesitas acceder a los bloques en el dibujo, luego necesitas usar la clase CadBlockEntity para acceder.
Ejemplo:
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); | |
} | |
} |