This library reads CGM (Computer Graphics Metafile) in binary and clear text format. Read graphics can be modified, analyzed and exported. Creating new graphics is also supported.
It implements the ISO/IEC 8632-3:1999
and ISO/IEC 8632-4:1999
specification.
Some additional functions for reading technical documentation items (Figures, Names) etc are also implemented.
Add the NuGet package codessentials.CGM to any project supporting .NET Standard 2.0 or higher.
> dotnet add package codessentials.CGM
var writer = new CgmWriter(FileFormat.Binary);
writer.SetDescription("Created By UnitTest");
writer.SetElementList("DRAWINGPLUS");
writer.SetFontList(new[] { "Arial", "Arial Bold" });
writer.SetCharacterSetList(new[] { new KeyValuePair<CharacterSetList.Type, string>(CharacterSetList.Type._94_CHAR_G_SET, "B"), new KeyValuePair<CharacterSetList.Type, string>(CharacterSetList.Type._96_CHAR_G_SET, "A"), new KeyValuePair<CharacterSetList.Type, string>(CharacterSetList.Type.COMPLETE_CODE, "I"), new KeyValuePair<CharacterSetList.Type, string>(CharacterSetList.Type.COMPLETE_CODE, "L") });
writer.SetVDCType(VDCType.Type.Real);
// add several "drawing" commands
writer.AddCommand(...)
//
writer.Finish();
var data = writer.GetContent();
var cgm = new BinaryCgmFile("corvette.cgm");
// modify graphic
cgm.WriteFile();
var binaryFile = new BinaryCgmFile("corvette.cgm");
var cleanTextFile = new ClearTextCgmFile(binaryFile);
var content = cleanTextFile.GetContent();
Name | Description |
---|---|
ContainsTextElement | Determines whether any text element equals the specified text. |
GetMetaTitle | Gets the meta data title. |
GetGraphicName | Gets the title of the illustration. |
GetFigureItemTexts | Gets all texts of the figure items. |
ContainsFigureItemText | Determines whether CGM contains a specific figure item text. |
GetRectangles | Gets all found rectangles. |
The class GeometryRecognitionEngine
provides several functions to find rectangles.
Name | Description |
---|---|
GetRectangles | Gets all rectangles of the given file. |
IsNearBy | Determines whether point A is near point b. |