외부 파일에 대한 참조 가져오기
Contents
[
Hide
]외부 파일에 대한 참조 가져오는 방법
문제: 외부 파일에 대한 참조를 가져오는 방법 (CADNET-110).
팁: 엔티티 블록의 도면에 대한 외부 파일의 참조를 얻으려면 래스터 이미지에 대한 XRef PathName 필드가 있으며 CadRasterImage Def는 외부 하위 레이아웃에 사용되고 CadDgnUnderlay는 하위 레이아웃 및 해당 UnderlayPath 필드에 사용됩니다.
예시:
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
External drawing: | |
foreach (CadBaseEntity baseEntity in image.Entities) | |
{ | |
// if entity is a block | |
if (baseEntity.TypeName == CadEntityTypeName.INSERT) | |
{ | |
CadInsertObject insert = (CadInsertObject)baseEntity; | |
CadBlockEntity block = image.BlockEntities[insert.Name]; | |
// get external reference to object | |
System.Console.WriteLine(block.XRefPathName); | |
} | |
} | |
External raster image: | |
foreach (CadBaseObject baseObject in image.Objects) | |
{ | |
// if entity is an image definition | |
if (baseObject.TypeName == CadObjectTypeName.IMAGEDEF) | |
{ | |
CadRasterImageDef rasterImageDef = (CadRasterImageDef)baseObject; | |
// get external reference to object | |
System.Console.WriteLine(rasterImageDef.FileName); | |
} | |
} | |
External underlay: | |
foreach (CadBaseEntity baseEntity in cadImage.Entities) | |
{ | |
if (baseEntity.TypeName == CadEntityTypeName.DGNUNDERLAY) // or DWFUNDERLAY, or PDFUNDERLAY | |
{ | |
CadDgnUnderlay dgnFile = (CadDgnUnderlay)baseEntity; // or CadDwfUnderlay, or CadPdfUnderlay | |
System.Console.WriteLine(dgnFile.UnderlayPath); | |
} | |
} |