Finding Particle Neighbours
Dyverso Domains
Add script to Simulation Flow (Ctrl/Cmd + F2) > FramesPre or StepsPre.
Find a particle's neighbours in domain "DY_Domain01" and the given search radius. The number of neighbours will be displayed for every particle:
# Get the domain "DY_Domain01" and its particles dyversoDomain = scene.get_DY_Domain("DY_Domain01") domainParticles = dyversoDomain.getParticles() searchRadius = 0.2 # Loop through every particle, read out its position for particle in domainParticles: particlePos = particle.getPosition() # Search for neighbours at the particle's position and within the given radius neighbours = dyversoDomain.getNeighbors(particlePos, searchRadius) # Print out how many particles were found scene.message(str(len(neighbours))+" neighbour particles found for particle "+str(particle.getId()))
Standard Particle Fluid Emitters
Add script to Simulation Flow (Ctrl/Cmd + F2) > FramesPre or StepsPre.
Find a particle's neighbours in emitter "Square01" and the given search radius. The number of neighbours will be displayed for every particle:
# Get the standard particle emitter "Square01" and its particles emitter = scene.get_PB_Emitter("Square01") emitterParticles = emitter.getParticles() searchRadius = 0.2 # Loop through every particle for particle in emitterParticles: # Search for neighbours within the given radius neighbours = particle.getNeighbors(searchRadius) # Print out how many particles were found scene.message(str(len(neighbours))+" neighbour particles found for particle "+str(particle.getId()))
Hybrido Domains
A comparable function is not available for Hybrido core fluid particles or secondary fluid particles.