Code Samples


The long list of ready-to-use source code samples

The following Visual Studio sample projects are located under the product installation folder (Demos and Samples sub-folders). Each code sample is delivered in four versions: Windows Forms and Windows Presentation Foundation platforms, C# and VB.NET programming languages.

User Interface

WinForms or WPF

AdvancedPrinting

This sample demonstrates how to print your model as a vector on paper and in *.emf format. The resulting report includes two views: the main view with the current model orientation and the secondary view with a specific framing.

AnimatedPicture

This sample demonstrates how to superimpose wireframe geometry onto a video stream and update a Picture entity from a separate thread.

Arrows

This sample illustrates how to create a vector set using the Mesh.CreateArrow() static method and the Transformation class for object rotation.

AspNetMvc

This sample explains the process of creating a bitmap and displaying it on a web application view.

Assemble

This sample provides instructions for assembling individual objects using direct, transformation, and animation methods.

AssemblyDemo

This sample showcases Eyeshot's capability to handle large assemblies. It includes several useful commands such as Form New, Dissolve, Edit Structure, Make Independent, Edit Part, Edit Assembly, Edit Parent, and Moved with Triad. You can control selection, visibility, and selectability at the instance level. AssemblyDemo allows selection in branch or leaf mode and commands to open/save and import/export in IGES/STEP file formats. Asynchronous regeneration, disabled shadows, disabled reflection, disabled silhouette curves, and show center of rotation are the default settings for this sample. Video1, Video2

Barbecue Ultimate Fem

This sample demonstrates how to create a 3D model of a barbecue using Brep boolean operations and sheet metal flanges.

BlendSurface Ultimate Fem

This sample explains how to build a blend surface between two surface edges. You can interactively change the influence of each edge. The Extend button allows you to smoothly extend the surface edges. Video1

Building

This sample explains how to use Block and BlockReference to draw a 3D building model. It also demonstrates how to use the Attribute entity.

CabinetDesigner Ultimate Fem

This sample details how to create a cabinet from scratch and verify the assembly using collision detection. Video1

CamDemo

This sample explains how to create 2x and 3x toolpaths and simulate material removal. Video1

CollisionDetection

This sample explains how to properly animate a robot arm and how to check collisions between objects. The additional tab is dedicated to 2D collision detection instead. For more details on the collision detection implementation, check this this article.

CompareDWG

This sample explains how to compare entities of two 2D drawings and how to keep independent Design controls cameras in sync.

ComputeDistance Ultimate Fem

This sample demonstrates how to compare a point cloud with a 3D geometry imported in IGES file format.

CopyAndPaste

This sample demonstrates how to copy and paste entities (including labels) between two independent Design controls and keep their views in sync. It also includes a resizable split container implementation.

CustomData

This sample explains how to add custom data to an entity and how to retrieve it at runtime. It also describes how to implement custom data cloning and serialization. If you need to extend Eyeshot entity classes instead, follow the FileFormatExtension more sophisticated approach.

CustomToolbar

This sample explains how to add custom buttons to the Viewport toolbar. It also demonstrates the ability to change the coordinate system icon with a custom list of Mesh objects. Not all applications require world axes. For example, in medical applications, a torso shape is preferred.

CustomViewportLayout

This sample explains how to create your custom viewport layout, including the viewport border style.

Defeature Ultimate Fem

This sample demonstrates the process of identifying and eliminating topological elements from a BRep object. Video1

DelaunayTriangulation

This sample demonstrates how to utilize Delaunay triangulation, which can be applied to points, loops, or both. It's important to note that the outer loop needs to be closed, meaning that the first and last points must have the same coordinates. For internal loops, they can either be closed or open. If the loops are closed, the orientation should be counterclockwise for the outer loop and clockwise for the inner ones.

DicomToMesh

This sample illustrates the Eyeshot DICOM capabilities, which include surface reconstruction, sectioning, measurements, and STL output for 3D printing.

Dimensioning Ultimate Fem

This sample explains how to interactively measure a 3D model. Video1

DraftAnalysis

This sample demonstrates how to split a Mesh entity based on a pull direction and animate BlockReferences using a standard trackbar.

DraftingDemo

This sample demonstrates how to create interactive 2D curves and dimensions. It serves as a great foundation for building a 2D CAD system. The example also covers curve trim, extension, fillet, and chamfer. Starting from version 12, this example supports import/export from DWG/DXF and export to the 3D PDF file format.

DragControlPoint Ultimate Fem

This sample illustrates how to interactively drag NURBS surface control points to model complex freeform shapes, like an airplane fuselage. Video1

