Eyeshot 10—Bringing CAD Functionality to .NET Applications

Eyeshot is the only 100% fully managed code CAD component for .NET. With support for both WinForms and WPF, Eyeshot provides a ViewportLayout control along with an extensive API to enable developers to implement a custom-tailored CAD experience for their end users.

In this article, I take an in-depth look at the product by explaining how it works, where it can be used, its performance, and how to integrate it into an application programmatically.

About devDept

Eyeshot is developed by Italian company devDept Software. Founded in 2006, devDept has been providing .NET developers with CAD components for over a decade. With this experience, Eyeshot boasts unmatched stability with various video hardware and drivers.

Applications

With support for both 2D and 3D models, Eyeshot can be applied in a wide variety of applications. One of the most impressive features is its DICOM support. DICOM is used in medical applications to aid in the visualization of 3D volumes of layered images that are generated from MRI and CAT scans.

Eyeshot allows for the import and export of DXF, DWG, OBJ, STL, AS, IGES and STEP files (IGES and STEP are only available in the Ultimate SKU). The ViewportLayout control is then used as the environment for interacting and manipulating them. In its simplest form, Eyeshot can be used as a CAD file visualizer embedded within a custom application. This comes in handy if it is necessary to provide a useful file library application that allows users to see the contents of the files.

It’s important to note that the ViewportLayout is not limited to a static visualization on a 3D plane. Eyeshot also offers the ability to add animations to objects in the ViewportLayout. This can be used to help the user visualize component movement in a simulated environment, or to provide visual details on the assembly of a complex product. This is a great application of the component for the product manufacturing space.

Eyeshot is not limited to a read-only environment. It can be used to modify and enhance existing CAD files, or to allow users to create their own designs from scratch. Due to the flexible nature of the APIs available, developers can also provide users with custom toolbar items that automate and simplify common tasks and modify the user interface to allow for maximum productivity.

By taking advantage of WPF MVVM binding, developers can provide users with a streamlined interface for parametric models by allowing users to manipulate dimensions to their liking, and customize their designs by applying colors and materials to different components. When a design is done, files can be saved or exported in popular CAD formats, or printed using custom documents on a paper-fed printer. Users can also export their designs for 3D printing and laser-cutting applications.

Eyeshot can also be used as a pure graphics application. It provides support for wireframes, shaders, anti-aliasing, and frame rates, and multiple viewport support. Walk through designed worlds in the first person, examine entities close up, or even fly through the air.

Beyond product design and manufacturing and graphics applications, further uses of Eyeshot include user creation of 3D renderings for things like topographical maps, and the performance of surface reconstruction.

Helpful Design Features

Eyeshot has multiple integrated features that you would expect in costly commercial CAD packages. This includes the ability to apply boolean functions to elements and perform calculations for properties such as area, mass, and volume. Common entity operations such as extrusion and transformation functions are also readily accessible through the API.

Layers support is also available, allowing the separation of elements into logical layers to better organize and manipulate a design. The ViewportLayout control can be subdivided into multiple panes. With this, users can manipulate multiple designs at the same time. Full copy-and-paste functionality is included so that elements can be added into multiple panes easily.

Eyeshot also provides a rich selection experience through the use of a selection filter. This means the user can be given the choice of a selection mode that will let them select entire entities, specific faces, edges or vertices.

Other helpful features include Mesh entity support and texture mapping (a method to apply a flat raster image on a tridimensional surface).

Finite Element Method Features

Part of the design process for most mechanical parts and structures involves learning how the design would react to real-world scenarios. Eyeshot’s FEM support includes logic for conditions such as pressure and temperature. To ensure accuracy, the API also provides multiple built-in elements to aid in the engineering of a structure, including trusses, beams, hinges, and joints. On top of this, various materials are included for square, rectangular, circular, and I, C and T sections. Using these elements, an analysis can be performed to guarantee safety and stability, as well as calculate the limits of the design. FEM features are included in the Ultimate SKU of the product.

Performance

In addition to hardware compatibility, over the years, devDept has also concentrated on performance. This is evident in how they leverage multi-threaded/parallel computing to perform expensive operations. With their extensive experience, they are also very fluent in the use of OpenGL and DirectX for rendering and taking advantage of the GPU when present for graphics-intensive applications.

Programmability

When developing a simple viewer application, very little custom programming is needed. When developing more interactive user experiences, it’s imperative that developers have a firm grasp in graphics programming and the associated mathematics. While specific experience with CAD programming is not required, enough knowledge surrounding grid systems and geometry is critical. Experience with WinForms or WPF graphic libraries is also very important in order to do such things as detecting the location of mouse click events in the ViewportLayout control.

Full documentation of the Eyeshot libraries isavailable online. The libraries provide many building blocks for developers. In particular, theEntities namespace gives constructors for many common shapes.

First, open Visual Studio 2017, and create a new C# WPF application. Drag and drop a new ViewportLayout control to your design surface.

When prompted, select the Clean White view.

You can see from this screenshot that the ViewportLayout is a very powerful control. In addition to specifying the background color, you can see multiple types of views from the left list box, including single layout, dual layout, triple layout and quad layout. Implementing support for manipulating multiple designs on one screen is as simple as choosing one of those options.

Resize the control to take up most of the screen.

In MainPage.xaml.cs, ensure the following using statements are present:

1

2

3

4

using devDept.Eyeshot.Entities;

using devDept.Geometry;

using System;

using System.Windows;

Then, add the following code to implement the drawing of the bracket (documented inline):

When you run the application, you will see the bracket rendered in the ViewportLayout control. Spend a few moments manipulating the view by using the zoom functions and manipulating the orientation of the design by interacting with the cube in the upper right corner of the ViewportLayout control. The resulting geometry can be exported in STEP and IGES file formats to be transferred to other CAD systems.

Test this component out further by utilizing the automatic 2D vector drawing generation of isometric and orthogonal views to create comprehensive technical documentation. The same approach can be used to copy and paste detailed 2D views in your Word or Excel documents.

Deployment and Support

Eyeshot is licensed per developer and provides royalty-free deployment. This means there are no hidden costs and you are free to distribute the controls and libraries within your application. These libraries are also built against AnyCPU to allow for easy deployment.

A fully functional 30-day trial is available for download on their website. devDept also provides free support during the trial and has a community forum should you encounter any issues or need guidance with a particular task. Installed with the product is alibrary of code samples in both VB.NET and C# to help get you started.

Conclusion

If you have the need to include CAD-like functionality in your .NET applications, I urge you to give Eyeshot a try. This article is only a high-level view of all the functionality available from this component. Eyeshot can be applied as a feature in an existing application, or can serve as a foundation for a complete CAD solution.

Do you think you can beat this Sweet post?

If so, you may have what it takes to become a Sweetcode contributor... Learn More.

Carey Payette is a Senior Software Engineer with Falafel Software as well as an ASPInsider. She has interests in IoT, and is a member of the Maker community. Carey is married, and mom to three fabulous boys. She is a 2nd degree black belt in TaeKwonDo, and enjoys coding for fun!