[vtkusers] 3D Axes For User Orientation...

Andrew J. P. Maclean a.maclean at cas.edu.au
Wed Jul 14 02:19:57 EDT 2004


Andrea, if you are using TCL, it is quite easily done as follows. If you are
using Python, this may give you some ideas.

Amy, maybe we should also have a TCL example in the VTK source tree. If you
want, I can knock one up using the code below. 

This really is a brilliant little widget!

Regards
    Andrew

#------------- Orientation Marker 
# Do this after you have initialised the interactor.
# Orientation Marker 
vtkAxesActor axes
  axes SetShaftTypeToCylinder
  axes SetXAxisLabelText "x"
  axes SetYAxisLabelText "y"
  axes SetZAxisLabelText "z"

  axes SetTotalLength 1.5 1.5 1.5
  axes SetCylinderRadius [expr 0.500 * [axes GetCylinderRadius]]
  axes SetConeRadius     [expr 1.025 * [axes GetConeRadius]]
  axes SetSphereRadius   [expr 1.500 * [axes GetSphereRadius]]

# vtkCaptionActor2D - just a reminder as to the type, we are using a pointer
here.
set cax [axes GetXAxisCaptionActor2D]
# vtkTextProperty - just a reminder as to the type, we are using a pointer
here.
set tprop [$cax GetCaptionTextProperty]
  $tprop ItalicOn
  $tprop ShadowOn
  $tprop SetFontFamilyToTimes

set cay [axes GetYAxisCaptionActor2D]
set caz [axes GetZAxisCaptionActor2D]
  $cay SetCaptionTextProperty $tprop
  $caz SetCaptionTextProperty $tprop

# Combine orientation markers into one with an assembly
#
vtkPropAssembly assembly
  assembly AddPart axes
# Add more markers to the assembly if you want.

# Finally ... set up the widget
#
vtkOrientationMarkerWidget widget
  widget SetOutlineColor 0.9300 0.5700 0.1300
  widget SetOrientationMarker assembly
  widget SetInteractor iren
  widget SetViewport 0.0 0.0 0.4 0.4 
  widget SetEnabled 1
  widget InteractiveOff
  widget InteractiveOn
#--------------------------------


___________________________________________

Andrew J. P. Maclean

Centre for Autonomous Systems
The Rose Street Building J04
The University of Sydney  2006  NSW
AUSTRALIA

Ph: +61 2 9351 3283
Fax: +61 2 9351 7474

URL: http://www.cas.edu.au/
___________________________________________


-----Original Message-----
From: Andrea Gavana [mailto:andrea.gavana at polymtl.ca] 
Sent: Wednesday, 14 July 2004 06:47
To: vtkusers at vtk.org
Subject: Re: [vtkusers] 3D Axes For User Orientation...

Selon Amy Henderson <amy.henderson at kitware.com>:

> Hi Andrea,
> 
> Try using vtkOrientationMarkerWidget. Take a look at 
> VTK/Hybrid/Testing/Cxx/TestOrientationMarkerWidget.cxx
> 
> - Amy
> 

Hi Amy,

   thank you a lot for your suggestion... I think that probably it is too 
complicated for me (I know I know, I should learn C/C++, but Python is so
nice 
and simple...). I don't have Python here at home, and I don't know if this 
class is present in the vtkpython wrappers (Python 2.3, VTK 4.2.4). I will
try 
it tomorrow, but I don't have a big expectation on my ability to understand
the 
example in VTK/Hybrid/Testing/Cxx/TestOrientationMarkerWidget.cxx (and also
to 
understand what the documentation for vtkOrientationMarkerWidget says about 
it... it is quite complex for a non-english person ;-) ).
   Anyway, thank you for your interest on this question. If someone else has

other suggestion, please let me know.

Andrea.

 





More information about the vtkusers mailing list