# [vtkusers] Edge size.

Marco Salatin marco.salatin at gmail.com
Wed Aug 27 16:45:37 EDT 2014

```WOW,
thanks, nice!
i use
Actor.GetProperty().SetLineWidth(1)

but if i set it to 20 instead 1, it will make a goo Edge.

2014-08-27 0:25 GMT+02:00 Meehan, Bernard <MEEHANBT at nv.doe.gov>:

> Hi Marco - have you looked at these classes?:
>
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ImplicitModeller
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ImplicitDataSetClipping
>
> In this python code, I was using the vtkImplicitPolyDataDistance object to
> find an isosurface that was a given distance away from the surface of a
> cone, and I then cut it to show a cross-section of the surface. I'm not
> sure what sort of offset surface you were looking to make, but this might
> do the trick for you:
>
> from vtk import *
>
> cone = vtkConeSource()
> cone.SetResolution(100)
> cone.Update()
> # You have to call update before the bounds of the object are valid. I am
> # increasing the bounds of the object by a fixed percentage in order to
> get a
> # volume that is larger than just the simple bounds of the object.
> bounds = list(1.2*s for s in cone.GetOutputDataObject(0).GetBounds())
>
> # I also want the sample dimensions to be chosen such that the "voxels"
> will be
> # pretty much cubic.
> dx = bounds[1] - bounds[0]
> dy = bounds[3] - bounds[2]
> dz = bounds[5] - bounds[4]
>
> # I want to subdivide the minimum dimension into 20 parts, and the others
> # relative to this.
> s = min(dx, dy, dz)
> delta = s/20.
>
> # Given this minimum sample size, you can pick the correct number of x, y,
> and
> # z samples for the vtkSampleFunction.
> Nx, Ny, Nz = [int(s/delta) for s in (dx, dy, dz)]
>
> # This gives a field of minimum distances to the input vtkPolyData object.
> ipd.SetInput(cone.GetOutputDataObject(0))
>
> sample = vtk.vtkSampleFunction()
> sample.SetSampleDimensions(Nx, Ny, Nz)
> sample.SetImplicitFunction(ipd)
> sample.SetModelBounds(*bounds)
> sample.Update()
>
> contour = vtk.vtkContourFilter()
> contour.SetInputConnection(sample.GetOutputPort())
> contour.SetValue(0, 0.1)
> contour.Update()
>
> cutter_plane = vtk.vtkPlane()
> cutter_plane.SetOrigin(*cone.GetOutputDataObject(0).GetCenter())
> cutter_plane.SetNormal(0., 0., 1.)
>
> cutter = vtk.vtkCutter()
> cutter.SetCutFunction(cutter_plane)
> cutter.SetInputConnection(contour.GetOutputPort())
> cutter.Update()
>
> stripper = vtk.vtkStripper()
> stripper.SetInputConnection(cutter.GetOutputPort())
> stripper.Update()
>
> mapper = vtk.vtkPolyDataMapper()
> # mapper.SetInputConnection(contour.GetOutputPort())
> # mapper.SetInputConnection(cutter.GetOutputPort())
> mapper.SetInputConnection(stripper.GetOutputPort())
> mapper.ScalarVisibilityOff()
>
> cone_mapper = vtk.vtkPolyDataMapper()
> cone_mapper.SetInputConnection(cone.GetOutputPort())
>
> actor = vtk.vtkActor()
> actor.SetMapper(mapper)
> # actor.GetProperty().SetColor(0.5, 0.2, 1.0)
> # actor.GetProperty().SetOpacity(0.2)
>
> cone_actor = vtk.vtkActor()
> cone_actor.SetMapper(cone_mapper)
> cone_actor.GetProperty().SetOpacity(0.5)
>
> ren = vtk.vtkRenderer()
> ren.SetBackground(.2, .3, .4)
>
> renw = vtk.vtkRenderWindow()
>
> iren = vtk.vtkRenderWindowInteractor()
> iren.SetRenderWindow(renw)
>
> ren.ResetCamera()
> renw.Render()
> iren.Start()
>
>
>
>
>
> On 8/25/14 12:41 AM, "Marco Salatin" <marco.salatin at gmail.com> wrote:
>
> >Hello vtk users,
> >                      there are some one who can help me to do a function
> >that can increase offset (shell) of edge of a object?
> >
> >Thanks
> >
> >Marco
> >
> >
> >
> >--
> >View this message in context:
> >http://vtk.1045678.n5.nabble.com/Edge-size-tp5728359.html
> >Sent from the VTK - Users mailing list archive at Nabble.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
> >
> >http://public.kitware.com/mailman/listinfo/vtkusers
> >
>
>
> _______________________________________________
>
> 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
>
> http://public.kitware.com/mailman/listinfo/vtkusers
>

--
---
www.salatin.eu
-------------- next part --------------
An HTML attachment was scrubbed...