Checking whether Get Closest Location nodes use the cutoff distance


Here’s a little Python example that shows how to get all the Get Closest Location nodes in a scene and check whether Enable Cutoff Distance is enabled.

Location queries can be expensive, in terms of memory and performance, so you usually want to have some sort of cutoff distance.

si = Application
log = si.LogMessage
nodes = Application.FindObjects( '', "{2E206DD7-DC51-49F7-92BD-F6CD863125D3}" )
for o in nodes:
	log( '%s : Enable Cutoff Distance=%s' % (o, str(o.InputPorts('enablecutoffdistance').Value) ) )
	#Application.InspectObj( o )
	log( '%s : %s' % (o.Parent, si.ClassName(o.Parent) ) )
	
# pointcloud.pointcloud.flock_SIM.State_0.GetClosestLocationNode : Enable Cutoff Distance=True
# pointcloud.pointcloud.flock_SIM.CompoundNode.GetClosestLocationNode : Enable Cutoff Distance=False
# pointcloud.pointcloud.flock_SIM.State_3.Get_Closest_Location_on_Geometry.GetClosestLocationNode : Enable Cutoff Distance=True
# pointcloud.pointcloud.flock_SIM.State_10.Get_Closest_Location_on_Geometry.GetClosestLocationNode : Enable Cutoff Distance=False
# pointcloud.pointcloud.flock_SIM.State_10.GetClosestLocationNode : Enable Cutoff Distance=True
# pointcloud.pointcloud.flock_SIM.State_0.flock_CurveDirection.GetClosestLocationNode : Enable Cutoff Distance=True
# pointcloud.pointcloud.flock_SIM.State_10.Surface_Force.Get_Closest_Location_on_Geometry.GetClosestLocationNode : Enable Cutoff Distance=None
# pointcloud.pointcloud.flock_SIM.ExecuteInAllStates.Flow_Around_Surface.GetClosestLocationNode : Enable Cutoff Distance=None
# pointcloud.pointcloud.flock_SIM.State_2.Flow_Around_Surface.GetClosestLocationNode : Enable Cutoff Distance=None
# pointcloud.pointcloud.flock_SIM.State_1.Surface_Force.Get_Closest_Location_on_Geometry.GetClosestLocationNode : Enable Cutoff Distance=None
# pointcloud.pointcloud.flock_SIM.CompoundNode[1].GetClosestLocation.GetClosestLocationNode : Enable Cutoff Distance=True
# pointcloud.pointcloud.flock_SIM.State_9.GetClosestLocation.GetClosestLocationNode : Enable Cutoff Distance=False


#
#nodeAddress = "pointcloud.pointcloud.flock_SIM.State_0"
#Application.SelectObj(nodeAddress)
#Application.OpenView("ICE Tree")

The Enable Cutoff Distance=None results mean that the cutoff distance is an exposed port in a compound. If you wanted to get that setting, it would take a bit more scripting…exercise left to the reader.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s