ATTRIB 및 MTEXT 객체 설정
Contents
[
Hide
]ATTRIB 및 MTEXT 객체 설정
Aspose.CAD for Java API를 사용하면 DXF AutoCAD 파일에서 속성을 설정할 수 있습니다. Aspose.CAD API는 DXF AutoCAD 파일에서 텍스트 엔티티를 나타내는 CadText 클래스를 노출합니다. 몇몇 다른 엔티티도 텍스트를 포함할 수 있기 때문에 CadMText 클래스가 Aspose.CAD API에 포함되어 있습니다. 여러 단락을 단일 다중 행 텍스트 (mtext) 객체로 만들 수 있습니다. 다음은 속성과 MTEXT 객체를 설정하는 코드 예제입니다. 코드 조각은 자기 설명적입니다.
샘플 코드
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
String srcFile = dataDir + "conic_pyramid.dxf"; | |
CadImage cadImage =(CadImage) Image.load(srcFile); | |
List<CadBaseEntity> mtextList = new ArrayList<CadBaseEntity>(); | |
List<CadBaseEntity> attribList = new ArrayList<CadBaseEntity>(); | |
try | |
{ | |
for (CadBaseEntity entity : cadImage.getEntities()) | |
{ | |
if (entity.getTypeName() == CadEntityTypeName.MTEXT) | |
{ | |
mtextList.add(entity); | |
} | |
if (entity.getTypeName() == CadEntityTypeName.INSERT) | |
{ | |
for (CadBaseEntity childObject : entity.getChildObjects()) | |
{ | |
if (childObject.getTypeName() == CadEntityTypeName.ATTRIB) | |
{ | |
attribList.add(childObject); | |
} | |
} | |
} | |
} | |
System.out.println("MText Size: "+ mtextList.size()); | |
System.out.println("Attribute Size: "+ attribList.size()); | |
} | |
finally | |
{ | |
cadImage.dispose(); | |
} | |