ExploreIFC

This sample shows how to load an IFC property tree from an IFC file.

EyeshotDemo

A fully-featured application that demonstrates the capabilities of the Design control.

FeatureDetection Ultimate Fem

This sample explains how to detect features of a specific type on a 3D model. The filters allow narrowing down the number of cylinders or cones detected, and the "Show axes" button shows the cylinders' axis.

FemDemo Fem

This sample covers the volume meshing of arbitrary geometry, the elements' quality histogram, the application of boundary conditions on BRep vertices/edges/faces, linear static analysis, and the plot of results. Video1, Video2

FileFormatExtension

This sample explains how to extend Eyeshot's proprietary file format with custom data and custom entities. For additional information, please refer to this article. When dealing with custom data, it may be beneficial to explore an alternative approach, such as the one demonstrated in this code sample, which does not involve versioning.

FirstPerson

This sample demonstrates how to alter the viewport navigation method using the Viewport.Navigation.Mode property. Use the WASD keys to navigate. Video1

FunctionPlot

This sample demonstrates how to draw a point cloud or mesh entity with a different color on each vertex, as well as how to quickly change the points' coordinates.

GCodeSimulator

This sample explains how to read a GCode file and simulate 3x CNC machining.

Globe

This sample demonstrates how to create a globe model using the Mesh.CreateSphere() static method. It also utilizes the Mesh.ApplyMaterial() method to apply the material texture spherically. Additionally, it showcases how to rotate the scene using a compass UI element.

Gym Ultimate Fem

This sample demonstrates how to create a gym frame using NURBS surfaces.

HybridEntity

This sample illustrates how to dynamically change the entity nature. For instance, the beam drawing can be switched between Mesh and wires.

Layers

This sample explains how to work with layers. It also includes the code to use the ImageOnly label and tooltips support: when hovering over an entity, the entity index is displayed.

Lego Ultimate Fem

This sample demonstrates how to conduct background modeling while maintaining a responsive user interface. It also illustrates how to replace the default progress bar with a standard progress bar and Cancel button.

LineTypes

This sample explains how to use different line types for curve entities. It also includes the usage of Joint and Bar entities.

MachineSimulator

This sample demonstrates how to simulate the movements of a 3-axis CNC machine. Initially, the moving components are loaded from STL files and incorporated into three distinct block definitions. Subsequently, three subclassed block references override the Animate() and MoveTo() methods to calculate the new position and move the objects (on GPU only). Additionally, it illustrates how to overlay drawings over all UI elements.

MarchingCubes

This sample describes the process of creating the isosurface of a 3D scalar field, resulting in a Mesh entity.

Measure Ultimate Fem

This sample demonstrates how to calculate 3D distances between BRep's faces, edges, and vertices and implements mixed sub-item selection.

MeshEditor

This sample illustrates how to modify mesh triangles and vertices using the MeshEditor class. The available operations include edge flipping, edge collapsing, vertex dissolving for vertices connected to 3 or 4 triangles, vertex cell, and edge cell. Video1

MVVM

The following sample illustrates the process of utilizing WPF data binding.

ObjectManipulator

This sample provides instructions on setting a BlockReference as current and interactively modifying its position and orientation using the ObjectManipulator widget.

PaperDemo

This detailed demonstration explains how to generate Vector and Raster views of your geometry in the Drawing workspace. It is the only example that allows for the import of DXG/DXF files that include AutoCAD paperspace or layouts. Import of STL, OBJ, IGES and STEP files are provided to test the view generation quality on your own geometry. The Drawings tab contains a variety of options to add dimensions and annotations to the views. Drawing sheets can be exported to DWG/DXF as VPORT objects or exploded curves. Yes, you are right, the geometry belongs to our office desks as you can check here. Additionally, this demonstration shows how to use the WorkManager class to handle a queue of WorkUnits for building the views. Ready to start? Check this introductory article for more information.

Part1

This sample demonstrates how to create and merge individual Mesh entities and compute the part volume. It also illustrates how to add multiple origin symbols in the same Viewport.

PenLike

This sample shows how to use a pen to draw on the Design control.

PerformanceStudio

This sample shows how each graphical setting impacts drawing speed. It also showcases the scene graph being rebuilt as a single object, multiple objects, and hierarchical objects. One notable aspect of this example is the depth of transparent objects. When enabled, it allows for accurate values to be obtained under the mouse cursor, even for transparent objects. This affects 3D coordinate extraction and the determination of the center of rotation.

PipeBending Ultimate Fem

