Delete by id %

   10434   8   1
User Avatar
Member
2624 posts
Joined: Aug. 2006
Offline
Hi Brains trust,
Is there a way to delete points by a ID % . I can already delete by a % with $PT as there's $NPT to give you the total. I can delete based on a id number ie
$ID <= 3000
I just thought there might be something more elegant

Any ideas

rob
Gone fishing
User Avatar
Member
166 posts
Joined: March 2013
Offline
You could do something like rand(@id) > 0.5. Maybe not the most controllable, but should get you roughly a correct percentage.
User Avatar
Member
2624 posts
Joined: Aug. 2006
Offline
Thanks ….
Gone fishing
User Avatar
Member
85 posts
Joined: Aug. 2010
Offline
in a attribute wrangle running on points you can use:

int modulus = 5;
if (@id %modulus==0 )

{

removepoint( geoself(), @ptnum );

}

the code above is tested
Edited by - Feb. 25, 2016 16:22:00
Sam Swift-Glasman
Art Director
Five AI
User Avatar
Member
2624 posts
Joined: Aug. 2006
Offline
I am going to test that as soon as I get to work !

Rob
Gone fishing
User Avatar
Member
85 posts
Joined: Aug. 2010
Offline
my example above would remove 20% of points
using a modulus is fine if you want to remove a simple amount ie half %2, a third %3 ect

I had another go and realised that to use a percentage instead you could use the following snippet:

int percentage = 75;
if ( @id % 100 < percentage )

{

removepoint( geoself(), @ptnum );

}
Sam Swift-Glasman
Art Director
Five AI
User Avatar
Member
2624 posts
Joined: Aug. 2006
Offline
Very cool and going straight into my online notebook

Rob
Gone fishing
User Avatar
Member
85 posts
Joined: Aug. 2010
Offline
No problem

is your notebook public? I wouldn't mind having a look if so

do you have a link?

cheers
Sam Swift-Glasman
Art Director
Five AI
User Avatar
Member
2624 posts
Joined: Aug. 2006
Offline
PM sent

Rob
Gone fishing
  • Quick Links