<div dir="ltr"><div style="font-family:新宋体;font-size:12px">Now I have an vtkDataSet object from a reader.I had tried to change the color of the output of vtkDataSetReader(not set the color of actor), but had no idea.</div>
<div style="font-family:新宋体;font-size:12px"><br></div><div style="font-family:新宋体;font-size:12px">The reason is that I want to write the dataset back to hard disk with the new color.</div><div style="font-family:新宋体;font-size:12px">
</div><div style="font-family:新宋体;font-size:12px">I could get the number of cells in this dataset, and when I tried to get the scalars and modify the scalars(it holds the color, am I right), it crushed.</div><div style="font-family:新宋体;font-size:12px">
<font color="#0000ff"> this->reader->Update();<br> vtkDataSet* ds = reader->GetOutput();<br> vtkCellData* cellData = ds->GetCellData();<br> vtkDataArray* scalars = cellData->GetScalars();</font></div>
<div style="font-family:新宋体;font-size:12px"><font color="#0000ff"> int size = scalars->GetSize();//equals to the number of cells in dataset?</font></div><div style="font-family:新宋体;font-size:12px"><font color="#0000ff"> //then we can modify scalars...</font></div>
<div style="font-family:新宋体;font-size:12px"> </div><div style="font-family:新宋体;font-size:12px"> </div><div style="font-family:新宋体;font-size:12px">I am not sure if it is the right way, and I googled it, but found nothing helpful,</div>
<div style="font-family:新宋体;font-size:12px"> </div><div style="font-family:新宋体;font-size:12px">The vtk file was converted from vrml.and it has about 332 points, 110 lines, 102 polygons,and I found in this file there were:</div>
<div style="font-family:新宋体;font-size:12px"><font color="#0000ff">POINT_DATA 332<br>COLOR_SCALARS VRMLColor 3</font></div><div style="font-family:新宋体;font-size:12px"><font color="#0000ff"></font> </div><div style="font-family:新宋体;font-size:12px">
<font color="#000000">So, could any one give me some tips?</font></div><div style="font-family:新宋体;font-size:12px"><h2 style="border:0px;padding:0px;margin:25px 25px 10px 0px;outline:invert none 0px;font-size:16px;line-height:18px;font-family:Arial,华文细黑,'STHeiti Light',微软雅黑体,'Microsoft Yahei',新宋体,NSimSun,宋体,SimSun;color:rgb(0,0,0);vertical-align:baseline;overflow:hidden">
<font face="微软雅黑">Any advice would be appreciated!</font></h2></div></div>