VTK C#: vtkAffineWidget "PlaceWidget" wants a IntPtr instead of the bounds???

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

VTK C#: vtkAffineWidget "PlaceWidget" wants a IntPtr instead of the bounds???

mrHiggins
Hi guys. I use vtk in c# (Activiz 5.8 32Bit).
Some things are a Little bit crazy but ok. First big Problem i have using the AffineWidget.


         widget = new vtkAffineWidget();
         widget.SetInteractor(interactor);
         widget.CreateDefaultRepresentation();
         rep = vtkAffineRepresentation2D.SafeDownCast(widget.GetAffineRepresentation());
         rep.PlaceWidget(???);

The PlaceWidget() Methods gets Actor.GetBounds() as Parameter in the c++ example (so as a double[]). But my c# "PlaceWidget" wants a Intptr. I have really no idea what to do that the widget is around my plane...


Can someone help me?
Reply | Threaded
Open this post in threaded view
|

Re: VTK C#: vtkAffineWidget "PlaceWidget" wants a IntPtr instead of the bounds???

nickxtsui
You can try this function to convert double[] to IntPtr:

public IntPtr DoubleArrayToIntPtr(double[] d)
        {            
            IntPtr p = Marshal.AllocCoTaskMem(sizeof(double) * d.Length);
            Marshal.Copy(d, 0, p, d.Length);
            return p;
        }
Reply | Threaded
Open this post in threaded view
|

AW: VTK C#: vtkAffineWidget "PlaceWidget" wants a IntPtr instead of the bounds???

mrHiggins

Hi

 

I found that in another example. But it don’t work really for the affinewidget…  but I think the problem here is something else. So marshalling should work.

 

Bestzeit mit ZOLLER
E. Zoller GmbH & Co. KG
Gottlieb-Daimler-Straße 19
74385 Pleidelsheim
Michael Metzger
Informatik
Tel +49 7144 8970-164
Fax +49 7144 8970 70164
E-Mail Metzger@...
E. Zoller GmbH & Co. KG | Einstell- und Messgeräte | Gottlieb-Daimler-Straße 19 | D-74385 Pleidelsheim
Tel +49 7144 8970-0 | Fax +49 7144 8060807
Komplementär: E. Zoller GmbH | Pleidelsheim | Registergericht Stuttgart HRB 203149
Geschäftsführer: Christoph Zoller | Alexander Zoller | Eberhard Zoller | DE 146132622

Von: nickxtsui [via VTK] [mailto:[hidden email]]
Gesendet: Donners
tag, 5. Dezember 2013 22:03
An: Michael Metzger
Betreff: Re: VTK C#: vtkAffineWidget "PlaceWidget" wants a IntPtr instead of the bounds???

 

You can try this function to convert double[] to IntPtr:

public IntPtr DoubleArrayToIntPtr(double[] d)
        {            
            IntPtr p = Marshal.AllocCoTaskMem(sizeof(double) * d.Length);
            Marshal.Copy(d, 0, p, d.Length);
            return p;
        }


To unsubscribe from VTK C#: vtkAffineWidget "PlaceWidget" wants a IntPtr instead of the bounds???, click here.
NAML