Hi

I used vtkSMPVRepresentationProxy::SetScalarColoring() as suggested ( which 
resolved the error message after I manually deleted my filter in the pipeline 
browser ) followed by 
vtkSMPVRepresentationProxy::RescaleTransferFunctionToDataRange() what allowed 
me to retrieve a valid RGBPoints array from the lookup table.   
myView->render() and setting the lookup table also helped me resolve the other 
issues and it all works nicely for me.
Now I am trying to wrap up my algorithm into a filter class and thought that 
either RequestData() or RequestUpdateExtent() may be a good place to do it. 
Unfortunately the pipeline representation object is not available when I create 
the filter for the first time and press Apply. I also figured out that once the 
filter has  been created, modified and the Apply button was pressed again the 
filter already knows that the representation is there. Is there a way around it 
to get this to work all the time or do I have to register a button which would 
need to be used after the filter has been created in the pipeline browser in 
order to update its properties for the first time ?

Andrzej





-----Original Message-----
From: Utkarsh Ayachit [mailto:utkarsh.ayac...@kitware.com]
Sent: 28 January 2016 15:07
To: Yumin Yuan
Cc: Andrzej Peczak; paraview@paraview.org
Subject: Re: [Paraview] Changing values of property panel


As a side note, for changing coloring on representations, I'd suggest using 
vtkSMPVRepresentationProxy::SetScalarColoring() [1] instead of changing 
"ColorArrayName" directly. That takes care of setting up lookup table etc. 
ParaView would.







[1] 
http://www.paraview.org/ParaView3/Doc/Nightly/www/cxx-doc/classvtkSMPVRepresentationProxy.html#acb45bfbb4940b0a6a30852aaff0a8b35

From: Yumin Yuan [mailto:yumin.y...@kitware.com]
Sent: 28 January 2016 14:02
To: Andrzej Peczak
Cc: paraview@paraview.org
Subject: Re: [Paraview] Changing values of property panel

Hi Andrzej,

On Thu, Jan 28, 2016 at 8:25 AM, Andrzej Peczak 
<apec...@ara.co.uk<mailto:apec...@ara.co.uk>> wrote:
Hi Yumin,

I used your snippet and it is working fine. I also tried to change the 
properties of the upstream filter in addition to the active one but it put me 
into trouble. I am modifying the properties with the following code where I 
want to change the visibility, surface representation and input array of the 
upstream. When I execute the code the widgets get changed but nothing happens 
in the view with regards to the changes I made to the upstream, that is the 
upstream object stays invisible. To make the object visible I have to manually 
click on the active object.

You may be missing a render call. Try adding the following at the end
 myView->render();

After that the upstream object becomes visible but then its colour mapping does 
not change in accordance with  the input array I set to the upstream.

You have to also set the same "LookupTable" to the upstream representation.

The other issue I have is when I delete my object from the pipeline after 
modifying the lookup table. Paraview displays "vtkSMPVRepresentationProxy 
(0x2f6c8c0): Failed to determine the LookupTable being used." message.

Which object? how did you delete it? Normally this message means you have an 
empty "LookupTable".

HTH
Yumin

        vtkSMProxy* repProxy = repr->getProxy();
        const char * arrayName = vtkSMPropertyHelper(repProxy, 
"ColorArrayName").GetInputArrayNameToProcess();
        int association = vtkSMPropertyHelper(repProxy, 
"ColorArrayName").GetInputArrayAssociation();

        pqDataRepresentation * uRepr = 
repr->getRepresentationForUpstreamSource();
        vtkSMProxy* uRepProxy = uRepr->getProxy();
        vtkSMPropertyHelper( uRepProxy, "ColorArrayName" 
).SetInputArrayToProcess( association, arrayName );
        vtkSMPropertyHelper( uRepProxy, "ColorArrayName" ).Set( arrayName );
        vtkSMPropertyHelper( uRepProxy, "Visibility" ).Set( 1 );
        vtkSMPropertyHelper( uRepProxy, "Representation" ).Set( "Surface" );

        repProxy->UpdateVTKObjects();
        uRepProxy->UpdateVTKObjects();


Andrzej
________________________________
From: Yumin Yuan [yumin.y...@kitware.com<mailto:yumin.y...@kitware.com>]
Sent: 27 January 2016 14:41
To: Andrzej Peczak
Cc: paraview@paraview.org<mailto:paraview@paraview.org>
Subject: Re: [Paraview] Changing values of property panel
Hi Andrzej,

The representation has its own SM proxy,

    vtkSMProxy* repProxy = repr->getProxy();
    vtkSMPropertyHelper(repProxy, "Representation").Set("Surface With Edges");
    vtkSMPropertyHelper(repProxy, "LineWidth").Set(2);

HTH,
Yumin


On Wed, Jan 27, 2016 at 7:36 AM, Andrzej Peczak 
<apec...@ara.co.uk<mailto:apec...@ara.co.uk>> wrote:

Hi

I am trying to find a way to modify property values of a filter. I figured out 
how to change values of the lookup table through its proxy after which the 
changes are visible in the colour map editor panel widgets.

I can do it with the following snippet code, however I have not found yet the 
way to change properties of the filter property panel.  I need to change the 
view representation of the filter to Surface With Edges and the line width. 
Where  do I acquire required proxy objects from ?

        pqPipelineRepresentation* repr = qobject_cast< 
pqPipelineRepresentation* >( pqActiveObjects::instance().activeRepresentation() 
);
        if ( repr ) {
                vtkSMProxy * lutProxy = repr->getLookupTable()->getProxy();
                if ( lutProxy ) {
                        vtkSMPropertyHelper( lutProxy, "NumberOfTableValues" 
).Set( this->scalars().count() - 1 );
                        lutProxy->UpdateVTKObjects();
                }
        }

Andrzej

**********************************************************************
Please consider the environment. Only print this email if absolutely necessary.

This email contains information that is private and confidential and is 
intended only for the addressee.
If you are not the intended recipient please delete it and notify us 
immediately by e-mailing the sender.
Note: All email sent to or from this address may be accessed by someone other 
than the recipient, for
system management and security reasons.
Aircraft Research Association Ltd.  Registered in England, Registration No 
503668 Registered Office:
Manton Lane, Bedford MK41 7PF England VAT No GB 196351245

**********************************************************************
_______________________________________________
Powered by www.kitware.com<http://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

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview


**********************************************************************

Please consider the environment. Only print this email if absolutely necessary.

This email contains information that is private and confidential and is 
intended only for the addressee.
If you are not the intended recipient please delete it and notify us 
immediately by e-mailing the sender.
Note: All email sent to or from this address may be accessed by someone other 
than the recipient, for
system management and security reasons.
Aircraft Research Association Ltd.  Registered in England, Registration No 
503668 Registered Office:
Manton Lane, Bedford MK41 7PF England VAT No GB 196351245

**********************************************************************

_______________________________________________
Powered by www.kitware.com<http://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

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview


**********************************************************************
Please consider the environment. Only print this email if absolutely necessary.

This email contains information that is private and confidential and is 
intended only for the addressee.
If you are not the intended recipient please delete it and notify us 
immediately by e-mailing the sender.
Note: All email sent to or from this address may be accessed by someone other 
than the recipient, for
system management and security reasons.
Aircraft Research Association Ltd.  Registered in England, Registration No 
503668 Registered Office:
Manton Lane, Bedford MK41 7PF England VAT No GB 196351245

**********************************************************************
_______________________________________________
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

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

Reply via email to