사용자 정의 속성 추가
Contents
[
Hide
]이 방법은 DXF 및 DWG 파일 모두에서 작동합니다.
사용자 정의 속성 추가
Aspose.CAD for Java API를 사용하면 DXF 및 DWG 파일에 사용자 정의 속성을 추가할 수 있습니다. 이를 위해 API는 CadImage.Header.CustomProperties.Add 메서드를 제공합니다. 다음 코드 스니펫은 CadImage.Header.CustomProperties.Add 메서드를 사용하여 DXF 파일에 사용자 정의 속성을 추가하는 방법을 보여줍니다.
This file contains hidden or 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
// For complete examples and data files, please go to https://github.com/aspose-cad/Aspose.CAD-for-Java | |
String dataDir = Utils.getDataDir(ExportDXFToWMF.class) + "DXFDrawings/"; | |
String srcFile = dataDir + "conic_pyramid.dxf"; | |
String outFile = dataDir + "AddCustomProperties_out.dxf"; | |
CadImage cadImage = (CadImage)Image.load(srcFile); | |
cadImage.getHeader().getCustomProperties().put("CUSTOM_PROPERTY_1", "Custom property test 1"); | |
cadImage.getHeader().getCustomProperties().put("CUSTOM_PROPERTY_2", "Custom property test 2"); | |
cadImage.getHeader().getCustomProperties().put("CUSTOM_PROPERTY_3", "Custom property test 3"); | |
cadImage.save(outFile); |