<div dir="ltr"><div>Ishan,</div><div><br></div>The actor->RotateZ(1); call rotates only the visible representation of the cube, not the actual points that define the cube. Use vtkTransformPolyDataFilter [1] to transform the cube source and save the output of the transform filter.<div><br></div><div>[1] <a href="http://www.vtk.org/doc/release/6.2/html/classvtkTransformPolyDataFilter.html">http://www.vtk.org/doc/release/6.2/html/classvtkTransformPolyDataFilter.html</a><br><div><br></div><div>HTH,</div></div><div>Cory</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 22, 2015 at 1:00 PM, Ishan Tembhekar <span dir="ltr"><<a href="mailto:ishan.tembhekar@caltech.edu" target="_blank">ishan.tembhekar@caltech.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello everyone, <br><br>I am new to using VTK and to this forum. I have tried searching for an answer for this issue for a while and wanted some help. <div><br></div><div>I am writing a code in c++ that generates an output of a cube and stores it in a .vtp file. The code is as follows: (The variables center, _widthOfBottomFace, _widthOfSideFace, _widthInZDirection are defined elsewhere) </div><div><br></div><div>vtkSmartPointer<vtkCubeSource> cubeSource =</div><div> vtkSmartPointer<vtkCubeSource>::New();</div><div><br></div><div> //set dimensions of cube</div><div> cubeSource->SetCenter(center[0], center[1], center[2]);</div><div> cubeSource->SetXLength(_widthOfBottomFace);</div><div> cubeSource->SetYLength(_widthOfSideFace);</div><div> cubeSource->SetZLength(_widthInZDirection);</div><div> cubeSource->Update();</div><div><br></div><div> //rotate the cube now</div><div> vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();</div><div> mapper->SetInputData(cubeSource->GetOutput());</div><div><br></div><div> vtkActor* actor = vtkActor::New();</div><div> actor->SetMapper(mapper);</div><div> actor->SetOrigin(cubeSource->GetCenter());</div><div><br></div><div> actor->RotateZ(1);</div><div><br></div><div><br></div><div> //create the writer</div><div> vtkSmartPointer<vtkXMLPolyDataWriter> writer =</div><div> vtkSmartPointer<vtkXMLPolyDataWriter>::New();</div><div><br></div><div> // Build the filename</div><div> char buffer[500];</div><div> sprintf(buffer, "%06u", fileIndex);</div><div> string filename =string("CuboidalIndenter_") +</div><div> string(buffer) + string(".vtp");</div><div><br></div><div> //printf("writing file to %s\n", filename.c_str());</div><div> writer->SetFileName(filename.c_str());</div><div> writer->SetInputConnection(cubeSource->GetOutputPort());</div><div><br></div><div><br></div><div> // write the vtk file</div><div> writer->SetDataModeToBinary();</div><div> int result = writer->Write();</div><div> if (result != 1) {</div><div> printf("Error writing cuboidal indenter vtk file\n");</div><div><br></div><div> </div><div>I want to have the rotated cube as the output and currently I am using the object cubeSource which does not give me the rotated cube. <br>Can someone tell me how I can write out the rotated cube ? </div><div><br></div><div>Thank you so much! </div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-Ishan</div></font></span></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Cory Quammen<br>R&D Engineer<br>Kitware, Inc.</div>
</div>