<html><head></head><body><div style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><div style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><div>Or you could use <span>vtkRotationalExtrusionFilter with an angled line.</span><br></div><div><div><br></div><div class="ydp2ea18441signature"><div style="font-size:16px;font-family:Helvetica, Arial, sans-serif;"><div>Todd Martin, PhD.<br></div><div><i>Freelance Engineer/Software Architect.</i></div><br></div></div></div>
        <div><br></div><div><br></div>
        
        </div><div id="yahoo_quoted_1944115514" class="yahoo_quoted">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div>
                    On Friday, July 13, 2018, 1:21:53 PM GMT+12, kenichiro yoshimi <rccm.kyoshimi@gmail.com> wrote:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div dir="ltr">Hi,<br clear="none"><br clear="none">The easiest way to create a tapered hollow cylinder is scaling the<br clear="none">points on top surface of the cylinder created as an extrusion of a<br clear="none">disk. The sample code below shows this:<br clear="none"><br clear="none">------<br clear="none">#!/usr/bin/env python<br clear="none"># -*- coding: utf-8 -*-<br clear="none"><br clear="none">import vtk<br clear="none"><br clear="none"><br clear="none">def main():<br clear="none">    colors = vtk.vtkNamedColors()<br clear="none"><br clear="none">    diskSource = vtk.vtkDiskSource()<br clear="none">    diskSource.SetInnerRadius(0.5);<br clear="none">    diskSource.SetOuterRadius(1.0);<br clear="none">    diskSource.SetRadialResolution(1);<br clear="none">    diskSource.SetCircumferentialResolution(40);<br clear="none"><br clear="none">    # Apply linear extrusion<br clear="none">    extrude = vtk.vtkLinearExtrusionFilter()<br clear="none">    extrude.SetInputConnection(diskSource.GetOutputPort())<br clear="none">    extrude.SetExtrusionTypeToNormalExtrusion();<br clear="none">    extrude.SetVector(0, 0, 2)<br clear="none">    extrude.Update()<br clear="none"><br clear="none">    # Taper the cylinder<br clear="none">    scale = 0.5<br clear="none">    taperedCylinder = extrude.GetOutput()<br clear="none">    points = taperedCylinder.GetPoints()<br clear="none">    numPts = taperedCylinder.GetNumberOfPoints()<br clear="none">    for ptId in range(numPts/2, numPts):<br clear="none">      point = points.GetPoint(ptId)<br clear="none">      points.SetPoint(ptId, point[0]*scale, point[1]*scale, point[2])<br clear="none"><br clear="none">    # Create a mapper and actor.<br clear="none">    mapper = vtk.vtkPolyDataMapper()<br clear="none">    mapper.SetInputData(taperedCylinder)<br clear="none"><br clear="none">    actor = vtk.vtkActor()<br clear="none">    actor.GetProperty().SetColor(colors.GetColor3d("Cornsilk"))<br clear="none">    actor.SetMapper(mapper)<br clear="none"><br clear="none">    # Create a renderer, render window, and interactor<br clear="none">    renderer = vtk.vtkRenderer()<br clear="none">    renderWindow = vtk.vtkRenderWindow()<br clear="none">    renderWindow.SetWindowName("TaperedCylinder")<br clear="none">    renderWindow.AddRenderer(renderer)<br clear="none">    renderWindowInteractor = vtk.vtkRenderWindowInteractor()<br clear="none">    renderWindowInteractor.SetRenderWindow(renderWindow)<br clear="none"><br clear="none">    # Add the actors to the scene<br clear="none">    renderer.AddActor(actor)<br clear="none">    renderer.SetBackground(colors.GetColor3d("DarkGreen"))<br clear="none"><br clear="none">    # Render and interact<br clear="none">    renderWindow.Render()<br clear="none">    renderWindowInteractor.Start()<br clear="none"><br clear="none"><br clear="none">if __name__ == '__main__':<br clear="none">    main()<br clear="none">------<br clear="none"><br clear="none">Regards<br clear="none">2018年7月12日(木) 21:12 M_skov <<a shape="rect" ymailto="mailto:M.skovmand1@gmail.com" href="mailto:M.skovmand1@gmail.com">M.skovmand1@gmail.com</a>>:<br clear="none">><br clear="none">> Hello there.<br clear="none">><br clear="none">> Disclaimer, I am quite new to using VTK, and even coding in general (which<br clear="none">> is done in Python).<br clear="none">> I am trying to visualize a tapered hollow cylinder, I have start and<br clear="none">> end-coordinates (x,y,z) and a different diameter at each coordinate.<br clear="none">>      ___<br clear="none">>    /      \<br clear="none">>   /        \  This is basically what I want.<br clear="none">>  /_____ \<br clear="none">><br clear="none">> I have searched, quite a bit, but have yet to find a solution to this.<br clear="none">> As of right now, when the diameters are equal, I am visualizing the cylinder<br clear="none">> as an extruded disk, transforming it for the orientation, which works<br clear="none">> perfectly!<br clear="none">><br clear="none">> I have been looking at vtktubefilter, but as I see it, I end up losing my<br clear="none">> wall thickness using that option.<br clear="none">> Is there a radius scaling factor I have overlooked, or other functions that<br clear="none">> can help me accomplish this?<br clear="none">><br clear="none">> Hoping the question is clear and that someone is able to assist me in this.<br clear="none">> Have a nice day!<br clear="none">><br clear="none">> - Martin<br clear="none">><br clear="none">><br clear="none">><br clear="none">><br clear="none">> --<br clear="none">> Sent from: <a shape="rect" href="http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html" target="_blank">http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html</a><br clear="none">> _______________________________________________<br clear="none">> Powered by www.kitware.com<br clear="none">><br clear="none">> Visit other Kitware open-source projects at <a shape="rect" href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br clear="none">><br clear="none">> Please keep messages on-topic and check the VTK FAQ at: <a shape="rect" href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br clear="none">><br clear="none">> Search the list archives at: <a shape="rect" href="http://markmail.org/search/?q=vtkusers" target="_blank">http://markmail.org/search/?q=vtkusers</a><br clear="none">><br clear="none">> Follow this link to subscribe/unsubscribe:<br clear="none">> <a shape="rect" href="https://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">https://public.kitware.com/mailman/listinfo/vtkusers</a><div class="yqt7510915195" id="yqtfd43329"><br clear="none">_______________________________________________<br clear="none">Powered by www.kitware.com<br clear="none"><br clear="none">Visit other Kitware open-source projects at <a shape="rect" href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br clear="none"><br clear="none">Please keep messages on-topic and check the VTK FAQ at: <a shape="rect" href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br clear="none"><br clear="none">Search the list archives at: <a shape="rect" href="http://markmail.org/search/?q=vtkusers" target="_blank">http://markmail.org/search/?q=vtkusers</a><br clear="none"><br clear="none">Follow this link to subscribe/unsubscribe:<br clear="none"><a shape="rect" href="https://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">https://public.kitware.com/mailman/listinfo/vtkusers</a><br clear="none"></div></div></div>
            </div>
        </div></div></body></html>