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. 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 explains how to vector-print your model on paper and on file (in *.emf format). The resulting report contains two views, the primary one with the current model orientation and the secondary one with a specific framing.

AnimatedPicture

This sample explains how to overlap wireframe geometry to a video stream. It also demonstrates how to update a Picture entity from a separated thread.

Arrows

This sample explains how to draw vector fields using the Mesh.CreateArrow() static method and the Transformation class for object rotation.

AspNetMvc

This sample explains how to generate a bitmap and serve it on a web application view.

AspNetWebForms

This sample explains how to generate a bitmap and serve it on a website page.

Assemble

This sample explains how to assemble individual objects. You can choose between direct, transformation and animation methods.

AssemblyDemo

This sample demonstrates Eyeshot large assemblies handling capabilities. It includes a number of useful commands like 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 can select items in branch or leaf mode, includes Turbo mode options and commands to open/save and import/export from IGES/STEP file format. Asynchronous regeneration, disabled shadows, disabled reflection, disabled silhouette curves and show center of rotation are the default setting for this sample. Video1, Video2

Barbecue Ultimate Fem

This sample explains how to draw a barbecue 3D model using Brep boolean operations and sheet metal flanges.

BlendSurface Ultimate Fem

This sample explains how build a blend surface between two surface edges. You can change the influence of each edge interactively. The Extend button allows 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 explains how to model a cabinet from scratch and how to verify the assembly using the collision detection. Video1

CamDemo

This sample explains how to generate 2x and 3x toolpaths and how to simulate the 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 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 explains how to compare a point cloud with a 3D geometry imported via IGES file format.

CopyAndPaste

This sample explains how to copy and paste entities (and labels) between two independent Design controls and how to keep their views in sync. It also contains resizeable split container implementation.

CustomData

This sample explains how to add custom data to an entity and how to retrieve it at runtime. This can be easily accomplished using the Entity.EntityData property.

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 example explains how to detect and remove topology elements from a BRep object. Video1

DelaunayTriangulation

This sample explains how to use the Delaunay triangulation. You can use it with points or loops or both. The outer loop must be closed (first and last points must have the same coordinates) while internal loops can be closed or not. For closed loops, orientation must be counterclockwise for outer and clockwise for inner ones.

DicomToMesh

This sample explains Eyeshot DICOM capabilities, including surface reconstruction, sectioning, measurement and STL output for 3D printing.

DraftAnalysis

This sample explains how to split a Mesh entity according to a pull direction and how to animate BlockReferences using a standard trackbar.

DraftingDemo

This sample explains how to implement interactive drawing of 2D curves and dimensions. It can be considered a good starting point to create a 2D CAD system. This sample also includes curve trim, extension, fillet and chamfer. From version 12, this sample includes import/export from DWG/DXF and export to 3D PDF file format.

DragControlPoint Ultimate Fem

This sample explains how to interactively drag a Nurbs surface control point. The trick is to drag a standard point and update the desired surface control point. Nurbs surfaces need to be regenerated after this operation, therefore the RegenMode property is set accordingly.

EyeshotDemo

A fully featured application that demonstrates what you can do with the Design control.

FeatureDetection Ultimate Fem

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

FemDemo Fem

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

FileFormatExtension

This sample explains how to extend Eyeshot's proprietary file format with custom data and custom entities. More details on this article.

FirstPerson

This sample explains how to change the viewport navigation method using the Viewport.Navigation.Mode property. It also includes an advanced implementation of multi-texturing.

FunctionPlot

This sample explains how to draw a point cloud or mesh entity with a different color on each vertex. It also demonstrates how to quickly change the points coordinates.

GCodeSimulator

This example explain how to read a GCode file and simulate the 3x CNC machining.

Globe

This sample explains how to draw a globe model using the Mesh.CreateSphere() static method. It also uses Mesh.ApplyMaterial() method to map the material texture spherically.

Gym Ultimate Fem

This sample explains how to draw a gym frame using Nurbs surfaces.

HiddenViewport

This sample explains how to work with a hidden Design control. In some cases, you may want to generate raster images without displaying the geometry in the Form/Window.

HybridEntity

This sample explains how to change entity nature on the fly. In this case, the beam drawing is 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: hovering an entity, the entity index is displayed.

Lego Ultimate Fem

This sample explains how to do modeling in background while keeping the user interface responsive. In addition, it demonstrates how to hide the built-in progress bar and use a standard progress bar and Cancel button.

LineTypes

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

MachineSimulator

This sample explains how to simulate a 3x CNC machine movements. First, the moving parts are loaded from STL files and added to three different Block definitions, then three subclassed BlockReferences override the Animate() and MoveTo() methods respectively, to compute new position and to move the objects (on GPU only).

