Skip to content

Instantly share code, notes, and snippets.

@1f0
Last active May 9, 2019 11:08
Show Gist options
  • Save 1f0/6e987249517d3e197ffa7d995f0bacb1 to your computer and use it in GitHub Desktop.
Save 1f0/6e987249517d3e197ffa7d995f0bacb1 to your computer and use it in GitHub Desktop.
<ServerManagerConfiguration>
<ProxyGroup name="filters">
<!-- ================================================================== -->
<SourceProxy name="DistancePolyDataFilter" class="vtkDistancePolyDataFilter" label="DistancePolyDataFilter">
<Documentation
long_help="Computes the signed distance from one vtkPolyData to another."
short_help="vtkDistancePolyDataFilter.">
</Documentation>
<InputProperty
name="SourcePolyData"
port_index="0"
command="SetInputConnection">
<ProxyGroupDomain name="groups">
<Group name="sources"/>
<Group name="filters"/>
</ProxyGroupDomain>
<DataTypeDomain name="input_type">
<DataType value="vtkPolyData"/>
</DataTypeDomain>
<Documentation>
Set the source data set.
</Documentation>
</InputProperty>
<InputProperty
name="TargetPolyData"
port_index="1"
command="SetInputConnection">
<ProxyGroupDomain name="groups">
<Group name="sources"/>
<Group name="filters"/>
</ProxyGroupDomain>
<DataTypeDomain name="input_type">
<DataType value="vtkPolyData"/>
</DataTypeDomain>
<Documentation>
Set the target data set.
</Documentation>
</InputProperty>
<Hints>
<!-- see below for what options to put here -->
</Hints>
</SourceProxy>
<!-- End DistancePolyDataFilter -->
</ProxyGroup>
<!-- End Filters Group -->
</ServerManagerConfiguration>
from __future__ import print_function
from paraview.simple import *
import sys
if(len(sys.argv) < 3):
print('Usage: ', sys.argv[0], 'src.obj', 'dst.obj')
sys.exit(1)
LoadPlugin("./distance-polydata.xml", False, globals())
readers = []
for i in range(2):
r = WavefrontOBJReader(FileName=sys.argv[i + 1])
readers.append(r)
distanceFilter = DistancePolyDataFilter(SourcePolyData=readers[0],
TargetPolyData=readers[1])
views = []
for i in range(2):
v = CreateRenderView()
v.ViewSize = [512, 512]
w = v.GetRenderWindow()
w.SetPosition(i * 512, 0)
Show(OutputPort(distanceFilter, i + 1), v)
views.append(v)
# camera is no set correctly by default
AddCameraLink(views[0], views[1], 'v1v2')
ResetCamera(views[0])
views[0].CenterOfRotation = GetActiveCamera().GetFocalPoint()
RenderAllViews()
Interact()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment