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

Cory Quammen cory.quammen at kitware.com
Fri Sep 19 22:04:14 EDT 2014


If you want a box with a hole through it, you could also try the
vtkBooleanOperationPolyDataFilter with the first input set to the
output of a vtkCubeSource and the second input set to a
vtkCylinderSource where the cylinder ends lie somewhat outside the
cube bounds. Set the operation to difference and you should get a cube
with a hole through it.

See http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/BooleanOperationPolyDataFilter
for an example.

There are some cases on which the vtkBooleanOperationPolyDataFilter
fails, but this application sounds simple enough that it should work.

Cory

On Fri, Sep 19, 2014 at 5:41 PM, David Gobbi <david.gobbi at gmail.com> wrote:
> 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
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers


More information about the vtkusers mailing list