[vtkusers] Using vtkDiskSource/vtkLinearExtrusionFilter with vtkCubeSource - how to create the hole through the cube?

David Gobbi david.gobbi at gmail.com
Fri Sep 19 17:41:32 EDT 2014


So you want to have a cube with a cylindrical hole that goes all the
way through it?  It's not easy, but it's possible.

First, you'll want to reverse the sense of your pipe, so that the
faces face inwards.  This can be done with vtkReverseSense.

Next, append it to your cube with vtkAppendPolyData.

The third step is the tricky one: you have to re-build the faces of
this combined polydata so that the faces form a single closed surface
(i.e. instead of forming one surface for the cube and another separate
surface for the pipe).  This can be done with vtkClipClosedSurface,
because it can clip away the old, unconnected surfaces and build new
surfaces that connect the outside of the box with the inside of the
pipe.

I don't have an example that does this, but you can look at the
wiki page http://www.vtk.org/Wiki/VTK/Closed_Surface_Clipping
for hints.  Basically, if you clip away the original cube faces (by
setting clipping planes that are just inside of the original faces),
you can get vtkClipClosedSurface to create new faces with good
connectivity between the cube and the pipe.

Note that I didn't say it will be easy... I just said it will be possible.

 - David



On Fri, Sep 19, 2014 at 3:17 PM, Sid Murthy <sid.murthy at gmail.com> wrote:
> Hi -
>
>   I am using a vtkDiskSource and vtkLinearExtrusionFilter to create a pipe
> (with a hole). I'd like to put this pipe through a cube (vtkCubeSource) and
> still retain the hole in the middle. Is this possible - somehow - with
> vtkcutter or vtkclippolydata?
>
>
> Thanks,
> Sid


More information about the vtkusers mailing list