[vtkusers] Integrating VTK into C# Excel AddIn

jason@optimalcomputing jason.cardinal at optimalcomputing.be
Mon Aug 3 09:33:49 EDT 2015


Hi everyone !

I'm new to VTK and I can't manage to get it working in a WinForms control
which is popping up from an Excel AddIn I developed...

In fact, I already succeeded in integrating the VTK library in a Java
application I am developing, even in a simple WinForm developed in C#. But
it just won't work (with nearly the same code as in the C# form) in my Excel
Ribbon AddIn.

I always get that error:
System.Exception: error: could not get registered type - mteIndex='1'
classNameKey='' 
OR
System.Exception: error: could not get registered type - mteIndex='2'
classNameKey='' 
OR
System.Exception: error: could not get registered type - mteIndex='4'
classNameKey='' 

I already browse some threads about this exception but none of them helped
me...


Here is the code I'm running when a user's clicking a button I added on the
Excel Addin's Ribbon:


        private void button1_Click(object sender, RibbonControlEventArgs e)
        {
                    RenderWindowControl renderWindowControl = new
RenderWindowControl();
                    renderWindowControl.Load += new
System.EventHandler(renderWindowControl1_Load);
                    renderWindowControl.Name = "renderWindowControl";
                    renderWindowControl.Location = new
System.Drawing.Point(0, 0);
                    renderWindowControl.Size = new System.Drawing.Size(900,
540);
                    renderWindowControl.TabIndex = 0;
                    renderWindowControl.TestText = null;
                    renderWindowControl.AddTestActors = false;
                    renderWindowControl.Dock = DockStyle.Fill;

                    Panel pan = new Panel();
                    pan.Dock = DockStyle.Fill;
                    pan.Controls.Add(renderWindowControl);
        
                    Form frm1 = new Form();
                    frm1.Controls.Add(pan);
                    frm1.Show();
        }


        public void renderWindowControl1_Load(object sender, EventArgs args)
        {            
            vtkSphereSource SphereSource = new vtkSphereSource();
            SphereSource.SetRadius(0.5);
          
            vtkPolyDataMapper SphereMapper = vtkPolyDataMapper.New();
            SphereMapper.SetInputConnection(SphereSource.GetOutputPort());
           
            vtkActor SphereActor = vtkActor.New();
            SphereActor.SetMapper(SphereMapper);
            
            vtkRenderWindow RenderWindow = renderWindowControl.RenderWindow;
        
            vtkRenderer Renderer =
RenderWindow.GetRenderers().GetFirstRenderer();
         
            Renderer.SetBackground(0.2, 0.3, 0.4);

            Renderer.AddActor(SphereActor);           

            Renderer.ResetCamera();
         }



--
View this message in context: http://vtk.1045678.n5.nabble.com/Integrating-VTK-into-C-Excel-AddIn-tp5733225.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list