Install Guide C# and VTK .NET Wrapper Original Author: Marco Aurélio Silva Neto. Translated by: Gerbert ten Brinke Extended by: D. Kroon The following tutorial is written to be used with Visuals Studio C# Express Edition 2005. Table of Contents Download and Install .......................................................................................................................... 2 How to create a new project in Visual C# 2005 Express: .................................................................. 3 How to add VTK to C# project: ........................................................................................................... 4 g.0.zip VTK-5.microsoft.1-src.1.aspx • • Install the .1-control-1.1-bin\VTK\bin" to the Windows System Environment variabele Path 2|Page .net/projects/vtkdotnet/ • You need the following files: VTK-5.0.Download and Install • First we must install Visual Studio C# Express Edition 2005.0.1-wrap-1.zip • • Extract the packages in a local directory e.1-control-1.0.com/vstudio/express/visualcsharp/download/default. You can download a trial version of Visual Studion C# Express 2005 from the following link http://msdn.NET Wrapper for VTK 5.1-bin.1-wrap-1.zip VTK-5.1" and "C:\vtk\VTK-5. C:\VTK Add the "C:\VTK\VTK-5.1-wrap-1.0 http://sourceforge. (Or the professional if you have a license).0. 3|Page . select: "File . in the dialog. the name of your application. select Windows Application and type in the field Name. the following screen is shown • Create a project: From the menu.New Project".How to create a new project in Visual C# 2005 Express: • After executing VC#2005. Add Reference.dll" and click "Enter".How to add VTK to C# project: • Select from the menu. 4|Page . In the dialog that will open select "Browse" and then look for the directory where the file "VTK-5. "Project . • We can add a VTK tool to the toolbox using the menu "View ToolBox".0.". A field with some tools will be shown... this folder contains some DLL' s and an executable. Select all these files and click OK. In the field "Filename" write "* DotNet. all DotNet files appear.1-wrapbin" is extracted. 1-wrap-1..• Select from the menu. This folder contains a file "vtkFormsWindow. 5|Page .Choose Toolbox Items..0.dll" file to the VTK5. • • You can verify in the Toolbox that a control is added called vtkFormsWindowControl.0. and try again.1-bin\VTK\bin folder. In case of an error (0x8007007E) copy the "vtkFormsWindow.1-control-1". "Tools . Still receiving an error? than download Dependency Walker and fix missing dll files . In the dialog the will open click "Browse" and locate folder "VTK-5.cs [ design ]). Add this file and click OK..dll".".. Select this control and place it on the form (Form1. Under of the InitializeComponent() line. • • • • } Click the green play button to execute the program.vtkConeSource cone = new vtk.vtkActor coneActor = new vtk.0f. vtk.AddRenderer(ren1).SetHeight(3.Forms.vtkRenderer ren1 = new vtk.ComponentModel.Generic.AddConeToWindow(this.Text.vtkFormsWindowControl1. vtk. renWin. 0.vtkRenderer(). Below the function: public Form1() add following function: void AddConeToWindow(vtk.Collections.vtkFormsWindowControl1.SetBackground(0.SetResolution(30). The final code should be: using System.GetOutput()).SetRadius(1. using System. Add the line: this.0f). using System.vtkActor().SetInput(cone. cone.GetRenderWindow()). namespace Projeto_Teste { public partial class Form1 : Form { public Form1() { InitializeComponent().0f). this.Windows. coneMapper.• Double click on the red cone will show you the source code editor.vtkPolyDataMapper().AddActor(coneActor). using System. ren1.GetRenderWindow()). using System. coneActor.vtkPolyDataMapper coneMapper = new vtk.SetMapper(coneMapper).0f. Now you can use vtk from C#. Below the a few lines starting with ‘using’ add the line: using vtk. 0.AddConeToWindow(this. using System. using vtk.vtkRenderWindow renWin) { vtk.0f). cone. 6|Page .Data. vtk.vtkConeSource(). using System. ren1.Drawing. cone. vtkActor().SetResolution(30).SetBackground(0.SetMapper(coneMapper). } } } • In case of the error "System. cone. 0. vtk.} void AddConeToWindow(vtk.vtkConeSource().vtkActor coneActor = new vtk. 0.SetRadius(1. vtk. cone.AddRenderer(ren1).vtkRenderer().vtkPolyDataMapper(). cone.GetOutput()). ren1.vtkPolyDataMapper coneMapper = new vtk. renWin. Add the VTK dll and library folders to the Visual C# and System environment variables (path) 7|Page .vtkConeSource cone = new vtk.vtkRenderer ren1 = new vtk.0f).FileNotFoundException was unhandled error".0f).vtkRenderWindow renWin) { vtk. the dll or libraries files could not be found.IO.SetInput(cone. coneMapper. ren1.AddActor(coneActor). coneActor.0f. vtk.0f.0f).SetHeight(3.