Geometry Import/Export


Supposing you want to import an OBJ file (all the import methods follow the same scheme) you need the ReadOBJ class. This class gives you full control over all the imported items (entities, blocks, layers, materials, etc.) before adding them to the scene. During file import, you can also control whether to read the file synchronously or asynchronously. Read from stream is also supported through overloaded constructors.

A ReadOBJ class example follows (for synchronous read). The AddToScene() method takes care of adding all the necessary items in the correct order to the scene.

ReadOBJ ro = new ReadOBJ("fileName.obj"); 

// access/change the loaded items 
Entity[] entList = ro.Entities; 
MaterialKeyedCollection matList = ro.Materials;

// add items to the scene 

A custom ReadOBJ class example follows (asynchronous read).

public class MyReadOBJ : ReadOBJ
    public MyReadOBJ(string fileName) : base(fileName)
    protected override void WorkCompleted(devDept.Eyeshot.Environment environment)
       // access/change the loaded items
       Entity[] entList = Entities;

       // add items to the scene

// custom class usage
MyReadOBJ mro = new MyReadOBJ(fileName);

To avoid deriving a new class from ReadOBJ you can subscribe to the ViewportLayout.WorkCompletedEventHandler and access/change loaded items in the event handler.

public Form1()

    viewportLayout1.WorkCompleted += new devDept.Eyeshot.Design.WorkCompletedEventHandler(ViewportLayout1OnWorkCompleted);      
    ReadOBJ ro = new ReadOBJ("fileName.obj");


private void ViewportLayout1OnWorkCompleted(object sender, WorkCompletedEventArgs workCompletedEventArgs)
    ReadOBJ ro = (ReadOBJ)workCompletedEventArgs.WorkUnit;

    // access/change the loaded items
    Entity[] entList = ro.Entities;

    // add items to the scene

Note: During asynchronous read, you can change the progress bar text using the class ReadingText, LoadingText, LoadingEntitiesText, etc. properties.



Exporting geometry is straightforward. Assuming you want to write an OBJ file, you need the WriteOBJ class. Depending on the file format the desired unit system may need to be specified. To export the geometry asynchronously use ViewportLayout.StartWork() as explained above for import.

WriteParamsWithMaterials wpwm = new WriteParamsWithMaterials(viewportLayout1);

WriteOBJ wo = new WriteOBJ(wpwm, "fileName.obj");


Supported file formats

The following table summarizes the class names/assemblies involved in data translation. You'll find these classes inside the devDept.Eyeshot.Translators namespace.

File format Import Export Available from version
DXF ReadAutodesk class WriteAutodesk class  
DWG ReadAutodesk class WriteAutodesk class  
OBJ ReadOBJ class WriteOBJ class  
IGES ReadIGES class WriteIGES class  
STEP ReadSTEP class WriteSTEP class  
STL binary ReadSTL class WriteSTL class  
STL ASCII ReadSTL class WriteSTL class  
ASC ReadASC class WriteASC   
LAS ReadLAS class WriteLAS class 9
WebGL   WriteWebGL class 10
IFC ReadIFC class   11
3DS Read3DS class   11
3D PDF   WritePDF class  12
PRC   WritePRC class  12
DWF ReadDWF class    12
CNC ReadGCode class   2020
JT (up to version 9.5) ReadJT class   2020
PDF ReadPDF class   2021


DWG/DXF/DWF/3D PDF file formats 

As all professional CAD systems do, Eyeshot relies on Open Design Alliance for these file formats. 
We have specific articles on how to add the required DLLs for WinForms and WPF.

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


1 comment
  • Is JT Reader to be upgraded in order to import also new version of he file format?


Please sign in to leave a comment.