[vtkusers] How to change the color of a single polyline ??

Rakesh Patil rakeshthp at in.com
Thu Mar 25 00:14:29 EDT 2010


Hello,As suggested by Bill, I tried to implement it by setting ascalar to celldata of my unstructured grid.. Initial setup of scalarsworks fine... But when i change color by selecting it, there doesnt seemany changes... Here is what I'm doing..I've used a callbacktechnique to pick and object by deriving, a subclass from vtkCommand.InExecute function, I have following statement apart from highlighting..EApp::instance()>setSelectedPropId(picker>GetCellId());EApp::instance()>setSelectedActor(picker>GetActor());Later, when i change the type ofpolyline, this is what i do..vtkIdType id =EApp::instance()>getSelectedPropId();vtkActor *act =EApp::instance()>getSelectedActor();act>GetMapper()>GetInput()>GetCellData()>GetScalars()>InsertTuple1(id,6);act>Modified();By doing this, it is not showinany change in color... Initially i'm setting all colors to 0. And mylookup table contains only 10 values... i mean colors.. Even if i addthis actor to a renderer, no change is shown..What may be 
 theproblem..??ThanksRegardsRakesh PatilOriginal message From:"Rakesh Patil"< rakeshthp at in.com>Date: 24 Mar 10 10:14:09Subject:Re: [vtkusers] How tochange the color of a single polyline ??To: "Bill Lorensen" Hello,Its not the question of highlighting... I'm workingon FEM based mesh generation application.. So, I draw a line and have toset the property for this line. I mean polyline.. This line isclassified into two, closed boundary or open boundary. So, initiallywhen i draw a line, it has unassigned value.. i.e. boundary is notdefined.. Thus it is black in color.. THen i select this line and changethe properties.. If it is set to be an open boundary then it should beof say green color... and if it is of closed boundary, I need to show itin say brown color.. And this color will remain unchanged till end. Imean till mesh is generated, till file is saved. And even after file isreloaded, based on the property the same color it should show..Ihope the problem is clear... :) Any sol
 utions for this..??ThanksRegardsRakeshPatilOriginal message From:Bill Lorensen<bill.lorensen at gmail.com >;Date: 23 Mar 10 23:35:18Subject: Re: [vtkusers] How to changethe color of a single polyline ??To: David Doria Addcell data scalars to the unstructured grid. Then you have two options:1)Assign a different cell scalar to the polyline to be highlightede.g.1. Make all of the other cell scalars another value, e.g. 0.. UseavtkLookupTable to assign the proper colors.2) Make each cell datascalar a unique value (say 0...n1). Create avtkLookupTable with ncolors. Modify the entry of the cell you want tohighlight.BillOnTue, Mar 23, 2010 at 8:02 AM, David Doria wrote:> On Tue, Mar 23, 2010 at 5:58 AM, Rakesh Patil wrote:>>>> Hello users>>>> Ihave one unstructured grid which contains more than one polylines and>>polyvertex. Now, on the other hand, I have only one actor corresponding to>> this grid. Now what I want to do is select aparticular polyline. And change>> the color of this pol
 yline.Initially all polylines are black in color. Once>> i changethe color, it should be reflected back in the actor only for that>>particular polyline..>>>> I have only one actor..And i guess, using this actor, if i change the>> color, usingget property, it changes the color of all the the polylines.>>How do i change the colors of only one polyline..??>>>>Thanks>>>> Regards>> Rakesh Patil>>>>I think you are supposed to make a new actor which contains theselected> line only, and set the color of that line.>Thanks,>> David>> Powered by www.kitware.com>> Visit other Kitware opensource projects at> http://www.kitware.com/opensource/opensource.html>>Please keep messages ontopic and check the VTK FAQ at:> http://www.vtk.org/Wiki/VTKFAQ>>Follow this link to subscribe/unsubscribe:> http://www.vtk.org/mailman/listinfo/vtkusers>>Get Yourself a cool, short @in.com Email ID now!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100325/d796fb38/attachment.htm>


More information about the vtkusers mailing list