Eyeshot — Bringing CAD Functionality to .NET Applications

devDept
8 min readSep 27, 2024

--

Eyeshot 2024
Figure 1. Mechanical assembly in Rendered display mode

Eyeshot is the only 100% fully managed code CAD component for .NET. With support for both WinForms and WPF, Eyeshot provides the UI control and a neutral cross-platform core to enable developers to deploy their applications on Linux and macOS operating systems, too.

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 an Italian company, devDept Software S.r.l. Founded in 2006, devDept has been providing .NET developers with CAD software components for over two decades. 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 used in a wide variety of applications. One of the most impressive features is its Sketcher environment. Sketcher is used in history-based parametric modeling of parts and assemblies.

Parametric modeler
Figure 2. SketcherDemo code sample

Eyeshot allows for the import and export of DXF, DWG, OBJ, STL, GLTF, ASC, LAS, IFC, PDF, IGES, and STEP files. The Design control is then used as the workspace for interacting with and manipulating the imported geometry. 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 Design control is not limited to static geometry visualization. Eyeshot also offers the ability to add animations to objects in the Design. This can help the user visualize component movement in a simulated environment or provide visual details on the assembly of a complex product. This is an excellent application of the component for the product manufacturing space.

Figure 3. PipeBending code sample

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 maximize productivity.

Figure 4. Architectural model

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 neutral file formats, or printed using custom documents on a paper-fed printer. Users can also export their designs for 3D printing and laser-cutting applications.

Figure 5. PaperDemo code sample

Eyeshot can also be used as a pure graphics application. It supports shaders, anti-aliasing, realistic shadows, ambient occlusion, and minimum frame rate control. Walk through designed worlds in the first person, examine entities close up, or even fly through the air.

Figure 6. FirstPerson code sample

Beyond the Design control, Eyeshot offers Drawing, Manufacturing, and Simulation controls customized for specific applications.

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 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 Design 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.

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. Curve, surface and volume meshers are included to prepare the geometry for FEM solvers. Analysis can be performed to guarantee safety and stability, as well as calculate the limits of the design.

Finite Element Analysis
Figure 7. Linear static analysis of a Brep model

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 Design control.

Full documentation of the Eyeshot libraries is available online. The libraries provide many building blocks for developers. In particular, the devDept.Eyeshot.Entities namespace gives constructors for many standard shapes.

Let’s create a simple example to demonstrate how easy Eyeshot makes CAD coding! We’ll create a bracket using the Brep entity, which is the same boundary representation used by mainstream CAD systems.

First, open MS Visual Studio, and create a new C# WPF Desktop application. Add the appropriate NuGet package to your project.

Figure 8. MS Visual Studio integration

Drag and drop a new Design control to your design surface, then select the Clean White option from the Preset Manager.

Figure 9. Toolbox item preset manager

This screenshot shows that Design is a very powerful control. In addition to specifying the background color, the left list box shows multiple types of views, 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.

Figure 10. Dock style fill with margins

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

using devDept.Eyeshot.Entities;
using devDept.Geometry;
using System.Windows;

Then, add the following code to implement the modeling of the bracket:

protected override void OnContentRendered(EventArgs e)
{
// head of the bracket
CompositeCurve rrcc1 = CompositeCurve.CreateRoundedRectangle(Plane.YZ, 40, 120, 12, true);
// top slot
CompositeCurve scc1 = CompositeCurve.CreateSlot(Plane.YZ, 9, 5.25, true);
sscc1.Translate(0, 0, 43);
// bottom slot
CompositeCurve scc2 = CompositeCurve.CreateSlot(Plane.YZ, 9, 5.25, true);
sscc2.Rotate(Utility.DegToRad(90), Vector3D.AxisX, Point3D.Origin);
sscc2.Translate(0, 0, -40);
// centered circular hole
Circle c1 = new Circle(Plane.YZ, 4.25);
Region r1 = new Region(rrcc1, scc1, scc2, c1);
Brep ext1 = r1.ExtrudeAsBrep(-4);
// adds the head of the bracket to the 3D scene
design1.Entities.Add(ext1, System.Drawing.Color.LightSteelBlue);

// long arm of the bracket
CompositeCurve cc1 = new CompositeCurve(
new devDept.Eyeshot.Entities.Line(Plane.YZ, 8, -10, 11, -10),
new Arc(Plane.YZ, new Point2D(11, -5), 5, Utility.DegToRad(270), Utility.DegToRad(360)),
new devDept.Eyeshot.Entities.Line(Plane.YZ, 16, -5, 16, +5),
new Arc(Plane.YZ, new Point2D(11, +5), 5, Utility.DegToRad(0), Utility.DegToRad(90)),
new devDept.Eyeshot.Entities.Line(Plane.YZ, 11, 10, -11, 10),
new Arc(Plane.YZ, new Point2D(-11, +5), 5, Utility.DegToRad(90), Utility.DegToRad(180)),
new devDept.Eyeshot.Entities.Line(Plane.YZ, -16, +5, -16, -5),
new Arc(Plane.YZ, new Point2D(-11, -5), 5, Utility.DegToRad(180), Utility.DegToRad(270)),
new devDept.Eyeshot.Entities.Line(Plane.YZ, -11, -10, -8, -10));
Region r2 = cc1.OffsetToRegion(-2.5, false);
// adds the long arm to the head of the bracket
ext1.ExtrudeAdd(r2, 275);

// adds slotted holes along long arm using the slotted shape pattern
Region sr2 = Region.CreateSlot(Plane.XY, 12, 5.25);
ssr2.Translate(9, 0, 0);
ext1.ExtrudeRemovePattern(sr2, 10, 35, 8, 0, 1);

// regens geometry after boolean operations
design1.Entities.Regen();

// sets trimetric view and fits
design1.SetView(devDept.Eyeshot.viewType.Trimetric);
design1.ZoomFit();

base.OnContentRendered(e);
}

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

Figure 11. Program output

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 into your MS Word or Excel documents.

Figure 12. Paste of vector drawing into MS Word

Deployment and Support

Eyeshot is licensed per developer and provides royalty-free deployment. This means there are no hidden costs, and you can 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. To help get you started, a library of code samples in C# and VB.NET is installed with the product.

Conclusion

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

Carey Payette

Carey Payette is a Senior Software Engineer with Trillium Innovations, as well as an ASPInsider and Progress Developer Expert. She has an interest in IoT and is a member of the Maker community. Carey is also a wife and mom to three fabulous boys. She has a 2nd degree black belt in TaeKwonDo and enjoys coding for fun!

--

--

devDept
devDept

Written by devDept

0 Followers

Makers of Eyeshot, the CAD component for .NET

No responses yet