devDept Eyeshot Documentation Send comments on this topic.
Starting from scratch
Getting Started > Walkthroughs > Starting from scratch

Glossary Item Box

This article explains how to create a new Visual Studio project that uses the Eyeshot Viewport.

 

Step 1 Creating a new Windows Application Project

  1. Launch Visual Studio
  2. From the File menu, select New, and then click Project
  3. In the New Project dialog box, click either Visual C# Projects or Visual Basic Projects from the Project types list
  4. From the Templates list, click Windows Application
  5. In the Name field, replace the default project name with the name of your project

 

Step 2 Adding the Eyeshot control to Visual Studio Toolbox

  1. Download the appropriate installation file
  2. Install the product on your PC
  3. Open Visual Studio and Expand the Toolbox
  4. Drag and drop the devDept.EyeshotProfessional.dll file onto the Toolbox window. The file is located in the Bin installation folder (c:\Program Files\devDept Software\Eyeshot Professional).

The Visual Studio Toolbox should now look like this:

Visual Studio Toolbox

Figure 1: The Visual Studio toolbox window with the Eyeshot control installed.

 

Step 3 Adding the Eyeshot Viewport to Form1

Open the Visual Studio Toolbox and drag and drop the ViewportProfessional item on the Form1 surface.

 

Step 4 Required using/Imports statements

Add the following using/Imports statements at the beginning of the Form1.cs file.

 

C# Copy Code
using devDept.Eyeshot;
using devDept.Eyeshot.Standard;
using devDept.Eyeshot.Geometry;

 

Visual Basic Copy Code
Imports devDept.Eyeshot
Imports devDept.Eyeshot.Standard
Imports devDept.Eyeshot.Geometry

 

Step 5 Adding the Load event handler to Form1

 

From the Form1 properties window switch to Events and double-click the Load event, the Form1_Load() method will be added to the Form1 class.

 

Step 6 Drawing a rectangular face

Add the following lines to the Form1_Load() method, then build and start your application. The RescaleModel() method has to be called every time you finish adding/removing entities to fit the model inside a unit sphere. Without this call you'll probably not see the model at all.

C# Copy Code
private void Form1_Load(object sender, EventArgs e)
{

   viewportProfessional1.Entities.Add(
      
new Quad(
           0,  0, 0,    
// first vertex
         
100,  0, 0,    // second vertex
         
100, 80, 0,    // third vertex
           
0, 80, 0,    // fourth vertex
         
Color.DarkOrange));

   
// Sets edge color as entity color                     
   
viewportProfessional1.EdgeColorMode = Viewport.edgeColorType.byEntityColor;

   
// Fits the model in a unit sphere
   
viewportProfessional1.RescaleModel();

   
// Sets isometric view
   
viewportProfessional1.IsoView();

}
Visual Basic Copy Code
Private Sub Form1_Load( _
        ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles MyBase.Load

   ViewportProfessional1.Entities.Add( _
      New Quad( _
           0, 0, 0, _ ' first vertex
         100, 0, 0, _ ' second vertex
         100, 80, 0, _ ' third vertex
           0, 80, 0, _ ' fourth vertex
         Color.DarkOrange))

   ' Sets edge color as entity color
   ViewportProfessional1.EdgeColorMode = Viewport.edgeColorType.byEntityColor

   ' Fits the model in a unit sphere
   ViewportProfessional1.RescaleModel()

   ' Sets isometric view
   ViewportProfessional1.IsoView()

End Sub

You should now see something like this:

Figure 2: Your first 3D drawing with Eyeshot.

Use the middle mouse button combined with Ctrl or Shift keys to Zoom/Pan/Rotate.

For your convenience you may want to rename viewportProfessional1 as eyeshotView1.

 

Step 7 Now it's your turn

Try to add more entities like points, lines, circles, triangles, etc. You'll find them in the devDept.Eyeshot.Standard namespace.