MarchingCubes

This sample explains how to draw the isosurface of a 3D scalar field. The resulting surface is a Mesh entity.

Measure Ultimate Fem

This sample explains how to measure 3D distances between BRep's faces, edges and vertices. It also implements mixed sub-item selection.

MVVM

This sample explains how to use WPF data binding.

ObjectManipulator

This sample explains how to set a BlockReference current and how to modify interactively its position/orientation with the ObjectManipulator widget.

PaperDemo

This polyhedric demo explains how to generate Vector and Raster views of your geometry in the Drawing workspace. It is also the only sample that allows importing 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 number 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. Moreover, this sample shows how to use the WorkManager class to handle a queue of WorkUnits for building the views. Ready to start? Check this introductory article.

Part1

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

PenLike

This sample demonstrates how to draw on the Design control with a pen.

PerformanceStudio

This sample demonstrates how every single graphical setting affects drawing speed. It also rebuilds the scene graph as a single object, multiple objects and hierarchical objects. One important feature of this sample is the depth of transparent objects. Enabling it, you can get accurate values under the mouse cursor even for transparent objects, this affects 3D coordinates extraction and center of rotation determination.

PipeBending Ultimate Fem

This sample explains how to simulate a pipe bending machine and check collisions with surrounding objects.

PistonAnimation

This sample explains how to animate a group of entities.

ProductConfigurator

This sample explains how to draw a parametric 3D chair model using the Mesh entity. It rebuilds the model interactively while changing material, size, etc. The resulting geometry can be exported in STL or OBJ file format.

Rocket

This sample explains how to orient and fire a toy rocket toward three different targets.

Routing Ultimate Fem

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

RubberBandCurve Ultimate Fem

This sample explains how to draw and edit interactively a Nurbs curve.

RubberBandLine

This sample explains how to draw interactively a LinearPath entity.

Ruler

This sample explains how to draw an interactive ruler on the Viewport surface. The ruler drawing changes tick density based on the current zoom factor. This sample also demonstrates how to display a logo in overlay on the 3D scene.

SceneEditor

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

SelectPoints

This sample explains how to implement a custom selection method on a FastPointCloud entity. The Undo and Unselect commands are also provided.

SelectTriangles

This sample explains how to implement individual Mesh triangles selection or individual LinearPath segments selection (Lines tab). The sample is optimized for large objects (high number of vertices) and implemented using vertex buffers.

Shaders

This sample explains how to write custom OpenGL shaders.

Simulation Fem

This sample demonstrates Eyeshot Finite Element Analysis capabilities, including mapped meshing and 2D and 3D beams with hinge support. The Numeric results button opens a dialog containing all the results in a tabular view. Video1

SketcherDemo

This example demonstrates how to use the 2D constraint solver from UI, including sketch extrude/revolve/sweep and assembly navigation to specific component/BRep. On the left pane you'll find the assembly and features trees. Import sketch from DWG/DXF is also available. Video1, Video2, Video3

SlicerDemo

This sample explains how to slice a Mesh for 3D printing. Video1

SnapToGrid

This sample demonstrates how to snap on grid lines while drawing.

SurfaceSection Ultimate Fem

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

TempEntities

This sample explains how to add temporary entities to highlight an item or a workflow in your application. These entities don't mix up with the actual objects of your 3D scene.

TextOnCurve Ultimate Fem

This sample explains how to arrange a text on 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 simply dragging the desired material on the scene object. Additionally, it demonstrates how to create realistic materials. Video1

Transformation

This sample explains how to place planar entities on planes different from XY.

Wing Ultimate Fem

This sample explains how to build a manifold BRep object from two airfoils. The resulting model can be exported in STEP file format.

Workspaces Ultimate Fem

This example demonstrates how our workspaces (formerly called Environments) work seamlessly on the same geometry. It also shows how to define 2D sketches, orthographic views, FEA study and 3x CNC machining programmatically. Video1

Console

Cross-platform

CheckCollision

This example explains how to use collision detection.

ComputeExtents

This example explains how to compute the scene bounding box.

ComputeVolume

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

EditMesh

This examples explains how to use the MeshEditior class to simplify an imported STL mesh. Video1

GenerateDrawing Ultimate Fem

This example explains how to create a BRep and generate a 2D drawing from it. The computation is executed in a background thread.

GenerateToolpath Ultimate Fem

This example explains how to load some geometry and generate a parallel finish machining on it. The computation is executed in a background thread.

MeshCurve Fem

This example explains how to subdivide a NURBS curve with a variable step. Video1

WriteIges Ultimate Fem

This example explains how to create a BRep entity and export it in IGES file format.