Examples

A basic example of how to use PLGPython inside PointKit Scan is shown below. This example loads a scan, aligns the scan, and sends a flag to PointKit Scan to read in the meshes.

Basic Examples

Loading a scan, aligning it, and passing the meshes back to PointKit:

import PointKitPy as pk
scriptingInterface = pk.Scripting()
scriptingInterface.Load(r"C:\path\to\scan.pbn")  # Load a PBN file containing multiple scans
scriptingInterface.AlignFast()
POINTKIT_MESHES = scriptingInterface.GetMeshes()  # or scriptingInterface.mMeshList

Running Cleanup on a folder of .ply files, decimating them, and saving them to a new folder:

import PointKitPy as pk
scriptingInterface = pk.Scripting()
# If you wanted to wait until a certain number of .ply files (e.g. 5) exist in the folder,
# you could use the following code:
# scriptingInterface.MonitorDirectory(r"C:\path\to\scans", 5, "*.ply")  # The filter supports regex.
scriptingInterface.Load(r"C:\path\to\scans")  # Load a folder containing multiple .ply files
scriptingInterface.Cleanup()
scriptingInterface.DecimateByRadius(0, True) # Auto-calculate the radius and use voxel downsampling
scriptingInterface.Save(r"C:\path\to\output")

PLGPython automatically keeps track of the meshes that you have loaded in, so you can call functions on the meshes without needing to pass them in as arguments, just like PointKit Scan’s mesh list. If you want to only work with a subset of the meshes, you can use the scriptingInterface.mMeshList list to access the meshes that were returned from the last function call. This is a list of PLGMeshExt objects that you can manipulate as you wish. To get a copy of the meshes that are currently loaded in, you can use the scriptingInterface.GetMeshes() function.

« Previous