eyeshot 10

Eyeshot 10—Bringing CAD Functionality to .NET Applications

11419 VIEWS

·

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 is available online. The libraries provide many building blocks for developers. In particular, the Entities namespace gives constructors for many common shapes.

Let’s create a simple example to demonstrate how easy Eyeshot makes CAD coding! We’ll create a bracket using Solid3D entity, the boundary representation (BRep) used from mainstream CAD systems.

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:

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):

protected override void OnContentRendered(EventArgs e)
{
	// head of the bracket
	RoundedRectangleShapedCompositeCurve rrscc1 = new RoundedRectangleShapedCompositeCurve(Plane.YZ, 40, 120, 12, true);
	// top slot
	SlotShapedCompositeCurve sscc1 = new SlotShapedCompositeCurve(Plane.YZ, 9, 5.25, true);
	sscc1.Translate(0, 0, 43);

	// bottom slot
	SlotShapedCompositeCurve sscc2 = new SlotShapedCompositeCurve(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(rrscc1, sscc1, sscc2, c1);
	Solid3D ext1 = r1.ExtrudeAsSolid3D(-4);

	// add bracket head to the viewportLayout
	viewportLayout.Entities.Add(ext1, 0, System.Drawing.Color.LightSteelBlue);
      	
        	
	// long arm of the bracket
	CompositeCurve cc1 = new CompositeCurve(
    	new Line(Plane.YZ, 8, -10, 11, -10),
    	new Arc(Plane.YZ, new Point2D(11, -5), 5, Utility.DegToRad(270), Utility.DegToRad(360)),
    	new Line(Plane.YZ, 16, -5, 16, +5),
    	new Arc(Plane.YZ, new Point2D(11, +5), 5, Utility.DegToRad(0), Utility.DegToRad(90)),
    	new Line(Plane.YZ, 11, 10, -11, 10),
    	new Arc(Plane.YZ, new Point2D(-11, +5), 5, Utility.DegToRad(90), Utility.DegToRad(180)),
    	new Line(Plane.YZ, -16, +5, -16, -5),
    	new Arc(Plane.YZ, new Point2D(-11, -5), 5, Utility.DegToRad(180), Utility.DegToRad(270)),
    	new Line(Plane.YZ, -11, -10, -8, -10));
	Region r2 = cc1.OffsetToRegion(-2.5, 0, false);

	// add the long arm to the head of the bracket
	ext1.ExtrudeAdd(r2, 275);
 
	// add slotted holes along long arm using the slotted shape pattern
	SlotShapedRegion ssr2 = new SlotShapedRegion(Plane.XY, 12, 5.25);
	ssr2.Translate(9, 0, 0);
	ext1.ExtrudeRemovePattern(ssr2, 10, 35, 8, 0, 1);
   	     
	// regen geometry after boolean operations
	viewportLayout.Entities.Regen();

	base.OnContentRendered(e);
}

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 a library 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.


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!


Discussion

Click on a tab to select how you'd like to leave your comment

Leave a Comment

Your email address will not be published. Required fields are marked *

Menu
Skip to toolbar