<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Yes, that works!<br>
    Now the box comes up immediately, in coloured form.<br>
    <br>
    Thanks!<br>
    Bertwim<br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 10/14/2014 10:28 PM, Cory Quammen
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAB5Fpx7jBrUP3Em14+C5M3_Xw_v4CiJ0Bab3ZQNqTUjvfrm88Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>Bertwim,</div>
        <div><br>
        </div>
        Try naming your arrays, e.g.
        <div><br>
        </div>
        <div><span style="font-family:arial,sans-serif;font-size:13px">vtxdata->SetName("Point
            Scalars");</span><br>
        </div>
        <div><span style="font-family:arial,sans-serif;font-size:13px">vxldata->SetName("Cell
            Scalars");</span><span
            style="font-family:arial,sans-serif;font-size:13px"><br>
          </span></div>
        <div><span style="font-family:arial,sans-serif;font-size:13px"><br>
          </span></div>
        <div><span style="font-family:arial,sans-serif;font-size:13px">and
            see if that makes them appear in the Coloring combo box.</span></div>
        <div><span style="font-family:arial,sans-serif;font-size:13px"><br>
          </span></div>
        <div><span style="font-family:arial,sans-serif;font-size:13px">Thanks,</span></div>
        <div><span style="font-family:arial,sans-serif;font-size:13px">Cory</span></div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Tue, Oct 14, 2014 at 4:23 PM, B.W.H.
          van Beest <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:bwvb@xs4all.nl" target="_blank">bwvb@xs4all.nl</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div text="#000000" bgcolor="#FFFFFF"> <big>Hello All, <br>
                <br>
                I wonder if I stumbled upon a bug, or if I made a
                thinking error myself. <br>
                <br>
                The issue is: I can get colouring of my Source object
                only after I write <br>
                it first to a vtk file and then read it back again! <br>
                <br>
                This is what I do:<br>
                <br>
                -) I create a single (rectangular) 3D cell from a
                (handcrafted) Source type,<br>
                     subclassed from vtkUnstructuredGridAlgorithm.<br>
                    This cell has scalar properties assigned to both its
                vertices as well as the cell itself.<br>
                <br>
                -)  After "Apply", the box becomes visible (surface
                representation)<br>
                     However, there are no colours. The "Coloring"
                section in the <br>
                     Properties panel does not show the scalar
                properties. Only<br>
                     "Solid Color" and "cellNormals" appear as
                combo-options.<br>
                <br>
                -)   After writing the model to a vtk file, and loading
                the latter, the <br>
                     loaded box does appear in its coloured form, with
                the scalar properties <br>
                     selectable in the "Coloring" combo box.     <br>
                <br>
                Why do the colours not show up immediately after I
                created ("Apply") the<br>
                source object. I naively tried a Modified() on the
                underlying unstructed grid object, <br>
                but that didn't help.</big><br>
              <br>
              <big>For completeness, I paste the relevant code as well
                as the vtk file (ascii).<br>
                <br>
                Kind Regards,<br>
                Bertwim</big><br>
              <br>
              <br>
              <br>
              ====================<br>
              int sphBoxSourceC::RequestData( vtkInformation
              *vtkNotUsed(request),<br>
                                              vtkInformationVector
              **vtkNotUsed(inputVector),<br>
                                              vtkInformationVector
              *outputVector)<br>
              {<br>
                 // Get the info object<br>
                 vtkInformation *outInfo =
              outputVector->GetInformationObject(0);<br>
                 vtkUnstructuredGrid *umesh =
              vtkUnstructuredGrid::SafeDownCast( outInfo->Get(
              vtkDataObject::DATA_OBJECT() ) );<br>
                 <br>
                 // Pre-allocate some memory<br>
                 umesh->Allocate( 1024 );<br>
              <br>
                 // Scalars for the property values<br>
                 vtkFloatArray* vtxdata = vtkFloatArray::New(); //
              property defined on a vertex.<br>
                 vtkFloatArray* vxldata = vtkFloatArray::New(); //
              property defined in a voxel.<br>
              <br>
                 // Specify points.<br>
                 float r0[] = { 0.0, 0.0, 0.0 };<br>
                 float r1[] = { 1.0, 0.0, 0.0 };<br>
                 float r2[] = { 0.0, 1.0, 0.0 };<br>
                 float r3[] = { 1.0, 1.0, 0.0 };<br>
                 float r4[] = { 0.0, 0.0, 1.0 };<br>
                 float r5[] = { 1.0, 0.0, 1.0 };<br>
                 float r6[] = { 0.0, 1.0, 1.0 };<br>
                 float r7[] = { 1.0, 1.0, 1.0 };<br>
                 <br>
                 // Collect the points in a vtk data structures.<br>
                 {<br>
                    vtkSmartPointer<vtkPoints> points =
              vtkSmartPointer<vtkPoints>::New();<br>
                    points->SetDataType( VTK_FLOAT );<br>
              <br>
                    points->InsertNextPoint( r0 ); 
              vtxdata->InsertNextValue( cos(0.1) );<br>
                    points->InsertNextPoint( r1 ); 
              vtxdata->InsertNextValue( cos(0.4) );<br>
                    points->InsertNextPoint( r2 ); 
              vtxdata->InsertNextValue( cos(0.7) );<br>
                    points->InsertNextPoint( r3 ); 
              vtxdata->InsertNextValue( cos(1.0) );<br>
                    points->InsertNextPoint( r4 ); 
              vtxdata->InsertNextValue( cos(1.3) );<br>
                    points->InsertNextPoint( r5 ); 
              vtxdata->InsertNextValue( cos(1.6) );<br>
                    points->InsertNextPoint( r6 ); 
              vtxdata->InsertNextValue( cos(1.9) );<br>
                    points->InsertNextPoint( r7 ); 
              vtxdata->InsertNextValue( cos(2.2) );<br>
              <br>
                    // Transfer points to umesh.<br>
                    umesh->SetPoints( points );<br>
                    umesh->GetPointData()->SetScalars( vtxdata );<br>
                 }<br>
              <br>
                 // Cell Topology<br>
                 vtkIdType vtx[8] = { 0, 1, 3, 2, 4, 5, 7, 6 };<br>
                 umesh->InsertNextCell( VTK_HEXAHEDRON, 8, vtx );
              vxldata->InsertNextValue( 3.14 );<br>
                 umesh->GetCellData()->SetScalars( vxldata );<br>
                 <br>
                 // Write data to a file<br>
                 {<br>
                    std::string fileName( "myfile.vtk" );<br>
                    V3D::Utils::WriteUMesh( umesh, "Rectangular block as
              umesh", fileName, VTK_ASCII );<br>
                    cerr << "Created: " << fileName <<
              std::endl;<br>
                 }<br>
              <br>
                 vtxdata->Delete();<br>
                 vxldata->Delete();<br>
                 <br>
                 return 1;<br>
              }<br>
              <br>
              =======================<br>
              The file "myfile.vtk", written above read:<br>
              =======================<br>
              # vtk DataFile Version
              3.0                                                                                                                      

              <br>
              Rectangular block as
              umesh                                                                                                                      

              <br>
              ASCII                                                                                                                                           

              <br>
              DATASET
              UNSTRUCTURED_GRID                                                                                                                       

              <br>
              POINTS 8
              float                                                                                                                                  

              <br>
              0 0 0 1 0 0 0 1
              0                                                                                                                               

              <br>
              1 1 0 0 0 1 1 0
              1                                                                                                                               

              <br>
              0 1 1 1 1
              1                                                                                                                                     

              <br>
              CELLS 1
              9                                                                                                                                       

              <br>
              8 0 1 3 2 4 5 7
              6                                                                                                                               

              <br>
                                                                                                                                                              

              <br>
              CELL_TYPES
              1                                                                                                                                    

              <br>
              12                                                                                                                                              

              <br>
                                                                                                                                                              

              <br>
              CELL_DATA
              1                                                                                                                                     

              <br>
              SCALARS scalars
              float                                                                                                                           

              <br>
              LOOKUP_TABLE
              default                                                                                                                            

              <br>
              3.14                                                                                                                                            

              <br>
              POINT_DATA
              8                                                                                                                                    

              <br>
              SCALARS scalars
              float                                                                                                                           

              <br>
              LOOKUP_TABLE
              default                                                                                                                            

              <br>
              0.995004 0.921061 0.764842 0.540302 0.267499 -0.0291995
              -0.32329
              -0.588501                                                                      

              <br>
              =======================<br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
            </div>
            <br>
            _______________________________________________<br>
            Powered by <a moz-do-not-send="true"
              href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
            <br>
            Visit other Kitware open-source projects at <a
              moz-do-not-send="true"
              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 ParaView Wiki
            at: <a moz-do-not-send="true"
              href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
            <br>
            Follow this link to subscribe/unsubscribe:<br>
            <a moz-do-not-send="true"
              href="http://public.kitware.com/mailman/listinfo/paraview"
              target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a><br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>