# OBJ to parallel VTP files

**URL:** https://discourse.vtk.org/t/obj-to-parallel-vtp-files/6318
**Category:** Support
**Created:** [August 7, 2021, 12:02am UTC](https://discourse.vtk.org/t/obj-to-parallel-vtp-files/6318 "2021-08-07T00:02:10Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Nicholas\_Yue](https://discourse.vtk.org/user_avatar/discourse.vtk.org/nicholas_yue/32/3751_2.png) [@Nicholas\_Yue](https://discourse.vtk.org/u/Nicholas_Yue)
#### Post date: [August 7, 2021, 12:02am UTC](https://discourse.vtk.org/t/obj-to-parallel-vtp-files/6318/1 "2021-08-07T00:02:10Z")

</div>

I am attempting to split up a high res mesh into 4 parts for parallel rendering in paraview on a cluster of 4 GPUs

My attempt at creating the parallel \*.vtp file only resulted in a single portion visible so this leads me to suspect that my obj2vtp script is incorrect.

Is this the correct way to write out parallel vtp files ?

```auto
from __future__ import print_function
import sys

if(len(sys.argv) != 3):
  print('Usage: ', sys.argv[0], 'input.obj output.vtp')
  sys.exit()

import vtk
reader = vtk.vtkOBJReader()
reader.SetFileName(sys.argv[1])
reader.Update()
obj = reader.GetOutput()

dicer = vtk.vtkOBBDicer()
dicer.SetInputData(obj)
dicer.SetNumberOfPieces(4)
dicer.SetDiceModeToSpecifiedNumberOfPieces();
dicer.Update();

selector = vtk.vtkThreshold()
selector.SetInputArrayToProcess(0, 0, 0, 0, "vtkOBBDicer_GroupIds")
selector.SetInputConnection(dicer.GetOutputPort())
selector.AllScalarsOff()

geometry = vtk.vtkGeometryFilter()
geometry.SetInputConnection(selector.GetOutputPort())

writer = vtk.vtkXMLPolyDataWriter()
writer.SetInputConnection(geometry.GetOutputPort());
for i in range(dicer.GetNumberOfActualPieces()) :
    pieceName = 'abc_{}.vtp'.format(i+1)
    selector.ThresholdBetween(i, i)
    writer.SetFileName(pieceName)
    writer.Write()

```
