This article explains how to import and export geometry from Eyeshot.
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 on 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.
A custom ReadOBJ class example follows (asynchronous read).
To avoid deriving a new class from ReadOBJ you can subscribe to the ViewportLayout.WorkCompletedEventHandler and access/change loaded items in the event handler.
DWG/DXF file formats
Dealing with DWG/DXF files in Eyeshot requires several additional steps compared to other standard CAD file formats. As all professional CAD systems do, Eyeshot relies on Open Design Alliance for this file format translation. You'll find all the necessary DLLs inside the Bin folders of the Eyeshot installation.
Basically, the required steps to read/write DWG/DXF files are:
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.
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 | Assembly |
DXF | ReadAutodesk class | WriteAutodesk class | devDept.Eyeshot.Control.x86.Wpf.v11.dll or .x64.Wpf.v11.dll |
DWG | ReadAutodesk class | WriteAutodesk class | devDept.Eyeshot.Control.x86.Wpf.v11.dll or .x64.Wpf.v11.dll |
OBJ | ReadOBJ class | WriteOBJ class | devDept.Eyeshot.Control.Wpf.v11.dll |
IGES | ReadIGES class | WriteIGES class | devDept.Eyeshot.Control.Wpf.v11.dll |
STEP | ReadSTEP class | WriteSTEP class | devDept.Eyeshot.Control.Wpf.v11.dll |
STL binary | ReadSTL class | WriteSTL class | devDept.Eyeshot.Control.Wpf.v11.dll |
STL ASCII | ReadSTL class | WriteSTL class | devDept.Eyeshot.Control.Wpf.v11.dll |
LAS | ReadLAS class | devDept.Eyeshot.Control.Wpf.v11.dll | |
ASC | ReadASC class | devDept.Eyeshot.Control.Wpf.v11.dll |
Table 1: Required classes for geometry import/export.