[vtkusers] Dynamic creation of VTK objects in Tcl

Andy Cedilnik andy.cedilnik at kitware.com
Thu Jul 31 08:18:20 EDT 2003


Hi Magnus,

What about this:

proc CreateMapper { } {
  vtkMapper m
  return m
}
proc CreateActor { } {
  vtkActor a
  return a
}

set actor [ CreateActor ]
set mapper [ CreateMapper ]

$actor SetMapper $mapper

Then you could say something like:

proc Create { type } {
  vtk$type t
  return t
}

set ob1 [ Create "Mapper" ]
set ob2 [ Create "Actor" ]

$ob2 SetMapper $ob1

Looks good?



On Thu, 2003-07-31 at 03:58, Magnus Gedda wrote:
> Is there a way to create VTK objects (sources, filters, etc.)
> dynamically in Tcl?
> 
> I don't want to be restrained to using predefined objects since it would
> limit my application tremendously. So I need to write a object factory
> of some sort, but how do I do it in Tcl?





More information about the vtkusers mailing list