This sample demonstrates how to simulate a pipe bending machine and inspect for collisions with surrounding objects.

PistonAnimation

This sample demonstrates how to animate a collection of entities.

ProductConfigurator

This sample demonstrates how to create a parametric 3D chair model using the Mesh entity. It allows for interactive modification of the model, such as changing materials and size. The resulting geometry is exportable in STL or OBJ file formats.

Rocket

This sample explains how to orient and launch a toy rocket towards three different targets.

Routing Ultimate Fem

This sample explains how to draw and shape an electrical wire or flexible pipe. You can add multiple joints and move them using the right mouse button.

RubberBandCurve Ultimate Fem

This sample demonstrates how to interactively draw and edit a NURBS curve.

RubberBandLine

This sample demonstrates how to interactively draw a LinearPath entity.

Ruler

This sample explains the process of drawing an interactive ruler on the Viewport surface. The ruler's tick density changes based on the current zoom factor. Additionally, this example demonstrates how to overlay a logo on the 3D scene.

SceneEditor

This sample gives you full control over the scene lighting settings. On the left pane, you can see the camera view, while on the right pane, you can see the 3D scene from the director's point of view. You can turn on up to eight lights of point, spot, directional, and stationary types, and change the settings for each light. Currently, only one light can cast shadows. You'll also find the code to copy geometry from one Design control to the other.

SelectPoints

This sample demonstrates how to implement a custom selection method on a FastPointCloud entity, including the Undo and Unselect commands.

SelectTriangles

This sample explains how to implement individual mesh triangle selection or individual linear path segment selection (Lines tab). The sample is optimized for large objects (high number of vertices) and implemented using vertex buffers.

Shaders

This sample illustrates the process of creating custom OpenGL vertex and fragment shaders. It also addresses skydome and liquid fill shaders.

Simulation Fem

This sample illustrates Eyeshot's Finite Element Analysis capabilities, including mapped meshing and 2D and 3D beams with hinge support. Clicking the "Numeric results" button opens a dialog displaying all the results in a tabular view. Video1

SketcherDemo

This sample shows how to utilize the 2D constraint solver from UI, including sketch extrude/revolve/sweep and assembly navigation to a specific component/BRep. The left pane contains the assembly and features trees, and it also offers the option to import a sketch from DWG/DXF. Video1, Video2, Video3

SlicerDemo

This sample provides instructions for slicing a 3D mesh for printing and simulating the extrusion process. Video1

SnapToGrid

This sample shows how to align with grid lines when drawing.

SurfaceMesher Fem

This sample explains how to control the size of elements in surface meshing and provides tools for evaluating the quality of triangle shapes. Video1

SurfaceSection Ultimate Fem

This sample explains how to generate a section of a 3D surface model.

TempEntities

This sample demonstrates how to include temporary entities to highlight an item or a workflow within your application. These entities remain separate from the actual objects within your 3D scene.

TextOnCurve Ultimate Fem

This sample demonstrates how to place text along a freeform curve.

TextureMapping

This sample explains how to apply different texture mappings to scene objects. You can experiment with each mapping and scaling combination by simply dragging the desired material onto the scene object. Additionally, it demonstrates how to create realistic materials. Video1

Transformation

This sample demonstrates how to position flat objects on planes other than the XY plane.

Wing Ultimate Fem

This sample demonstrates the process of creating a manifold BRep object from two airfoils, which can then be exported in STEP file format.

Workspaces Ultimate Fem

This sample showcases how Eyeshot workspaces (previously known as Environments) seamlessly operate on the same geometry. It also demonstrates the process of defining 2D sketches, orthographic views, FEA study, and 3x CNC machining programmatically. Video1

Console

Cross-platform

CheckCollision

This sample will demonstrate how to utilize collision detection.

ComputeExtents

This sample demonstrates how to calculate the bounding box of a scene.

ComputeVolume

This sample explains how to compute the volume of a Mesh entity.

EditMesh

This sample explains how to utilize the MeshEditor class for simplifying an imported STL mesh. Video1

GenerateDrawing Ultimate Fem

This sample illustrates the process of creating a BRep and generating a 2D drawing from it. The computation is carried out in a background thread.

GenerateToolpath Ultimate Fem

This sample demonstrates how to import geometric data and perform parallel finish machining on it. The computation runs in a background thread.

MeshCurve Fem

This sample demonstrates how to subdivide a NURBS curve using a variable step. Video1

WriteIges Ultimate Fem

This sample explains the process of creating a BRep entity and exporting it in IGES file format.