Eyeshot Proprietary File Format

Eyeshot 11 includes the new proprietary file format (versioned) with options to save geometry only, tessellation only or both (to leverage file size vs. loading speed). It also supports entity types extension and file compression.

This file format will always be able to read old version files and will save the current version only.
You can check the field Serializer.LastVersion to know the latest supported version.

Serialization strategy

The Eyeshot file format is a binary format with a header and a body, based on the protobuf-net open source library.

General concepts

  • Surrogate: defines the properties to store.
    Each Eyeshot's object has its surrogate and implements the method
  • Model: contains the hierarchy's objects and defines the fields for each surrogate.
  • Serializer: performs the serialization/deserialization operations based on its model.

Relevant classes

devDept.Serialization namespace

  • FileHeader: contains basic info like file version, content type1, serialization mode2, units, etc.
  • FileBody: contains all the Eyeshot's objects like entities, layers, blocks, etc.
  • FileSerializer3: the serializer for the Eyeshot proprietary file format.

devDept.Eyeshot.Translators namespace

  • ReadFile: helper class to open a file.
  • WriteFile: helper class to save a file.

Code snippets

Open file

ReadFile readFile = new ReadFile(filename/*, new FileSerializerEx()*/); // If you need Autodesk objects, you have to reference the Eyeshot control x86 (or x64) assembly and pass the FileSerializerEx as parameter.

Save file

WriteFile writeFile = new WriteFile(new WriteFileParams(viewportLayout1), filename /*, new FileSerializerEx()*/); // If you need Autodesk objects, you have to pass the FileSerializerEx as parameter.
1 geometry: includes only geometrical data, i.e. for a circle Plane and radius (smaller file size, but slower loading process).
  tessellation: includes only tessellation data, i.e. for a circle the vertices (loading the file, the circle will be represented as a linear path)
  geometry&tessellation: includes both geometrical and tessellation data, i.e. for a circle Plane, radius, and vertices (bigger file size, but quickly loading process).

2Compressed or Uncompressed 

3To include also the Autodesk objects you have to use the FileSerializerEx. 



It can be easily extended with custom entities and custom data, you just need:

  • define surrogates for custom objects
  • create a derived FileSerializer3 class and make the override of the FillModel() method.
  • use the Tag field of the FileHeader to handle the custom objects version

A good starting point is the FileFormatExtension source code sample. 

using devDept.Serialization
public class CustomDataSurrogate : Surrogate {     public CustomDataSurrogate(CustomData obj) : base(obj) // The base calls the CopyDataFromObject method. { }
public int Id; public string Description; public float Price;
protected override CustomData ConvertToObject() { CustomData cd = new CustomData(Id); CopyDataToObject(cd); return cd; }
protected override void CopyDataToObject(CustomData cd) { cd.Description = Description; if (Tag == "1.1") cd.Price = 100; // forces the price for old version 1.1.  } protected override void CopyDataFromObject(CustomData cd) { Id = cd.Id; Description = cd.Description; Price = cd.Price; }
// those static methods must be created only for classes that derive from the Surrogate base class, no for custom entity surrogate, i.e. MyCircleSurrogate  #region Static Methods public static implicit operator CustomData(CustomDataSurrogate surrogate) { return surrogate == null ? null : surrogate.ConvertToObject(); } public static implicit operator CustomDataSurrogate(CustomData source) { return source == null ? null : source.ConvertToSurrogate(); } #endregion }
public class MyFileSerializer : FileSerializer
    // Tag to handle custom versions.
    public static string CustomTag = "1.2";
    // Constructor used in conjunction with the WriteFile class.   
    public MyFileSerializer()
    // Constructor used in conjunction with the ReadFile class.
    public MyFileSerializer(contentType contentType) : base(contentType)

    protected override void FillModel()
        if (ModelIsCompiled()) return;

base.FillModel(); // Adds the CustomData to the protobuf model and defines its surrogate. Model.Add(typeof(CustomData), false) .SetSurrogate(typeof(CustomDataSurrogate)); // Defines properties for CustomDataSurrogate MetaType mt = Model[typeof(CustomDataSurrogate)] .Add(1, "Id") .Add(2, "Description"); // Use the header tag to handle different definitions for your custom model. if (this.HeaderTag == "1.2") mt.Add(3, "Price"); mt.SetCallbacks(null, null, "BeforeDeserialize", null); // Fills Version and Tag during the deserialization. mt.UseConstructor = false; // Avoids to use the parameterless constructor during the serialization process. } protected override Type GetTypeForObject(string typeName) { // this override is available since build 12.0.518 Type t = Type.GetType(typeName, false, true); if (t != null) return t; return base.GetTypeForObject(typeName); } }

If instead, you need to serialize a derived class of an existing Eyeshot class, you may find useful this article.


  • Starting from Eyeshot 2020, the file format natively supports circular references for Entity classes.
  • Starting from Eyeshot 2021, the multi-file format is natively supported.
    Moreover, now you can store your custom data to the block object.
    Save the file with custom data
    model1.RootBlock.CustomData = customObject;
    var wfp = new WriteFileParams(model1);
    var wf = new WriteFile(wfp, fileName, new MyFileSerializer());
    Open file with custom data
    var rf = new ReadFile(fileName, new MyFileSerializer());
    var customObject = rf.Blocks.RootBlock.CustomData;


We perform a huge number of tests to verify backward reading compatibility for previous versions.
If you choose to extend it, please consider doing the same, and feel free to send us your unit test project to be notified of any changes that will affect your customizations.


Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request


  • I currently use BinaryFormatter. This is very inefficient compared to Protobuffers. But BinaryFormatter is so easy to use since the class description is included in the file. I would like to switch to Protobuffers for so many reasons.

    In this post, it looks like it is required to make a surrogate class for each of my 'real' classes. This is painful because I have 100s of my classes. Is there some automated way to do this?

    https://github.com/mgravell/protobuf-net - In this project, they use attributes. Even this is time consuming. They also have a method of creating a .proto file from the C# source that contains the integer/property definitions. Then the C# code does not require any changes. Maybe this would not work for you since you are deciding what to serialize at runtime (ie: tessellation)

    Also, does this support reference map serialization? A great feature of BinaryFormatter is it contains a reference map. So if you serialize circular references, or the same object multiple times, it deserializes exactly the same. I'm sure protobuffers does not by default, but there maybe an options.

    I guess it is not possible to serialize Eyeshot objects with other protobuf libraries such as the protobuf-net library above? I would prefer to use your system directly.


  • Hi James,

    protobuf-net supports the attributes definition but we use the surrogates to keep a clear separation between the Eyeshot objects definition and the one used for the serialization purpose. In this way, we can better handle versioning and overcome some limits about unsupported types in protobuf-net, like object, enum, multi-dimensional array, etc. Moreover, as you wrote, we can decide what to serialize at runtime according to the content type.

    Regarding the serialization of circular references, you can search on the web, this is one of the first result: https://stackoverflow.com/questions/7185632/understanding-protobuf-net-asreference-with-recursive-referencing


Please sign in to leave a comment.