Hello,<br><br>As suggested by Bill, I tried to implement it by setting a scalar to celldata of my unstructured grid.. Initial setup of scalars works fine... But when i change color by selecting it, there doesnt seem any changes... Here is what I'm doing..<br><br>I've used a callback technique to pick and object by deriving, a subclass from vtkCommand.<br><br>In Execute function, I have following statement apart from highlighting..<br><br>EApp::instance()->setSelectedPropId( picker->GetCellId());<br>EApp::instance()->setSelectedActor( picker->GetActor());<br><br>Later, when i change the type of polyline, this is what i do..<br><br>vtkIdType _id = EApp::instance()->getSelectedPropId();<br><br>vtkActor *act = EApp::instance()->getSelectedActor();<br><br>act->GetMapper()->GetInput()->GetCellData()->GetScalars()->InsertTuple1(_id, 6);<br><br>act->Modified();<br><br>By doing this, it is not showin any change in color... Initially i'm setting all
colors to 0. And my lookup table contains only 10 values... i mean colors.. Even if i add this actor to a renderer, no change is shown..<br><br>What may be the problem..??<br><br>Thanks<br><br>Regards<br>Rakesh Patil<br><blockquote><br>---------- Original message ----------<br>From:"Rakesh Patil"< rakeshthp@in.com ><br>Date: 24 Mar 10 10:14:09<br>Subject: Re: [vtkusers] How to change the color of a single polyline ??<br>To: "Bill Lorensen" <bill.lorensen@gmail.com><br><br> <br>Hello,<br><br>Its not the question of highlighting... I'm working on FEM based mesh generation application.. So, I draw a line and have to set the property for this line. I mean polyline.. This line is classified into two, closed boundary or open boundary. So, initially when i draw a line, it has unassigned value.. i.e. boundary is not defined.. Thus it is black in color.. THen i select this line and change the properties.. If it is set to be an open boundary then it should be of say green colo
r... and if it is of closed boundary, I need to show it in say brown color.. And this color will remain unchanged till end. I mean till mesh is generated, till file is saved. And even after file is reloaded, based on the property the same color it should show..<br><br>I hope the problem is clear... :) Any solutions for this..??<br><br>Thanks<br><br>Regards<br>Rakesh Patil<br><font color="#000000"></font><blockquote><font color="#000000"><br>---------- Original message ----------<br>From:Bill Lorensen< bill.lorensen@gmail.com >
;<br>Date: 23 Mar 10 23:35:18<br>Subject: Re: [vtkusers] How to change the color of a single polyline ??<br>To: David Doria <daviddoria+vtk@gmail.com><br><br>Add cell data scalars to the unstructured grid. Then you have two options:<br><br>1) Assign a different cell scalar to the polyline to be highlighted<br>e.g. 1. Make all of the other cell scalars another value, e.g. 0.. Use<br>a vtkLookupTable to assign the proper colors.<br>2) Make each cell data scalar a unique value (say 0...n-1). Create a<br>vtkLookupTable with n colors. Modify the entry of the cell you want to<br>highlight.<br><br>Bill<br><br><br>On Tue, Mar 23, 2010 at 8:02 AM, David Doria <daviddoria+vtk@gmail.com> wrote:<br>> On Tue, Mar 23, 2010 at 5:58 AM, Rakesh Patil <rakeshthp@in.com> wrote:<br>>><br>>> Hello users<br>>><br>>> I have one unstructured grid which contains more than one poly-lines and<br>>> poly-vertex. Now, on the other hand, I have only one actor correspondi
ng to<br>>> this grid. Now what I want to do is select a particular polyline. And change<br>>> the color of this polyline. Initially all polylines are black in color. Once<br>>> i change the color, it should be reflected back in the actor only for that<br>>> particular polyline..<br>>><br>>> I have only one actor.. And i guess, using this actor, if i change the<br>>> color, using get property, it changes the color of all the the polylines.<br>>> How do i change the colors of only one polyline..??<br>>><br>>> Thanks<br>>><br>>> Regards<br>>> Rakesh Patil<br>>><br>><br>> I think you are supposed to make a new actor which contains the selected<br>> line only, and set the color of that line.<br>> Thanks,<br>><br>> David<br>> _______________________________________________<br>> Powered by <a target=\"_blank\" href="http://www.kitware.com" target="\"_blank\"">www.k
itware.com</a>
<br>><br>> Visit other Kitware open-source projects at<br>> <a target=\"_blank\" 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 target=\"_blank\" 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 target=\"_blank\" href="http://www.vtk.org/mailman/listinfo/vtkusers" target="\"_blank\"">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>><br>><br></rakeshthp@in.com></daviddoria+vtk@gmail.com></daviddoria+vtk@gmail.com></font></blockquote>
</bill.lorensen@gmail.com></blockquote>