<div dir="ltr"><div><div><div>WOW,<br></div> thanks, nice!<br></div>i use <br>Actor.GetProperty().SetLineWidth(1)<br><br></div>but if i set it to 20 instead 1, it will make a goo Edge.<br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">2014-08-27 0:25 GMT+02:00 Meehan, Bernard <span dir="ltr"><<a href="mailto:MEEHANBT@nv.doe.gov" target="_blank">MEEHANBT@nv.doe.gov</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Marco - have you looked at these classes?:<br>
<br>
<a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ImplicitModeller" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ImplicitModeller</a><br>
<a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ImplicitPolyDataDistance" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ImplicitPolyDataDistance</a><br>
<a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ImplicitDataSetClipping" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ImplicitDataSetClipping</a><br>
<br>
In this python code, I was using the vtkImplicitPolyDataDistance object to<br>
find an isosurface that was a given distance away from the surface of a<br>
cone, and I then cut it to show a cross-section of the surface. I'm not<br>
sure what sort of offset surface you were looking to make, but this might<br>
do the trick for you:<br>
<br>
from vtk import *<br>
<br>
cone = vtkConeSource()<br>
cone.SetResolution(100)<br>
cone.Update()<br>
# You have to call update before the bounds of the object are valid. I am<br>
# increasing the bounds of the object by a fixed percentage in order to<br>
get a<br>
# volume that is larger than just the simple bounds of the object.<br>
bounds = list(1.2*s for s in cone.GetOutputDataObject(0).GetBounds())<br>
<br>
# I also want the sample dimensions to be chosen such that the "voxels"<br>
will be<br>
# pretty much cubic.<br>
dx = bounds[1] - bounds[0]<br>
dy = bounds[3] - bounds[2]<br>
dz = bounds[5] - bounds[4]<br>
<br>
# I want to subdivide the minimum dimension into 20 parts, and the others<br>
# relative to this.<br>
s = min(dx, dy, dz)<br>
delta = s/20.<br>
<br>
# Given this minimum sample size, you can pick the correct number of x, y,<br>
and<br>
# z samples for the vtkSampleFunction.<br>
Nx, Ny, Nz = [int(s/delta) for s in (dx, dy, dz)]<br>
<br>
# This gives a field of minimum distances to the input vtkPolyData object.<br>
ipd = vtkImplicitPolyDataDistance()<br>
ipd.SetInput(cone.GetOutputDataObject(0))<br>
<br>
sample = vtk.vtkSampleFunction()<br>
sample.SetSampleDimensions(Nx, Ny, Nz)<br>
sample.SetImplicitFunction(ipd)<br>
sample.SetModelBounds(*bounds)<br>
sample.Update()<br>
<br>
contour = vtk.vtkContourFilter()<br>
contour.SetInputConnection(sample.GetOutputPort())<br>
contour.SetValue(0, 0.1)<br>
contour.Update()<br>
<br>
cutter_plane = vtk.vtkPlane()<br>
cutter_plane.SetOrigin(*cone.GetOutputDataObject(0).GetCenter())<br>
cutter_plane.SetNormal(0., 0., 1.)<br>
<br>
cutter = vtk.vtkCutter()<br>
cutter.SetCutFunction(cutter_plane)<br>
cutter.SetInputConnection(contour.GetOutputPort())<br>
cutter.Update()<br>
<br>
stripper = vtk.vtkStripper()<br>
stripper.SetInputConnection(cutter.GetOutputPort())<br>
stripper.Update()<br>
<br>
mapper = vtk.vtkPolyDataMapper()<br>
# mapper.SetInputConnection(contour.GetOutputPort())<br>
# mapper.SetInputConnection(cutter.GetOutputPort())<br>
mapper.SetInputConnection(stripper.GetOutputPort())<br>
mapper.ScalarVisibilityOff()<br>
<br>
cone_mapper = vtk.vtkPolyDataMapper()<br>
cone_mapper.SetInputConnection(cone.GetOutputPort())<br>
<br>
actor = vtk.vtkActor()<br>
actor.SetMapper(mapper)<br>
# actor.GetProperty().SetColor(0.5, 0.2, 1.0)<br>
# actor.GetProperty().SetOpacity(0.2)<br>
<br>
cone_actor = vtk.vtkActor()<br>
cone_actor.SetMapper(cone_mapper)<br>
cone_actor.GetProperty().SetOpacity(0.5)<br>
<br>
ren = vtk.vtkRenderer()<br>
ren.AddActor(actor)<br>
ren.AddActor(cone_actor)<br>
ren.SetBackground(.2, .3, .4)<br>
<br>
renw = vtk.vtkRenderWindow()<br>
renw.AddRenderer(ren)<br>
<br>
iren = vtk.vtkRenderWindowInteractor()<br>
iren.SetRenderWindow(renw)<br>
<br>
ren.ResetCamera()<br>
renw.Render()<br>
iren.Start()<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
<br>
On 8/25/14 12:41 AM, "Marco Salatin" <<a href="mailto:marco.salatin@gmail.com">marco.salatin@gmail.com</a>> wrote:<br>
<br>
>Hello vtk users,<br>
> there are some one who can help me to do a function<br>
>that can increase offset (shell) of edge of a object?<br>
><br>
>Thanks<br>
><br>
>Marco<br>
><br>
><br>
><br>
>--<br>
>View this message in context:<br>
><a href="http://vtk.1045678.n5.nabble.com/Edge-size-tp5728359.html" target="_blank">http://vtk.1045678.n5.nabble.com/Edge-size-tp5728359.html</a><br>
>Sent from the VTK - Users mailing list archive at Nabble.com.<br>
>_______________________________________________<br>
>Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
>Visit other Kitware open-source projects at<br>
><a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
>Please keep messages on-topic and check the VTK FAQ at:<br>
><a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
>Follow this link to subscribe/unsubscribe:<br>
><a href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
><br>
<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>---<br><a href="http://www.salatin.eu" target="_blank">www.salatin.eu</a>
</div>