เพิ่มคุณสมบัติตามที่กำหนด

เพิ่มคุณสมบัติตามที่กำหนด

Aspose.CAD สำหรับ Java API ช่วยให้คุณสามารถเพิ่มคุณสมบัติตามที่กำหนดในไฟล์ DXF และ DWG ได้ สำหรับสิ่งนี้ API จะจัดเตรียม CadImage.Header.CustomProperties.Add วิธีการ. โค้ดตัวอย่างต่อไปนี้จะแสดงวิธีการเพิ่มคุณสมบัติตามที่กำหนดในไฟล์ DXF โดยใช้ CadImage.Header.CustomProperties.Add วิธีการ.

// 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);