[vtkusers] Wrapper classes for .NET, Problems with vtkContourFilter

megabyte07 megabyte07 at net.hr
Fri Feb 24 10:20:28 EST 2006


Hello!

I want to use some functions of VTK 5.0 in a VS.NET 2003 - Application written in VB.NET. So I tried
to write simple wrapper classes for .NET. For some VTK objects (e.g. vtkActor) it works fine, some
other objects (e.g. vtkContourFilter) cause errors like

...'System.NullReferenceException'...
Object reference not set to an instance of an object.

when the wrapper class is instanced. The error occurs at the line of the constructor call in the
wrapper class (in the code below:  unmanagedObject = vtkContourFilter::New()).


The constructor and destructor code of the wrapper classes is:


// wrapContourFilter.h

#pragma once
#include "vtkContourFilter.h"

using namespace System;

namespace Wrapper
{

	public __gc class wrapContourFilter
	{
	private:
		vtkContourFilter* unmanagedObject;
		
	public:
		wrapContourFilter(void)
		{
			unmanagedObject = vtkContourFilter::New();
		}
		~wrapContourFilter(void)
		{
			unmanagedObject->Delete();
		} 
	};
}

This code does not work. If I replace the vtkContourFilter by e.g. a vtkActor, it works.

What's wrong?


Clemens Müllner


-- 
Odaberite XXLadsl - očekuju vas veće brzine uz iste cijene,
priključak za samo 1 kunu i paketi već od 99 kuna mjesečno."




More information about the vtkusers mailing list