<div class="gmail_quote">On Fri, Aug 6, 2010 at 3:01 PM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi All,<br>
<br>
This is a brief summary of new vtk/python features for people to try:<br>
<br>
1) The wrapping of vtkVariant, vtkArrayRange, vtkArrayCoordinates etc.<br>
has changed. Each of these types now has its own "type object" which<br>
doubles as the object constructor. This means that if you do<br>
"help(vtkVariant)" in python, all the methods will be listed. In the<br>
future, this also means that I will be able to wrap more operator<br>
methods. For people who want to try out vtkVariant, there is an<br>
example here: <a href="http://www.vtk.org/Wiki/VTK/Examples/Python/Variant" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Python/Variant</a><br>
<br>
2) Constants are automatically wrapped, as long as they are defined in<br>
one of the following ways in the headers:<br>
<br>
#define VTK_CELL_SIZE 512<br>
const int VTK_CELL_SIZE = 512;<br>
enum { VTK_CELL_SIZE = 512, ... };<br>
<br>
Some important header files aren't wrapped yet, such as vtkCellType.h,<br>
but they will be soon. Enums and constant variables that are class<br>
members are also wrapped, so vtkDataObject.POINT_DATA_FIELD can be<br>
used. Note that the vast majority of these enums have BTX/ETX around<br>
them and are only wrapped because in the git head I am forcing the<br>
wrappers to ignore BTX/ETX in the main "kit" directories. So the<br>
wrapping of these enums will only become permanent when the BTX/ETX<br>
markers are removed.<br></blockquote><div><br></div><div>This is great news, and I am very pleased we can start using the enum values. Can we start using the enum types in our API too, i.e. go from void SetType(int enumValue) to void SetType(enumType enumValue)? </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
3) The vtkDataArray GetTuple() and SetTuple() methods are wrapped. So<br>
python users don't have to use the SetTuple2(), GetTuple3() methods<br>
anymore.<br></blockquote><div><br></div><div>Does this mean we could deprecate some of this API, or is it still very much required for the Tcl and Java wrappers? </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
v = vtkIntArray()<br>
v.SetNumberOfComponents(3)<br>
v.InsertNextTuple((1, 2, 3))<br>
or to insert without intermediate conversion to "double":<br>
v.InsertNextTupleValue((1,2,3))<br>
(x,y,z) = v.GetTuple(0)<br>
or use RHS get method:<br>
rval = [0,0,0]<br>
v.GetTupleValue(1, rval)<br>
<br>
4) Clinton has added a two-way VTK/Python/SIP bridge and has wrapped<br>
the GUISupport/Qt directory. I've compiled this but haven't tried it<br>
yet. A couple tests/examples would be nice (hint hint).<br>
<br>
So, that's it for now. Enjoy.<br></blockquote><div><br></div><div>Sounds great, well worth a few of the length rebuilds required ;-) I will be testing some of this out, and would like to start streamlining the API in some of the classes I work on.</div>
<div><br></div><div>Thanks!</div><div><br></div><div>Marcus</div><div>--</div>Marcus D. Hanwell, Ph.D.<br>R&D Engineer, Kitware Inc.<br>(518) 881-4937</div>