<div dir="ltr">Justin,<div><br></div><div>I just did some more digging. You might want to try</div><div><br></div><div><a href="http://www.vtk.org/doc/nightly/html/classvtkTableBasedClipDataSet.html">http://www.vtk.org/doc/nightly/html/classvtkTableBasedClipDataSet.html</a><br></div><div><br></div><div>The docs say it preserves the input cells whenever possible, which is what you are looking for.</div><div><br></div><div>I think you should be able to just swap out your vtkClipDataSet variable declaration with a vtkTableBasedClipDataSet variable declaration.</div><div><br></div><div>Cory</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 24, 2016 at 4:40 PM, Justin Weber <span dir="ltr"><<a href="mailto:onlyjus@gmail.com" target="_blank">onlyjus@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks for your help Cory.<span class="HOEnZb"><font color="#888888"><div><br></div><div>Justin</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 24, 2016 at 2:32 PM, Cory Quammen <span dir="ltr"><<a href="mailto:cory.quammen@kitware.com" target="_blank">cory.quammen@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I don't think there are options in VTK that will do what you want, unfortunately. You would need to manually identify which hexahedra are not cut and then create a new vtkUnstructuredGrid with those hexahedra as well as the cut tetrahedra.</div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 24, 2016 at 2:21 PM, Justin Weber <span dir="ltr"><<a href="mailto:onlyjus@gmail.com" target="_blank">onlyjus@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">It would be nice if the grid was not <span style="font-size:12.8px">tetrahedralized first. I would like the original hexahedrons that are not sliced to be preserved.</span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 24, 2016 at 11:59 AM, Cory Quammen <span dir="ltr"><<a href="mailto:cory.quammen@kitware.com" target="_blank">cory.quammen@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">What do you want as output instead?<br>
<div><div><br>
On Thu, Mar 24, 2016 at 10:53 AM, Justin Weber <<a href="mailto:onlyjus@gmail.com" target="_blank">onlyjus@gmail.com</a>> wrote:<br>
> I didn't realize this earlier but the vtkClipDataSet tetrahedralizes the<br>
> mesh before slicing? It seems that this is required for the algorithm. Do<br>
> you know of any ways to prevent this?<br>
><br>
> BTW, here is the link to the example:<br>
> <a href="http://www.vtk.org/Wiki/VTK/Examples/Python/Meshes/vtkClipDataSetWithPolydata" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Python/Meshes/vtkClipDataSetWithPolydata</a><br>
><br>
> Justin<br>
><br>
> On Mon, Mar 7, 2016 at 5:30 PM, Cory Quammen <<a href="mailto:cory.quammen@kitware.com" target="_blank">cory.quammen@kitware.com</a>><br>
> wrote:<br>
>><br>
>> That's great, Justin. Thanks for reporting back.<br>
>><br>
>> Cory<br>
>><br>
>> On Mon, Mar 7, 2016 at 4:04 PM, Justin Weber <<a href="mailto:onlyjus@gmail.com" target="_blank">onlyjus@gmail.com</a>> wrote:<br>
>>><br>
>>> Cory,<br>
>>><br>
>>> Thanks for your help. I got it working! I might put the code up as an<br>
>>> example.<br>
>>><br>
>>><br>
>>> Justin<br>
>>><br>
>>> On Thu, Feb 18, 2016 at 10:58 PM, Cory Quammen <<a href="mailto:cory.quammen@kitware.com" target="_blank">cory.quammen@kitware.com</a>><br>
>>> wrote:<br>
>>>><br>
>>>> Justin,<br>
>>>><br>
>>>> There is nothing canned in VTK to do this, but with some work you should<br>
>>>> be able to get there using an implicit function created from your STL file.<br>
>>>> At a high level, what you would do is create an instance of<br>
>>>> vtkImplicitPolyDataDistance. Set its input to the poly data from the STL<br>
>>>> file. Then, create a new point data array in your structured grid that<br>
>>>> stores the value from the implicit poly data distance filter. Negative<br>
>>>> values will be inside the poly data, positive values outside, and 0 at the<br>
>>>> surface. Finally, use vtkClipDataSet to clip the structured grid a function<br>
>>>> value 0. This should give you back an unstructured grid in approximately the<br>
>>>> shape of your input STL. It won't be exact because of the interpolation used<br>
>>>> by vtkClipDataSet, but it should be close.<br>
>>>><br>
>>>> Hope that helps.<br>
>>>><br>
>>>> Cory<br>
>>>><br>
>>>> On Thu, Feb 18, 2016 at 10:08 PM, Justin Weber <<a href="mailto:onlyjus@gmail.com" target="_blank">onlyjus@gmail.com</a>><br>
>>>> wrote:<br>
>>>>><br>
>>>>> I would like to generate a "cutcell" mesh using vtk by slicing a<br>
>>>>> structured grid with polydata loaded from a STL file. The resulting mesh<br>
>>>>> would be an unstructured grid.<br>
>>>>><br>
>>>>> Are there any tools in vtk to accomplish this?<br>
>>>>><br>
>>>>> I can create the structured grid and polydata successfully. Now I just<br>
>>>>> need an algorithm to slice the structured mesh with the polydata surface.<br>
>>>>><br>
>>>>> In my searching I could not find anything. However, I could accomplish<br>
>>>>> this by ray casting to find the intersections between the structured grid<br>
>>>>> and the polydata. Then using those points to create the unstructured grid.<br>
>>>>><br>
>>>>> See attached 2d sketch.<br>
>>>>><br>
>>>>> Thanks!<br>
>>>>> Justin<br>
>>>>><br>
>>>>><br>
>>>>> _______________________________________________<br>
>>>>> Powered by <a href="http://www.kitware.com" rel="noreferrer" 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" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
>>>>><br>
>>>>> Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
>>>>><br>
>>>>> Follow this link to subscribe/unsubscribe:<br>
>>>>> <a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
>>>>><br>
>>>><br>
>>>><br>
>>>><br>
>>>> --<br>
>>>> Cory Quammen<br>
>>>> R&D Engineer<br>
>>>> Kitware, Inc.<br>
>>><br>
>>><br>
>><br>
>><br>
>><br>
>> --<br>
>> Cory Quammen<br>
>> R&D Engineer<br>
>> Kitware, Inc.<br>
><br>
><br>
<br>
<br>
<br>
--<br>
Cory Quammen<br>
R&D Engineer<br>
Kitware, Inc.<br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Cory Quammen<br>R&D Engineer<br>Kitware, Inc.</div>
</div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Cory Quammen<br>R&D Engineer<br>Kitware, Inc.</div>
</div>