This example loads three different hexahedral geometry files from disk.
In a pre-processing, each geometry is tetrahedralized, which is used as input data.
On each of the three geometries, ManifoldCheck is executed. This filters adds link numbers to vertices and cells, which can be used to detect and extract non-manifold vertices (left), edges (middle), and faces (right).
#!/usr/bin/env pythonfromparaview.simpleimport*# create a new 'XML Unstructured Grid Reader'manifoldCheck0vtu=XMLUnstructuredGridReader(FileName=["manifoldCheck0.vtu"])# create a new 'Tetrahedralize'tetrahedralize1=Tetrahedralize(Input=manifoldCheck0vtu)# create a new 'TTK ManifoldCheck'tTKManifoldCheck1=TTKManifoldCheck(Input=tetrahedralize1)# create a new 'Mask Points'maskPoints1=MaskPoints(Input=tTKManifoldCheck1)maskPoints1.OnRatio=1maskPoints1.MaximumNumberofPoints=1000maskPoints1.GenerateVertices=1maskPoints1.SingleVertexPerCell=1# create a new 'Threshold'# this extracts non-manifold verticesthreshold1=Threshold(Input=maskPoints1)threshold1.Scalars=["POINTS","VertexLinkComponentNumber"]threshold1.ThresholdMethod="Between"threshold1.LowerThreshold=2.0threshold1.UpperThreshold=2.0# save the outputSaveData("manifoldCheck0_check.vtu",tTKManifoldCheck1)SaveData("manifoldCheck0_non_manifold.vtu",threshold1)
To run the above Python script, go to your ttk-data directory and enter the following command:
#!/usr/bin/env pythonfromparaview.simpleimport*# create a new 'XML Unstructured Grid Reader'manifoldCheck1vtu=XMLUnstructuredGridReader(FileName=["manifoldCheck1.vtu"])# create a new 'Tetrahedralize'tetrahedralize2=Tetrahedralize(Input=manifoldCheck1vtu)# create a new 'TTK ManifoldCheck'tTKManifoldCheck2=TTKManifoldCheck(Input=tetrahedralize2)# create a new 'Extract Edges'extractEdges2=ExtractEdges(Input=tTKManifoldCheck2)# create a new 'Threshold'# this extracts non-manifold edgesthreshold2=Threshold(Input=extractEdges2)threshold2.Scalars=["POINTS","EdgeLinkComponentNumber"]threshold2.ThresholdMethod="Between"threshold2.LowerThreshold=2.0threshold2.UpperThreshold=2.0# save the outputSaveData("manifoldCheck1_check.vtu",tTKManifoldCheck2)SaveData("manifoldCheck1_non_manifold.vtu",threshold2)
To run the above Python script, go to your ttk-data directory and enter the following command:
#!/usr/bin/env pythonfromparaview.simpleimport*# create a new 'XML Unstructured Grid Reader'manifoldCheck2vtu=XMLUnstructuredGridReader(FileName=["manifoldCheck2.vtu"])# create a new 'Tetrahedralize'tetrahedralize3=Tetrahedralize(registrationName="Tetrahedralize3",Input=manifoldCheck2vtu)# create a new 'TTK ManifoldCheck'tTKManifoldCheck3=TTKManifoldCheck(registrationName="TTKManifoldCheck3",Input=tetrahedralize3)# create a new 'Threshold'# this extracts tetrahedra that contain non-manifold facesthreshold3=Threshold(registrationName="Threshold3",Input=tTKManifoldCheck3)threshold3.Scalars=["CELLS","TriangleLinkComponentNumber"]threshold3.ThresholdMethod="Between"threshold3.LowerThreshold=3.0threshold3.UpperThreshold=3.0# create a new 'Generate Ids'generateIds1=GenerateIds(registrationName="GenerateIds1",Input=threshold3)generateIds1.PointIdsArrayName="VertexIdentifiers"generateIds1.CellIdsArrayName="CellIdentifiers"# create a new 'Threshold'# select two of the tetrahedrathreshold4=Threshold(registrationName="Threshold4",Input=generateIds1)threshold4.Scalars=["CELLS","CellIdentifiers"]threshold4.ThresholdMethod="Between"threshold4.LowerThreshold=0.0threshold4.UpperThreshold=1.0# create a new 'Extract Surface'extractSurface2=ExtractSurface(registrationName="ExtractSurface2",Input=threshold4)# create a new 'Threshold'# this extracts non-manifold facesthreshold5=Threshold(registrationName="Threshold5",Input=extractSurface2)threshold5.Scalars=["POINTS","TriangleLinkComponentNumber"]threshold5.ThresholdMethod="Between"threshold5.LowerThreshold=3.0threshold5.UpperThreshold=3.0# save the outputSaveData("manifoldCheck2_check.vtu",tTKManifoldCheck3)SaveData("manifoldCheck2_non_manifold.vtu",threshold5)
To run the above Python script, go to your ttk-data directory and enter the following command: