Exports of drawing Compass-graphic 2D to SVG

In "Drawings in SVG format. Part 1 - Draft Standard" is an example of the object model of the drawing, reference scale and line styles.
Building on the basic principles of drawing for 2D Compass-graphic set up a test alpha version of the library exports to SVG.

The library works to the version of "Compass graphic" 9 and above. Connected as all the usual library.
archive of the library and test example

The list of possible options:

  • type of document - drawing a standard or custom size,
  • the default skin only - The drawing Design. The first sheet
  • export of species with color and scale
  • export layers indicating color
  • Export of graphic elements: line, arc, circle, point, NURBS, ellipse, rectangle, polyline.

Test your drawing file, more than 3,000 items.

When you export the selected parameters both for the printing:

  • black (black and white)
  • established for the species (the color of the species)
  • set for the layer (the color of the layer)
  • set for the object (as normally displayed in a Compass-graphic )

You can display all the thin lines.

Comparative table of the file size in different formats

File The result, byte
Чертеж.cdw (Compass-graphic 9) 182 828
Zip file Чертеж.cdw (Compass-graphic 9) 69 274
The result of the export file Чертеж.cdw in unnamet.svg 306 678
Zip фай unnamet.svg 55 763
Bitmap file, format .PNG 57 384

Note: When you export comments were recorded and the class members asked for in the form of "line-type-1" instead of a short "lt1". For the Compass-graphic is not used the latest version.

In the test, there is not as graphic elements dimensions and other complex elements of the drawing for a full comparison of dimensions the binary file and the text for the description of the drawing. But one can already see that in the text format SVG is not so bad. When describing the drawing format JavaScript function can dramatically reduce the text file and do not give in binary.