[Paraview] Scaling cylinder glyph's radius and height individually
Cory Quammen
cory.quammen at kitware.com
Fri Jan 19 10:59:44 EST 2018
Ahmad,
Please keep replies on the mailing list. Responses are inlined.
On Tue, Jan 16, 2018 at 9:25 AM, Ahmad . <super_achie at hotmail.com> wrote:
> Hi Cory,
>
>
> Thanks for your reply.
>
>
> I am trying to implement your suggestion of extending the vtkGlyph3D with
> this additional "scaling by normals".
>
> The idea seems quite straightforward. I was just wondering how to
> incorporate this new class in my C++ pipeline.
>
> Currently I create the glyph, and set its properties, like this:
>
>
> vtkSmartPointer<vtkSMSourceProxy> glyph;
> glyph.TakeReference(vtkSMSourceProxy::SafeDownCast(
> session_manager_->NewProxy("filters", "Glyph")));
> controller_->PreInitializeProxy(glyph);
>
> vtkSMPropertyHelper(glyph, "Input").Set(producer);
> vtkSMPropertyHelper(glyph, "Source").Set(
> GetCylinderSource(glyph));
> vtkSMPropertyHelper(glyph, "ScaleMode", true).Set(0);
> vtkSMPropertyHelper(glyph, "ScaleFactor", true).Set(1.0);
> vtkSMPropertyHelper(glyph, "GlyphMode", true).Set(0);
>
> As you can see I am not directly working with vtkGlyph3D or
> vtkPVGlyphFilter classes, but I am using the vtkSMPropertyHelper to take
> care of the boilerplate code.
>
>
Right. Unfortunately, implementing my suggestion would require creating a
subclass of vtkPVGlyphFilter and importing that with a ParaView plugin. See
the ParaView Howto on how to add a filter to ParaView.
> After I created a new class that has this extra scaling option, how would
> I go about using this in such a pipeline? Do I need to 'register' my "
> ModifiedGlyph" to the filter proxies to be able to do something like
> `NewProxy("filters", "ModifiedGlyph")`?
>
Yes, that should do it. Your modified glyph class will be available once
you've imported the ParaView plugin mentioned above.
A quick question about setting the active normals. Is there an existing way
> to do this, or would I need to do this myself? I would like to do this the
> same way one would set the "Scalars":
>
>
> vtkSMPropertyHelper(glyph, "Normals")
> .SetInputArrayToProcess(vtkDataObject::POINT, "ScalingArray");
>
I think that should work.
Best,
Cory
> Looking forward to your reply.
>
> Best,
> Ahmad
>
>
>
> ------------------------------
> *Van:* Cory Quammen <cory.quammen at kitware.com>
> *Verzonden:* dinsdag 9 januari 2018 15:30
> *Aan:* Ahmad .
> *CC:* paraview at paraview.org
> *Onderwerp:* Re: [Paraview] Scaling cylinder glyph's radius and height
> individually
>
> Hi Ahmad,
>
> Alas, reading the code of vtkGlyph3D, you cannot orient by a vector
> array different from the vector array used to do the scaling using the
> functionality in ParaView. You would have to modify either
> vtkPVGlyphFilter or its parent class vtkGlyph3D, to do this, and
> expose the new VTK class through a ParaView plugin [1]. A simple
> modification would be to add a ScaleMode, say VTK_SCALE_BY_NORMAL, to
> vtkGlyph3D, and then set the active normals in your data set to the
> vector by which you wish to scale. Then the "vectors" property could
> control the orientation and the active normals would control the
> scale. That's kind of kludgey, but it would be a fairly fast
> modification to make.
>
> HTH,
> Cory
>
> [1] https://www.paraview.org/Wiki/ParaView/Plugin_HowTo
> ParaView/Plugin HowTo - KitwarePublic
> <https://www.paraview.org/Wiki/ParaView/Plugin_HowTo>
> www.paraview.org
> Introduction. ParaView comes with plethora of functionality bundled in:
> several readers, multitude of filters, quite a few different types of views
> etc.
>
>
>
>
> On Tue, Jan 9, 2018 at 7:43 AM, Ahmad . <super_achie at hotmail.com> wrote:
> > Just want to add that a programmatic (C++) solution is preferred rather
> than
> > using the GUI
> >
> >
> > I have a C++ pipeline where I can set the properties of the cylinder
> glyph
> > with vtkSMPropertyHelper.
> >
> > I have looked in filters.xml under vtkPVGlyphFilter source proxy (file
> > located in
> > <paraview_home>/ParaViewCore/ServerManager/SMApplication/Resources) to
> see
> > what my options are, but there is only one "SetInputArrayToProcess" that
> > takes a vector attribute as input; nothing about a vector specifically
> for
> > orientation..
> >
> > Suggestions on how to handle this issue, are very welcome; other
> approaches
> > than mine as well!
> >
> > ________________________________
> > Van: Ahmad . <super_achie at hotmail.com>
> > Verzonden: maandag 8 januari 2018 20:52
> > Aan: paraview at paraview.org
> > Onderwerp: Re: Scaling cylinder glyph's radius and height individually
> >
> >
> > Following up on my own question, I found out that if I scale by "Vector
> > Components" it is possible to change the length of the cylinders with the
> > second vector index, and the radius with the first and third. I need to
> > rearrange my attribute data as such: [radius_x, length, radius_z]. If I
> keep
> > radius_x == radius_z, then the cylinder will not deform, and the cross
> > section stays a perfect circle. See the image in the attachment please.
> >
> >
> > BUT the problem here is that "vector components" also affects the
> > orientation of my cylindrical glyphs. I can turn this off in the
> properties
> > menu, but I need to orient my cylinders based on another vector attribute
> > data...
> >
> >
> > I feel I'm getting somewhere, but if someone could give me an idea on
> how to
> > now orient my glyphs with another vector data than the one I use now for
> > scaling, that would be much appreciated!
> >
> >
> > Best,
> > Ahmad
> >
> > ________________________________
> > Van: Ahmad . <super_achie at hotmail.com>
> > Verzonden: maandag 8 januari 2018 18:01
> > Aan: paraview at paraview.org
> > Onderwerp: Scaling cylinder glyph's radius and height individually
> >
> >
> > Dear community,
> >
> >
> > When I try to scale cylindrical glyph objects by a 'Scalar', it scales
> both
> > the radius and height of the glyphs.
> >
> > Is there a way to scale the radius by a Scalar1, and the height be a
> > Scalar2?
> >
> >
> > I have an unstructured grid, and for each point I want to create a
> cylinder
> > that can have an arbitrary radius and height.
> >
> > I thought Glyphs would be the way to go, but I'm kind of stuck with this
> > issue.
> >
> >
> > Any help is much appreciated; or if you can recommend a different way to
> > achieve the above-mentioned please let me know!
> >
> >
> > Best,
> >
> > Ahmad
> >
> >
> > _______________________________________________
> > 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 ParaView Wiki at:
> > http://paraview.org/Wiki/ParaView
> ParaView - KitwarePublic <http://paraview.org/Wiki/ParaView>
> paraview.org
> ParaView is an open-source, multi-platform application designed to
> visualize data sets of varying sizes from small to very large. The goals of
> the ParaView project ...
>
>
> >
> > Search the list archives at: http://markmail.org/search/?q=ParaView
> >
> > Follow this link to subscribe/unsubscribe:
> > https://paraview.org/mailman/listinfo/paraview
> ParaView Info Page <https://paraview.org/mailman/listinfo/paraview>
> paraview.org
> To see the collection of prior postings to the list, visit the ParaView
> Archives. Using ParaView: To post a message to all the list members, send
> ...
>
>
> >
>
>
>
> --
> Cory Quammen
> Staff R&D Engineer
> Kitware, Inc.
>
--
Cory Quammen
Staff R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://paraview.org/pipermail/paraview/attachments/20180119/1a25a2a3/attachment.html>
More information about the ParaView
mailing list