블록 객체 내부의 엔티티에 접근하기
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); | |
} | |
} |