|
From: | Axel Arnold |
Subject: | Re: [ESPResSo-users] particle does not exist |
Date: | Wed, 18 Jun 2014 09:27:05 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 |
On 06/18/2014 05:06 AM, Xikai Jiang
wrote:
You could also just ask for the type of the particle, that works with any property. However, there is a second possibility which avoids the overhead of an extra "part print". Tcl can catch errors, so you can just delete the particles like this: if {[catch {part $id delete}]} { puts "it's deleted particle" } { puts "just deleted particle $id" } Using this snippet, you get the message if the particle doesn't exist, but if it did, it immediately gets deleted. Best, Axel
-- JP Dr. Axel Arnold ICP, Universität Stuttgart Allmandring 3 70569 Stuttgart, Germany Email: address@hidden Tel: +49 711 685 67609 |
[Prev in Thread] | Current Thread | [Next in Thread] |