カスタムプロパティを追加

カスタムプロパティを追加

Aspose.CAD for .NET APIを使用すると、DXFファイルとDWGファイルにカスタムプロパティを追加できます。これには、APIがCadImage.Header.CustomProperties.Addメソッドを提供しています。 以下のコードスニペットは、CadImage.Header.CustomProperties.Addメソッドを使用してDXFファイルにカスタムプロパティを追加する方法を示しています。

// For complete examples and data files, please go to https://github.com/aspose-cad/Aspose.CAD-for-.NET
// The path to the documents directory.
string WorkingDir = RunExamples.GetDataDir_DXFDrawings();
string fileName = "conic_pyramid.dxf";
string inputFile = WorkingDir + fileName;
string outFile = WorkingDir + "AddMetadata_out.dxf";
using (var cadImage = (CadImage)Image.Load(inputFile))
{
cadImage.Header.CustomProperties.Add("CUSTOM_PROPERTY_1", "Custom property test 1");
cadImage.Header.CustomProperties.Add("CUSTOM_PROPERTY_2", "Custom property test 2");
cadImage.Header.CustomProperties.Add("CUSTOM_PROPERTY_3", "Custom property test 3");
cadImage.Save(outFile);
}